GitHub PullRequestReviewCommentEvent at 2014-08-15 21:29:47
Repository: kpatch
Actor: jpoimboe
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/dynup/kpatch/pulls/comments/16316434","id":16316434,"diff_hunk":"@@ -248,6 +247,7 @@ static int patch_make_funcs_list(struct list_head *objects)\n \tfor (p_func = __kpatch_funcs; p_func < __kpatch_funcs_end; p_func++) {\n \t\tobject = patch_find_or_add_object(&kpmod.objects,\n \t\t\t\t\t\t  p_func->objname);\n+","path":"kmod/patch/kpatch-patch-hook.c","position":32,"original_position":32,"commit_id":"5e1a0cde2822e90408ea1ee19aabc98a7d38a073","original_commit_id":"5e1a0cde2822e90408ea1ee19aabc98a7d38a073","user":{"login":"jpoimboe","id":1750978,"avatar_url":"https://avatars.githubusercontent.com/u/1750978?v=2","gravatar_id":"323cc0596f3e3198a481390fb5064f2a","url":"https://api.github.com/users/jpoimboe","html_url":"https://github.com/jpoimboe","followers_url":"https://api.github.com/users/jpoimboe/followers","following_url":"https://api.github.com/users/jpoimboe/following{/other_user}","gists_url":"https://api.github.com/users/jpoimboe/gists{/gist_id}","starred_url":"https://api.github.com/users/jpoimboe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpoimboe/subscriptions","organizations_url":"https://api.github.com/users/jpoimboe/orgs","repos_url":"https://api.github.com/users/jpoimboe/repos","events_url":"https://api.github.com/users/jpoimboe/events{/privacy}","received_events_url":"https://api.github.com/users/jpoimboe/received_events","type":"User","site_admin":false},"body":"Ditto","created_at":"2014-08-15T21:29:47Z","updated_at":"2014-08-15T21:29:47Z","html_url":"https://github.com/dynup/kpatch/pull/360#discussion_r16316434","pull_request_url":"https://api.github.com/repos/dynup/kpatch/pulls/360","_links":{"self":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/comments/16316434"},"html":{"href":"https://github.com/dynup/kpatch/pull/360#discussion_r16316434"},"pull_request":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/360"}}},"pull_request":{"url":"https://api.github.com/repos/dynup/kpatch/pulls/360","id":19734681,"html_url":"https://github.com/dynup/kpatch/pull/360","diff_url":"https://github.com/dynup/kpatch/pull/360.diff","patch_url":"https://github.com/dynup/kpatch/pull/360.patch","issue_url":"https://api.github.com/repos/dynup/kpatch/issues/360","number":360,"state":"open","locked":false,"title":"kpatch-patch-hook: fix incorrect old_offsets for loadable modules","user":{"login":"flaming-toast","id":1253762,"avatar_url":"https://avatars.githubusercontent.com/u/1253762?v=2","gravatar_id":"06ecae11d1c3cea65e3f03245c8a31e4","url":"https://api.github.com/users/flaming-toast","html_url":"https://github.com/flaming-toast","followers_url":"https://api.github.com/users/flaming-toast/followers","following_url":"https://api.github.com/users/flaming-toast/following{/other_user}","gists_url":"https://api.github.com/users/flaming-toast/gists{/gist_id}","starred_url":"https://api.github.com/users/flaming-toast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaming-toast/subscriptions","organizations_url":"https://api.github.com/users/flaming-toast/orgs","repos_url":"https://api.github.com/users/flaming-toast/repos","events_url":"https://api.github.com/users/flaming-toast/events{/privacy}","received_events_url":"https://api.github.com/users/flaming-toast/received_events","type":"User","site_admin":false},"body":"This PR attempts to fix issue #356.\r\n\r\nTo summarize the changeset:\r\n1) A sysfs hook will be created if the module is not loaded by the time the patch module is loaded. This hook will be called by `kpatch_module_notify`.\r\n\r\nsysfs file creation was taken out of `patch_make_funcs_list` and put into a separate function named `patch_create_func_sysfs`. `kpmod.add_sysfs_func` will be set to point to this function if we need to delay sysfs initialization. I feel like this is a bit hacky, but I used a hook because I wanted to preserve existing scope boundaries as much as possible, without porting any of the local structs and functions used solely in kpatch-patch-hook during sysfs initialization (for example, `kpatch_func_object` used in kobject creation is local to kpatch-patch-hook only, and we wouldn't have access to that in the core module if we wanted to create the sysfs files then and there.)\r\n\r\n2) `kpatch_func_obj`, the struct that contains the kobject and is local only to patch module, is set to point to the `kpatch_func` struct instead of the `kpatch_patch_func` struct (which is local to the patch module). I did this so that the core module could call the sysfs hook and pass to it a `kpatch_func` struct, as it does *not* have access to the `kpatch_patch_func` struct. (`kpatch_func` and `kpatch_patch_func` both contain the same information, so I think this change should be safe)\r\n\r\n3) Lastly, if the module is already loaded, `patch_make_funcs_list` will now resolve old_addr using `kpatch_find_module_symbol`. I had to export it to make it available to the patch module...\r\n\r\nTested on Ubuntu 14.04 and Arch with the ext4 patch in #356 and the btrfs patch below (both compiled as modules), though I'd like verification that it works for other people. `old_addr` and `new_addr` were verified by cross-checking with `/proc/kallsyms`. \r\n```\r\ndiff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c\r\nindex 7869936..890f8f9 100644\r\n--- a/fs/btrfs/sysfs.c\r\n+++ b/fs/btrfs/sysfs.c\r\n@@ -92,6 +92,7 @@ static int can_modify_feature(struct btrfs_feature_attr *fa)\r\n static ssize_t btrfs_feature_attr_show(struct kobject *kobj,\r\n                                       struct kobj_attribute *a, char *buf)\r\n {\r\n+       pr_info(\"btrfs_feature_attr_show\");\r\n        int val = 0;\r\n        struct btrfs_fs_info *fs_info = to_fs_info(kobj);\r\n        struct btrfs_feature_attr *fa = to_btrfs_feature_attr(a);\r\n```\r\n\r\nIf anyone thinks I should take a different approach, I'm all ears.This is an initial version of the fix and I suspect there are mistakes and better ways of solving this issue, so feedback is more than welcome.","created_at":"2014-08-13T16:13:21Z","updated_at":"2014-08-15T21:29:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b56446b8ab620b49c145a73e0fb97fca66dd7067","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dynup/kpatch/pulls/360/commits","review_comments_url":"https://api.github.com/repos/dynup/kpatch/pulls/360/comments","review_comment_url":"https://api.github.com/repos/dynup/kpatch/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dynup/kpatch/issues/360/comments","statuses_url":"https://api.github.com/repos/dynup/kpatch/statuses/5e1a0cde2822e90408ea1ee19aabc98a7d38a073","head":{"label":"flaming-toast:func-sysfs-fix","ref":"func-sysfs-fix","sha":"5e1a0cde2822e90408ea1ee19aabc98a7d38a073","user":{"login":"flaming-toast","id":1253762,"avatar_url":"https://avatars.githubusercontent.com/u/1253762?v=2","gravatar_id":"06ecae11d1c3cea65e3f03245c8a31e4","url":"https://api.github.com/users/flaming-toast","html_url":"https://github.com/flaming-toast","followers_url":"https://api.github.com/users/flaming-toast/followers","following_url":"https://api.github.com/users/flaming-toast/following{/other_user}","gists_url":"https://api.github.com/users/flaming-toast/gists{/gist_id}","starred_url":"https://api.github.com/users/flaming-toast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaming-toast/subscriptions","organizations_url":"https://api.github.com/users/flaming-toast/orgs","repos_url":"https://api.github.com/users/flaming-toast/repos","events_url":"https://api.github.com/users/flaming-toast/events{/privacy}","received_events_url":"https://api.github.com/users/flaming-toast/received_events","type":"User","site_admin":false},"repo":{"id":20674686,"name":"kpatch","full_name":"flaming-toast/kpatch","owner":{"login":"flaming-toast","id":1253762,"avatar_url":"https://avatars.githubusercontent.com/u/1253762?v=2","gravatar_id":"06ecae11d1c3cea65e3f03245c8a31e4","url":"https://api.github.com/users/flaming-toast","html_url":"https://github.com/flaming-toast","followers_url":"https://api.github.com/users/flaming-toast/followers","following_url":"https://api.github.com/users/flaming-toast/following{/other_user}","gists_url":"https://api.github.com/users/flaming-toast/gists{/gist_id}","starred_url":"https://api.github.com/users/flaming-toast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flaming-toast/subscriptions","organizations_url":"https://api.github.com/users/flaming-toast/orgs","repos_url":"https://api.github.com/users/flaming-toast/repos","events_url":"https://api.github.com/users/flaming-toast/events{/privacy}","received_events_url":"https://api.github.com/users/flaming-toast/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flaming-toast/kpatch","description":"kpatch - dynamic kernel patching","fork":true,"url":"https://api.github.com/repos/flaming-toast/kpatch","forks_url":"https://api.github.com/repos/flaming-toast/kpatch/forks","keys_url":"https://api.github.com/repos/flaming-toast/kpatch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flaming-toast/kpatch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flaming-toast/kpatch/teams","hooks_url":"https://api.github.com/repos/flaming-toast/kpatch/hooks","issue_events_url":"https://api.github.com/repos/flaming-toast/kpatch/issues/events{/number}","events_url":"https://api.github.com/repos/flaming-toast/kpatch/events","assignees_url":"https://api.github.com/repos/flaming-toast/kpatch/assignees{/user}","branches_url":"https://api.github.com/repos/flaming-toast/kpatch/branches{/branch}","tags_url":"https://api.github.com/repos/flaming-toast/kpatch/tags","blobs_url":"https://api.github.com/repos/flaming-toast/kpatch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flaming-toast/kpatch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flaming-toast/kpatch/git/refs{/sha}","trees_url":"https://api.github.com/repos/flaming-toast/kpatch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flaming-toast/kpatch/statuses/{sha}","languages_url":"https://api.github.com/repos/flaming-toast/kpatch/languages","stargazers_url":"https://api.github.com/repos/flaming-toast/kpatch/stargazers","contributors_url":"https://api.github.com/repos/flaming-toast/kpatch/contributors","subscribers_url":"https://api.github.com/repos/flaming-toast/kpatch/subscribers","subscription_url":"https://api.github.com/repos/flaming-toast/kpatch/subscription","commits_url":"https://api.github.com/repos/flaming-toast/kpatch/commits{/sha}","git_commits_url":"https://api.github.com/repos/flaming-toast/kpatch/git/commits{/sha}","comments_url":"https://api.github.com/repos/flaming-toast/kpatch/comments{/number}","issue_comment_url":"https://api.github.com/repos/flaming-toast/kpatch/issues/comments/{number}","contents_url":"https://api.github.com/repos/flaming-toast/kpatch/contents/{+path}","compare_url":"https://api.github.com/repos/flaming-toast/kpatch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flaming-toast/kpatch/merges","archive_url":"https://api.github.com/repos/flaming-toast/kpatch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flaming-toast/kpatch/downloads","issues_url":"https://api.github.com/repos/flaming-toast/kpatch/issues{/number}","pulls_url":"https://api.github.com/repos/flaming-toast/kpatch/pulls{/number}","milestones_url":"https://api.github.com/repos/flaming-toast/kpatch/milestones{/number}","notifications_url":"https://api.github.com/repos/flaming-toast/kpatch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flaming-toast/kpatch/labels{/name}","releases_url":"https://api.github.com/repos/flaming-toast/kpatch/releases{/id}","created_at":"2014-06-10T06:18:52Z","updated_at":"2014-07-04T02:22:48Z","pushed_at":"2014-08-14T19:14:14Z","git_url":"git://github.com/flaming-toast/kpatch.git","ssh_url":"git@github.com:flaming-toast/kpatch.git","clone_url":"https://github.com/flaming-toast/kpatch.git","svn_url":"https://github.com/flaming-toast/kpatch","homepage":null,"size":1121,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dynup:master","ref":"master","sha":"b16f85cad3cb906fa4e2a9953e2ba1c35bd9e69f","user":{"login":"dynup","id":6643594,"avatar_url":"https://avatars.githubusercontent.com/u/6643594?v=2","gravatar_id":null,"url":"https://api.github.com/users/dynup","html_url":"https://github.com/dynup","followers_url":"https://api.github.com/users/dynup/followers","following_url":"https://api.github.com/users/dynup/following{/other_user}","gists_url":"https://api.github.com/users/dynup/gists{/gist_id}","starred_url":"https://api.github.com/users/dynup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dynup/subscriptions","organizations_url":"https://api.github.com/users/dynup/orgs","repos_url":"https://api.github.com/users/dynup/repos","events_url":"https://api.github.com/users/dynup/events{/privacy}","received_events_url":"https://api.github.com/users/dynup/received_events","type":"Organization","site_admin":false},"repo":{"id":16743039,"name":"kpatch","full_name":"dynup/kpatch","owner":{"login":"dynup","id":6643594,"avatar_url":"https://avatars.githubusercontent.com/u/6643594?v=2","gravatar_id":null,"url":"https://api.github.com/users/dynup","html_url":"https://github.com/dynup","followers_url":"https://api.github.com/users/dynup/followers","following_url":"https://api.github.com/users/dynup/following{/other_user}","gists_url":"https://api.github.com/users/dynup/gists{/gist_id}","starred_url":"https://api.github.com/users/dynup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dynup/subscriptions","organizations_url":"https://api.github.com/users/dynup/orgs","repos_url":"https://api.github.com/users/dynup/repos","events_url":"https://api.github.com/users/dynup/events{/privacy}","received_events_url":"https://api.github.com/users/dynup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dynup/kpatch","description":"kpatch - dynamic kernel patching","fork":false,"url":"https://api.github.com/repos/dynup/kpatch","forks_url":"https://api.github.com/repos/dynup/kpatch/forks","keys_url":"https://api.github.com/repos/dynup/kpatch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dynup/kpatch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dynup/kpatch/teams","hooks_url":"https://api.github.com/repos/dynup/kpatch/hooks","issue_events_url":"https://api.github.com/repos/dynup/kpatch/issues/events{/number}","events_url":"https://api.github.com/repos/dynup/kpatch/events","assignees_url":"https://api.github.com/repos/dynup/kpatch/assignees{/user}","branches_url":"https://api.github.com/repos/dynup/kpatch/branches{/branch}","tags_url":"https://api.github.com/repos/dynup/kpatch/tags","blobs_url":"https://api.github.com/repos/dynup/kpatch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dynup/kpatch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dynup/kpatch/git/refs{/sha}","trees_url":"https://api.github.com/repos/dynup/kpatch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dynup/kpatch/statuses/{sha}","languages_url":"https://api.github.com/repos/dynup/kpatch/languages","stargazers_url":"https://api.github.com/repos/dynup/kpatch/stargazers","contributors_url":"https://api.github.com/repos/dynup/kpatch/contributors","subscribers_url":"https://api.github.com/repos/dynup/kpatch/subscribers","subscription_url":"https://api.github.com/repos/dynup/kpatch/subscription","commits_url":"https://api.github.com/repos/dynup/kpatch/commits{/sha}","git_commits_url":"https://api.github.com/repos/dynup/kpatch/git/commits{/sha}","comments_url":"https://api.github.com/repos/dynup/kpatch/comments{/number}","issue_comment_url":"https://api.github.com/repos/dynup/kpatch/issues/comments/{number}","contents_url":"https://api.github.com/repos/dynup/kpatch/contents/{+path}","compare_url":"https://api.github.com/repos/dynup/kpatch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dynup/kpatch/merges","archive_url":"https://api.github.com/repos/dynup/kpatch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dynup/kpatch/downloads","issues_url":"https://api.github.com/repos/dynup/kpatch/issues{/number}","pulls_url":"https://api.github.com/repos/dynup/kpatch/pulls{/number}","milestones_url":"https://api.github.com/repos/dynup/kpatch/milestones{/number}","notifications_url":"https://api.github.com/repos/dynup/kpatch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dynup/kpatch/labels{/name}","releases_url":"https://api.github.com/repos/dynup/kpatch/releases{/id}","created_at":"2014-02-11T19:47:52Z","updated_at":"2014-08-12T02:15:45Z","pushed_at":"2014-08-14T12:56:42Z","git_url":"git://github.com/dynup/kpatch.git","ssh_url":"git@github.com:dynup/kpatch.git","clone_url":"https://github.com/dynup/kpatch.git","svn_url":"https://github.com/dynup/kpatch","homepage":null,"size":5927,"stargazers_count":177,"watchers_count":177,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":37,"mirror_url":null,"open_issues_count":9,"forks":37,"open_issues":9,"watchers":177,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/360"},"html":{"href":"https://github.com/dynup/kpatch/pull/360"},"issue":{"href":"https://api.github.com/repos/dynup/kpatch/issues/360"},"comments":{"href":"https://api.github.com/repos/dynup/kpatch/issues/360/comments"},"review_comments":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/360/comments"},"review_comment":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dynup/kpatch/pulls/360/commits"},"statuses":{"href":"https://api.github.com/repos/dynup/kpatch/statuses/5e1a0cde2822e90408ea1ee19aabc98a7d38a073"}}}}