aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-14 09:42:39 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-14 14:04:41 +0200
commitbdf3cf726780d1cfcaf3f5ebd08572d2948b565b (patch)
treecf1e5d02001a7290c182f5001b5588959a3dd163 /pkg
parent872ebc286c4aa445b597066672a6082a9e724b0d (diff)
executor: fix use of SYZ_SANDBOX_ANDROID define
"#if not" does not seem to be a thing in C: $ cpp -undef -fdirectives-only -dDI -E -P -DSYZ_REPEAT -DSYZ_USE_TMP_DIR executor/common_linux.h 1>/dev/null executor/common_linux.h:3776:9: error: missing binary operator before token "SYZ_SANDBOX_ANDROID" 3776 | #if not SYZ_SANDBOX_ANDROID | ^~~~~~~~~~~~~~~~~~~ executor/common_linux.h:3801:9: error: missing binary operator before token "SYZ_SANDBOX_ANDROID" 3801 | #if not SYZ_SANDBOX_ANDROID | ^~~~~~~~~~~~~~~~~~~ executor/common_linux.h:3837:9: error: missing binary operator before token "SYZ_SANDBOX_ANDROID" 3837 | #if not SYZ_SANDBOX_ANDROID | ^~~~~~~~~~~~~~~~~~~ executor/common_linux.h:3868:9: error: missing binary operator before token "SYZ_SANDBOX_ANDROID" 3868 | #if not SYZ_SANDBOX_ANDROID | ^~~~~~~~~~~~~~~~~~~ Currently parts under "#if not SYZ_SANDBOX_ANDROID" are always stripped from reproducers under all sandboxes. Use the standard !SYZ_SANDBOX_ANDROID. We also need SYZ_EXECUTOR part because sandbox is not statically known when we are building syz-executor. And we also need to remove the use of flag_sandbox_android for C reproducers because for these sandbox is statically known and we don't have flag_sandbox_*.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/csource/generated.go26
1 files changed, 18 insertions, 8 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go
index 7fb86e592..2da36802c 100644
--- a/pkg/csource/generated.go
+++ b/pkg/csource/generated.go
@@ -8479,12 +8479,13 @@ static void remove_dir(const char* dir)
int iter = 0;
DIR* dp = 0;
retry:
-#if not SYZ_SANDBOX_ANDROID
- if (!flag_sandbox_android) {
+#if SYZ_EXECUTOR || !SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR
+ if (!flag_sandbox_android)
+#endif
while (umount2(dir, MNT_DETACH) == 0) {
debug("umount(%s)\n", dir);
}
- }
#endif
dp = opendir(dir);
if (dp == NULL) {
@@ -8499,12 +8500,13 @@ retry:
continue;
char filename[FILENAME_MAX];
snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name);
-#if not SYZ_SANDBOX_ANDROID
- if (!flag_sandbox_android) {
+#if SYZ_EXECUTOR || !SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR
+ if (!flag_sandbox_android)
+#endif
while (umount2(filename, MNT_DETACH) == 0) {
debug("umount(%s)\n", filename);
}
- }
#endif
struct stat st;
if (lstat(filename, &st))
@@ -8534,13 +8536,17 @@ retry:
}
if (errno != EBUSY || i > 100)
exitf("unlink(%s) failed", filename);
-#if not SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR || !SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR
if (!flag_sandbox_android) {
+#endif
debug("umount(%s)\n", filename);
if (umount2(filename, MNT_DETACH))
exitf("umount(%s) failed", filename);
+#if SYZ_EXECUTOR
}
#endif
+#endif
}
}
closedir(dp);
@@ -8564,13 +8570,17 @@ retry:
break;
}
if (errno == EBUSY) {
-#if not SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR || !SYZ_SANDBOX_ANDROID
+#if SYZ_EXECUTOR
if (!flag_sandbox_android) {
+#endif
debug("umount(%s)\n", dir);
if (umount2(dir, MNT_DETACH))
exitf("umount(%s) failed", dir);
+#if SYZ_EXECUTOR
}
#endif
+#endif
continue;
}
if (errno == ENOTEMPTY) {