diff options
| author | Zach Riggle <riggle@google.com> | 2018-10-11 15:52:42 -0500 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-10-12 16:39:26 +0200 |
| commit | 751b7baf9499cf287eaaa58e0978e377fa651015 (patch) | |
| tree | e845de032c4a9a968581fb8f531f57baea55f35c /executor/common_linux.h | |
| parent | 6e32776909bd0bcf64993f17123d86dd269922d7 (diff) | |
Android: Fix sandbox implementation
My test harness for this code performed some steps that are not
performed when syz-executor is invoked directy.
Specifcally, we need to operate from a directory under /data/data,
and have the correct UID/GID set as the owner of the directory.
My test harness now correctly sets these, all sandbox operations
succeed, and loop() is invoked.
Diffstat (limited to 'executor/common_linux.h')
| -rw-r--r-- | executor/common_linux.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index 09b92cfad..2e6b33bcb 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -1867,7 +1867,7 @@ static void syz_setfilecon(const char* path, const char* context) if (setxattr(path, SELINUX_XATTR_NAME, context, strlen(context) + 1, 0) != 0) fail("setfilecon: setxattr failed"); - if (syz_getfilecon(path, new_context, sizeof(new_context)) != 0) + if (syz_getfilecon(path, new_context, sizeof(new_context)) <= 0) fail("setfilecon: getfilecon failed"); if (strcmp(context, new_context) != 0) @@ -1880,6 +1880,9 @@ static int do_sandbox_android_untrusted_app(void) setup_common(); sandbox_common(); + if (chown(".", UNTRUSTED_APP_UID, UNTRUSTED_APP_UID) != 0) + fail("chmod failed"); + if (setgroups(UNTRUSTED_APP_NUM_GROUPS, UNTRUSTED_APP_GROUPS) != 0) fail("setgroups failed"); |
