{"action":"opened","number":174,"pull_request":{"url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174","id":27083697,"html_url":"https://github.com/OP-TEE/optee_os/pull/174","diff_url":"https://github.com/OP-TEE/optee_os/pull/174.diff","patch_url":"https://github.com/OP-TEE/optee_os/pull/174.patch","issue_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/174","number":174,"state":"open","locked":false,"title":"adjust Persistent Object Sharing Rules implementation based GP internel ...","user":{"login":"xlyu","id":6879113,"avatar_url":"https://avatars.githubusercontent.com/u/6879113?v=3","gravatar_id":"","url":"https://api.github.com/users/xlyu","html_url":"https://github.com/xlyu","followers_url":"https://api.github.com/users/xlyu/followers","following_url":"https://api.github.com/users/xlyu/following{/other_user}","gists_url":"https://api.github.com/users/xlyu/gists{/gist_id}","starred_url":"https://api.github.com/users/xlyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xlyu/subscriptions","organizations_url":"https://api.github.com/users/xlyu/orgs","repos_url":"https://api.github.com/users/xlyu/repos","events_url":"https://api.github.com/users/xlyu/events{/privacy}","received_events_url":"https://api.github.com/users/xlyu/received_events","type":"User","site_admin":false},"body":"adjust Persistent Object Sharing Rules implementation based GP internel core API v1.1\r\nI saw Persistent Object Sharing Rules check done in tee-pobj.c, function tee_pobj_check_access. However the code is obviously wrong.\r\nThe origin code done like below, it will always return TEE_ERROR_ACCESS_CONFLICT;\r\nstatic TEE_Result tee_pobj_check_access(uint32_t oflags, uint32_t nflags)\r\n{\r\n\t/* meta is exclusive */\r\n\tif (oflags | TEE_DATA_FLAG_ACCESS_WRITE_META ||\r\n\t    nflags | TEE_DATA_FLAG_ACCESS_WRITE_META)\r\n\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\r\n\tif (oflags | TEE_DATA_FLAG_ACCESS_READ &&\r\n\t    !((nflags | TEE_DATA_FLAG_SHARE_READ) &&\r\n\t      oflags | TEE_DATA_FLAG_SHARE_READ))\r\n\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\r\n\tif (oflags | TEE_DATA_FLAG_ACCESS_WRITE &&\r\n\t    !((nflags | TEE_DATA_FLAG_SHARE_WRITE) &&\r\n\t      oflags | TEE_DATA_FLAG_SHARE_WRITE))\r\n\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\r\n\treturn TEE_SUCCESS;\r\n}\r\nI change the code based Global Platform's internal API document, and it works well:\r\nstatic TEE_Result tee_pobj_check_access(uint32_t oflags, uint32_t nflags)\r\n{\r\n\t/* meta is exclusive */\r\n\tif (oflags & TEE_DATA_FLAG_ACCESS_WRITE_META)\r\n\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\r\n\t/*second open/create need set flags to TEE_DATA_FLAG_SHARE_READ */\r\n\tif ((oflags &TEE_DATA_FLAG_ACCESS_READ) ||\r\n\t\t(oflags & TEE_DATA_FLAG_SHARE_READ) &&\r\n\t\t!(nflags & TEE_DATA_FLAG_SHARE_READ))\r\n\t\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\r\n\t/*second open/create need set flags to TEE_DATA_FLAG_SHARE_WRITE */\r\n\tif ((oflags & TEE_DATA_FLAG_ACCESS_WRITE) ||\r\n\t\t(oflags & TEE_DATA_FLAG_SHARE_WRITE) &&\r\n\t\t!(nflags & TEE_DATA_FLAG_SHARE_WRITE ))\r\n\t\t\treturn TEE_ERROR_ACCESS_CONFLICT;\r\n\t\r\n\treturn TEE_SUCCESS;\r\n}\r\n","created_at":"2015-01-09T07:16:14Z","updated_at":"2015-01-09T07:16:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174/commits","review_comments_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174/comments","review_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/{number}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/174/comments","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/3d4b2628b6e6135201b755477cfac3e7af118673","head":{"label":"secureTV:master","ref":"master","sha":"3d4b2628b6e6135201b755477cfac3e7af118673","user":{"login":"secureTV","id":6879180,"avatar_url":"https://avatars.githubusercontent.com/u/6879180?v=3","gravatar_id":"","url":"https://api.github.com/users/secureTV","html_url":"https://github.com/secureTV","followers_url":"https://api.github.com/users/secureTV/followers","following_url":"https://api.github.com/users/secureTV/following{/other_user}","gists_url":"https://api.github.com/users/secureTV/gists{/gist_id}","starred_url":"https://api.github.com/users/secureTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/secureTV/subscriptions","organizations_url":"https://api.github.com/users/secureTV/orgs","repos_url":"https://api.github.com/users/secureTV/repos","events_url":"https://api.github.com/users/secureTV/events{/privacy}","received_events_url":"https://api.github.com/users/secureTV/received_events","type":"Organization","site_admin":false},"repo":{"id":23726493,"name":"optee_os","full_name":"secureTV/optee_os","owner":{"login":"secureTV","id":6879180,"avatar_url":"https://avatars.githubusercontent.com/u/6879180?v=3","gravatar_id":"","url":"https://api.github.com/users/secureTV","html_url":"https://github.com/secureTV","followers_url":"https://api.github.com/users/secureTV/followers","following_url":"https://api.github.com/users/secureTV/following{/other_user}","gists_url":"https://api.github.com/users/secureTV/gists{/gist_id}","starred_url":"https://api.github.com/users/secureTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/secureTV/subscriptions","organizations_url":"https://api.github.com/users/secureTV/orgs","repos_url":"https://api.github.com/users/secureTV/repos","events_url":"https://api.github.com/users/secureTV/events{/privacy}","received_events_url":"https://api.github.com/users/secureTV/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/secureTV/optee_os","description":"Trusted side of the TEE","fork":true,"url":"https://api.github.com/repos/secureTV/optee_os","forks_url":"https://api.github.com/repos/secureTV/optee_os/forks","keys_url":"https://api.github.com/repos/secureTV/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/secureTV/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/secureTV/optee_os/teams","hooks_url":"https://api.github.com/repos/secureTV/optee_os/hooks","issue_events_url":"https://api.github.com/repos/secureTV/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/secureTV/optee_os/events","assignees_url":"https://api.github.com/repos/secureTV/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/secureTV/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/secureTV/optee_os/tags","blobs_url":"https://api.github.com/repos/secureTV/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/secureTV/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/secureTV/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/secureTV/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/secureTV/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/secureTV/optee_os/languages","stargazers_url":"https://api.github.com/repos/secureTV/optee_os/stargazers","contributors_url":"https://api.github.com/repos/secureTV/optee_os/contributors","subscribers_url":"https://api.github.com/repos/secureTV/optee_os/subscribers","subscription_url":"https://api.github.com/repos/secureTV/optee_os/subscription","commits_url":"https://api.github.com/repos/secureTV/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/secureTV/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/secureTV/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/secureTV/optee_os/issues/comments/{number}","contents_url":"https://api.github.com/repos/secureTV/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/secureTV/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/secureTV/optee_os/merges","archive_url":"https://api.github.com/repos/secureTV/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/secureTV/optee_os/downloads","issues_url":"https://api.github.com/repos/secureTV/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/secureTV/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/secureTV/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/secureTV/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/secureTV/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/secureTV/optee_os/releases{/id}","created_at":"2014-09-06T04:20:02Z","updated_at":"2015-01-09T07:11:56Z","pushed_at":"2015-01-09T07:11:53Z","git_url":"git://github.com/secureTV/optee_os.git","ssh_url":"git@github.com:secureTV/optee_os.git","clone_url":"https://github.com/secureTV/optee_os.git","svn_url":"https://github.com/secureTV/optee_os","homepage":null,"size":1027,"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":"OP-TEE:master","ref":"master","sha":"80439f3865207ea998d64fb66c80bd04188c8722","user":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars.githubusercontent.com/u/7488961?v=3","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"repo":{"id":20193261,"name":"optee_os","full_name":"OP-TEE/optee_os","owner":{"login":"OP-TEE","id":7488961,"avatar_url":"https://avatars.githubusercontent.com/u/7488961?v=3","gravatar_id":"","url":"https://api.github.com/users/OP-TEE","html_url":"https://github.com/OP-TEE","followers_url":"https://api.github.com/users/OP-TEE/followers","following_url":"https://api.github.com/users/OP-TEE/following{/other_user}","gists_url":"https://api.github.com/users/OP-TEE/gists{/gist_id}","starred_url":"https://api.github.com/users/OP-TEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OP-TEE/subscriptions","organizations_url":"https://api.github.com/users/OP-TEE/orgs","repos_url":"https://api.github.com/users/OP-TEE/repos","events_url":"https://api.github.com/users/OP-TEE/events{/privacy}","received_events_url":"https://api.github.com/users/OP-TEE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OP-TEE/optee_os","description":"Trusted side of the TEE","fork":false,"url":"https://api.github.com/repos/OP-TEE/optee_os","forks_url":"https://api.github.com/repos/OP-TEE/optee_os/forks","keys_url":"https://api.github.com/repos/OP-TEE/optee_os/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OP-TEE/optee_os/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OP-TEE/optee_os/teams","hooks_url":"https://api.github.com/repos/OP-TEE/optee_os/hooks","issue_events_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/events{/number}","events_url":"https://api.github.com/repos/OP-TEE/optee_os/events","assignees_url":"https://api.github.com/repos/OP-TEE/optee_os/assignees{/user}","branches_url":"https://api.github.com/repos/OP-TEE/optee_os/branches{/branch}","tags_url":"https://api.github.com/repos/OP-TEE/optee_os/tags","blobs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OP-TEE/optee_os/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OP-TEE/optee_os/git/refs{/sha}","trees_url":"https://api.github.com/repos/OP-TEE/optee_os/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OP-TEE/optee_os/statuses/{sha}","languages_url":"https://api.github.com/repos/OP-TEE/optee_os/languages","stargazers_url":"https://api.github.com/repos/OP-TEE/optee_os/stargazers","contributors_url":"https://api.github.com/repos/OP-TEE/optee_os/contributors","subscribers_url":"https://api.github.com/repos/OP-TEE/optee_os/subscribers","subscription_url":"https://api.github.com/repos/OP-TEE/optee_os/subscription","commits_url":"https://api.github.com/repos/OP-TEE/optee_os/commits{/sha}","git_commits_url":"https://api.github.com/repos/OP-TEE/optee_os/git/commits{/sha}","comments_url":"https://api.github.com/repos/OP-TEE/optee_os/comments{/number}","issue_comment_url":"https://api.github.com/repos/OP-TEE/optee_os/issues/comments/{number}","contents_url":"https://api.github.com/repos/OP-TEE/optee_os/contents/{+path}","compare_url":"https://api.github.com/repos/OP-TEE/optee_os/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OP-TEE/optee_os/merges","archive_url":"https://api.github.com/repos/OP-TEE/optee_os/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OP-TEE/optee_os/downloads","issues_url":"https://api.github.com/repos/OP-TEE/optee_os/issues{/number}","pulls_url":"https://api.github.com/repos/OP-TEE/optee_os/pulls{/number}","milestones_url":"https://api.github.com/repos/OP-TEE/optee_os/milestones{/number}","notifications_url":"https://api.github.com/repos/OP-TEE/optee_os/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OP-TEE/optee_os/labels{/name}","releases_url":"https://api.github.com/repos/OP-TEE/optee_os/releases{/id}","created_at":"2014-05-26T17:18:57Z","updated_at":"2015-01-08T09:22:03Z","pushed_at":"2015-01-07T08:01:33Z","git_url":"git://github.com/OP-TEE/optee_os.git","ssh_url":"git@github.com:OP-TEE/optee_os.git","clone_url":"https://github.com/OP-TEE/optee_os.git","svn_url":"https://github.com/OP-TEE/optee_os","homepage":null,"size":6517,"stargazers_count":26,"watchers_count":26,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":13,"forks":29,"open_issues":13,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174"},"html":{"href":"https://github.com/OP-TEE/optee_os/pull/174"},"issue":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/174"},"comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/OP-TEE/optee_os/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/OP-TEE/optee_os/statuses/3d4b2628b6e6135201b755477cfac3e7af118673"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":13,"deletions":12,"changed_files":1}}