{"action":"created","comment":{"url":"https://api.github.com/repos/frida/frida-gum/pulls/comments/28554696","id":28554696,"diff_hunk":"@@ -0,0 +1,216 @@\n+/*\n+ * Copyright (C) 2008-2011 Ole André Vadla Ravnås <ole.andre.ravnas@tillitech.com>\n+ *\n+ * Licence: wxWindows Library Licence, Version 3.1\n+ */\n+\n+#include \"gummemory.h\"\n+#include \"gumqnx-priv.h\"\n+\n+#include <gio/gio.h>\n+#include <fcntl.h>\n+#include <sys/mman.h>\n+#include <sys/procfs.h>\n+#include <stdio.h>\n+\n+GumPageProtection\n+_gum_page_protection_from_posix (const gint flags)\n+{\n+  GumPageProtection prot = GUM_PAGE_NO_ACCESS;\n+\n+  if (flags & PROT_READ)\n+    prot |= GUM_PAGE_READ;\n+  if (flags & PROT_WRITE)\n+    prot |= GUM_PAGE_WRITE;\n+  if (flags & PROT_EXEC)\n+    prot |= GUM_PAGE_EXECUTE;\n+\n+  return prot;\n+}\n+\n+static gboolean\n+gum_memory_get_protection (GumAddress address,\n+                           gsize n,\n+                           gsize * size,\n+                           GumPageProtection * prot)\n+{\n+  gboolean success;\n+  gint fd, res;\n+  procfs_mapinfo * mapinfos;\n+  gint num_mapinfos;\n+  gpointer start, end;\n+  gint i = 0;\n+\n+  if (size == NULL || prot == NULL)\n+  {\n+    gsize ignored_size;\n+    GumPageProtection ignored_prot;\n+\n+    return gum_memory_get_protection (address, n,\n+        (size != NULL) ? size : &ignored_size,\n+        (prot != NULL) ? prot : &ignored_prot);\n+  }\n+\n+  if (n > 1)\n+  {\n+    GumAddress page_size, start_page, end_page, cur_page;\n+\n+    page_size = gum_query_page_size ();\n+\n+    start_page = address & ~(page_size - 1);\n+    end_page = (address + n - 1) & ~(page_size - 1);\n+\n+    success = gum_memory_get_protection (start_page, 1, NULL, prot);\n+    if (success)\n+    {\n+      *size = page_size - (address - start_page);\n+      for (cur_page = start_page + page_size;\n+          cur_page != end_page + page_size;\n+          cur_page += page_size)\n+      {\n+        GumPageProtection cur_prot;\n+\n+        if (gum_memory_get_protection (cur_page, 1, NULL, &cur_prot)\n+            && (cur_prot != GUM_PAGE_NO_ACCESS || *prot == GUM_PAGE_NO_ACCESS))\n+        {\n+          *size += page_size;\n+          *prot &= cur_prot;\n+        }\n+        else\n+        {\n+          break;\n+        }\n+      }\n+      *size = MIN (*size, n);\n+    }\n+\n+    return success;\n+  }\n+\n+","path":"gum/backend-qnx/gummemory-qnx.c","position":90,"original_position":90,"commit_id":"4d715173aae1207fc53bb0cc8a6ca9f17da6ecd5","original_commit_id":"4d715173aae1207fc53bb0cc8a6ca9f17da6ecd5","user":{"login":"oleavr","id":735197,"avatar_url":"https://avatars.githubusercontent.com/u/735197?v=3","gravatar_id":"","url":"https://api.github.com/users/oleavr","html_url":"https://github.com/oleavr","followers_url":"https://api.github.com/users/oleavr/followers","following_url":"https://api.github.com/users/oleavr/following{/other_user}","gists_url":"https://api.github.com/users/oleavr/gists{/gist_id}","starred_url":"https://api.github.com/users/oleavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleavr/subscriptions","organizations_url":"https://api.github.com/users/oleavr/orgs","repos_url":"https://api.github.com/users/oleavr/repos","events_url":"https://api.github.com/users/oleavr/events{/privacy}","received_events_url":"https://api.github.com/users/oleavr/received_events","type":"User","site_admin":false},"body":"Extra newline?","created_at":"2015-04-16T22:09:07Z","updated_at":"2015-04-16T22:09:07Z","html_url":"https://github.com/frida/frida-gum/pull/28#discussion_r28554696","pull_request_url":"https://api.github.com/repos/frida/frida-gum/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/comments/28554696"},"html":{"href":"https://github.com/frida/frida-gum/pull/28#discussion_r28554696"},"pull_request":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/frida/frida-gum/pulls/28","id":33475666,"html_url":"https://github.com/frida/frida-gum/pull/28","diff_url":"https://github.com/frida/frida-gum/pull/28.diff","patch_url":"https://github.com/frida/frida-gum/pull/28.patch","issue_url":"https://api.github.com/repos/frida/frida-gum/issues/28","number":28,"state":"open","locked":false,"title":"Implement QNX specific process and memory functions","user":{"login":"s1341","id":5682183,"avatar_url":"https://avatars.githubusercontent.com/u/5682183?v=3","gravatar_id":"","url":"https://api.github.com/users/s1341","html_url":"https://github.com/s1341","followers_url":"https://api.github.com/users/s1341/followers","following_url":"https://api.github.com/users/s1341/following{/other_user}","gists_url":"https://api.github.com/users/s1341/gists{/gist_id}","starred_url":"https://api.github.com/users/s1341/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1341/subscriptions","organizations_url":"https://api.github.com/users/s1341/orgs","repos_url":"https://api.github.com/users/s1341/repos","events_url":"https://api.github.com/users/s1341/events{/privacy}","received_events_url":"https://api.github.com/users/s1341/received_events","type":"User","site_admin":false},"body":"This includes:\r\n - gum_process_modify_thread\r\n - gum_process_enumerate_modules\r\n - gum_memory_read/write\r\n\r\nAll relevant tests are now passing.","created_at":"2015-04-16T17:50:38Z","updated_at":"2015-04-16T22:09:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6d3a30d901de690499edebd49863c111024f63af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/frida/frida-gum/pulls/28/commits","review_comments_url":"https://api.github.com/repos/frida/frida-gum/pulls/28/comments","review_comment_url":"https://api.github.com/repos/frida/frida-gum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/frida/frida-gum/issues/28/comments","statuses_url":"https://api.github.com/repos/frida/frida-gum/statuses/4d715173aae1207fc53bb0cc8a6ca9f17da6ecd5","head":{"label":"s1341:master","ref":"master","sha":"4d715173aae1207fc53bb0cc8a6ca9f17da6ecd5","user":{"login":"s1341","id":5682183,"avatar_url":"https://avatars.githubusercontent.com/u/5682183?v=3","gravatar_id":"","url":"https://api.github.com/users/s1341","html_url":"https://github.com/s1341","followers_url":"https://api.github.com/users/s1341/followers","following_url":"https://api.github.com/users/s1341/following{/other_user}","gists_url":"https://api.github.com/users/s1341/gists{/gist_id}","starred_url":"https://api.github.com/users/s1341/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1341/subscriptions","organizations_url":"https://api.github.com/users/s1341/orgs","repos_url":"https://api.github.com/users/s1341/repos","events_url":"https://api.github.com/users/s1341/events{/privacy}","received_events_url":"https://api.github.com/users/s1341/received_events","type":"User","site_admin":false},"repo":{"id":32918011,"name":"frida-gum","full_name":"s1341/frida-gum","owner":{"login":"s1341","id":5682183,"avatar_url":"https://avatars.githubusercontent.com/u/5682183?v=3","gravatar_id":"","url":"https://api.github.com/users/s1341","html_url":"https://github.com/s1341","followers_url":"https://api.github.com/users/s1341/followers","following_url":"https://api.github.com/users/s1341/following{/other_user}","gists_url":"https://api.github.com/users/s1341/gists{/gist_id}","starred_url":"https://api.github.com/users/s1341/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1341/subscriptions","organizations_url":"https://api.github.com/users/s1341/orgs","repos_url":"https://api.github.com/users/s1341/repos","events_url":"https://api.github.com/users/s1341/events{/privacy}","received_events_url":"https://api.github.com/users/s1341/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/s1341/frida-gum","description":"Low-level code instrumentation library used by frida-core","fork":true,"url":"https://api.github.com/repos/s1341/frida-gum","forks_url":"https://api.github.com/repos/s1341/frida-gum/forks","keys_url":"https://api.github.com/repos/s1341/frida-gum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s1341/frida-gum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s1341/frida-gum/teams","hooks_url":"https://api.github.com/repos/s1341/frida-gum/hooks","issue_events_url":"https://api.github.com/repos/s1341/frida-gum/issues/events{/number}","events_url":"https://api.github.com/repos/s1341/frida-gum/events","assignees_url":"https://api.github.com/repos/s1341/frida-gum/assignees{/user}","branches_url":"https://api.github.com/repos/s1341/frida-gum/branches{/branch}","tags_url":"https://api.github.com/repos/s1341/frida-gum/tags","blobs_url":"https://api.github.com/repos/s1341/frida-gum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s1341/frida-gum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s1341/frida-gum/git/refs{/sha}","trees_url":"https://api.github.com/repos/s1341/frida-gum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s1341/frida-gum/statuses/{sha}","languages_url":"https://api.github.com/repos/s1341/frida-gum/languages","stargazers_url":"https://api.github.com/repos/s1341/frida-gum/stargazers","contributors_url":"https://api.github.com/repos/s1341/frida-gum/contributors","subscribers_url":"https://api.github.com/repos/s1341/frida-gum/subscribers","subscription_url":"https://api.github.com/repos/s1341/frida-gum/subscription","commits_url":"https://api.github.com/repos/s1341/frida-gum/commits{/sha}","git_commits_url":"https://api.github.com/repos/s1341/frida-gum/git/commits{/sha}","comments_url":"https://api.github.com/repos/s1341/frida-gum/comments{/number}","issue_comment_url":"https://api.github.com/repos/s1341/frida-gum/issues/comments{/number}","contents_url":"https://api.github.com/repos/s1341/frida-gum/contents/{+path}","compare_url":"https://api.github.com/repos/s1341/frida-gum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s1341/frida-gum/merges","archive_url":"https://api.github.com/repos/s1341/frida-gum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s1341/frida-gum/downloads","issues_url":"https://api.github.com/repos/s1341/frida-gum/issues{/number}","pulls_url":"https://api.github.com/repos/s1341/frida-gum/pulls{/number}","milestones_url":"https://api.github.com/repos/s1341/frida-gum/milestones{/number}","notifications_url":"https://api.github.com/repos/s1341/frida-gum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s1341/frida-gum/labels{/name}","releases_url":"https://api.github.com/repos/s1341/frida-gum/releases{/id}","created_at":"2015-03-26T09:23:31Z","updated_at":"2015-04-16T17:48:38Z","pushed_at":"2015-04-16T17:48:38Z","git_url":"git://github.com/s1341/frida-gum.git","ssh_url":"git@github.com:s1341/frida-gum.git","clone_url":"https://github.com/s1341/frida-gum.git","svn_url":"https://github.com/s1341/frida-gum","homepage":"","size":6968,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"frida:master","ref":"master","sha":"ff2a12e39724fa495ba6e17b31973dd31f64eee3","user":{"login":"frida","id":4073090,"avatar_url":"https://avatars.githubusercontent.com/u/4073090?v=3","gravatar_id":"","url":"https://api.github.com/users/frida","html_url":"https://github.com/frida","followers_url":"https://api.github.com/users/frida/followers","following_url":"https://api.github.com/users/frida/following{/other_user}","gists_url":"https://api.github.com/users/frida/gists{/gist_id}","starred_url":"https://api.github.com/users/frida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frida/subscriptions","organizations_url":"https://api.github.com/users/frida/orgs","repos_url":"https://api.github.com/users/frida/repos","events_url":"https://api.github.com/users/frida/events{/privacy}","received_events_url":"https://api.github.com/users/frida/received_events","type":"Organization","site_admin":false},"repo":{"id":9340574,"name":"frida-gum","full_name":"frida/frida-gum","owner":{"login":"frida","id":4073090,"avatar_url":"https://avatars.githubusercontent.com/u/4073090?v=3","gravatar_id":"","url":"https://api.github.com/users/frida","html_url":"https://github.com/frida","followers_url":"https://api.github.com/users/frida/followers","following_url":"https://api.github.com/users/frida/following{/other_user}","gists_url":"https://api.github.com/users/frida/gists{/gist_id}","starred_url":"https://api.github.com/users/frida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frida/subscriptions","organizations_url":"https://api.github.com/users/frida/orgs","repos_url":"https://api.github.com/users/frida/repos","events_url":"https://api.github.com/users/frida/events{/privacy}","received_events_url":"https://api.github.com/users/frida/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/frida/frida-gum","description":"Low-level code instrumentation library used by frida-core","fork":false,"url":"https://api.github.com/repos/frida/frida-gum","forks_url":"https://api.github.com/repos/frida/frida-gum/forks","keys_url":"https://api.github.com/repos/frida/frida-gum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frida/frida-gum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frida/frida-gum/teams","hooks_url":"https://api.github.com/repos/frida/frida-gum/hooks","issue_events_url":"https://api.github.com/repos/frida/frida-gum/issues/events{/number}","events_url":"https://api.github.com/repos/frida/frida-gum/events","assignees_url":"https://api.github.com/repos/frida/frida-gum/assignees{/user}","branches_url":"https://api.github.com/repos/frida/frida-gum/branches{/branch}","tags_url":"https://api.github.com/repos/frida/frida-gum/tags","blobs_url":"https://api.github.com/repos/frida/frida-gum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frida/frida-gum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frida/frida-gum/git/refs{/sha}","trees_url":"https://api.github.com/repos/frida/frida-gum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frida/frida-gum/statuses/{sha}","languages_url":"https://api.github.com/repos/frida/frida-gum/languages","stargazers_url":"https://api.github.com/repos/frida/frida-gum/stargazers","contributors_url":"https://api.github.com/repos/frida/frida-gum/contributors","subscribers_url":"https://api.github.com/repos/frida/frida-gum/subscribers","subscription_url":"https://api.github.com/repos/frida/frida-gum/subscription","commits_url":"https://api.github.com/repos/frida/frida-gum/commits{/sha}","git_commits_url":"https://api.github.com/repos/frida/frida-gum/git/commits{/sha}","comments_url":"https://api.github.com/repos/frida/frida-gum/comments{/number}","issue_comment_url":"https://api.github.com/repos/frida/frida-gum/issues/comments{/number}","contents_url":"https://api.github.com/repos/frida/frida-gum/contents/{+path}","compare_url":"https://api.github.com/repos/frida/frida-gum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frida/frida-gum/merges","archive_url":"https://api.github.com/repos/frida/frida-gum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frida/frida-gum/downloads","issues_url":"https://api.github.com/repos/frida/frida-gum/issues{/number}","pulls_url":"https://api.github.com/repos/frida/frida-gum/pulls{/number}","milestones_url":"https://api.github.com/repos/frida/frida-gum/milestones{/number}","notifications_url":"https://api.github.com/repos/frida/frida-gum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frida/frida-gum/labels{/name}","releases_url":"https://api.github.com/repos/frida/frida-gum/releases{/id}","created_at":"2013-04-10T07:25:56Z","updated_at":"2015-04-16T09:46:00Z","pushed_at":"2015-04-16T17:50:38Z","git_url":"git://github.com/frida/frida-gum.git","ssh_url":"git@github.com:frida/frida-gum.git","clone_url":"https://github.com/frida/frida-gum.git","svn_url":"https://github.com/frida/frida-gum","homepage":"","size":8753,"stargazers_count":40,"watchers_count":40,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":6,"forks":11,"open_issues":6,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/28"},"html":{"href":"https://github.com/frida/frida-gum/pull/28"},"issue":{"href":"https://api.github.com/repos/frida/frida-gum/issues/28"},"comments":{"href":"https://api.github.com/repos/frida/frida-gum/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/frida/frida-gum/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/frida/frida-gum/statuses/4d715173aae1207fc53bb0cc8a6ca9f17da6ecd5"}}}}