diff options
| author | Marco Elver <elver@google.com> | 2019-10-22 13:33:27 +0200 |
|---|---|---|
| committer | Marco Elver <marco.elver@gmail.com> | 2019-10-22 17:48:18 +0200 |
| commit | 5681358a2a14647b64cdb97e0d19d3614986d31c (patch) | |
| tree | 4f3087af9b69ea16b8ac11cd312d5e9a517da43a /pkg/csource/generated.go | |
| parent | 4ee855e7ecf0b85cd68ccef760bd9ffb4e4910a5 (diff) | |
syz-fuzzer, executor: Add support for blacklisting data race frames
This adds support to add frames that have already been in data races, to
the KCSAN report blacklist.
Diffstat (limited to 'pkg/csource/generated.go')
| -rw-r--r-- | pkg/csource/generated.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index a8d5d3114..2b91d15d2 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -5331,11 +5331,35 @@ static void setup_binfmt_misc() #endif #if SYZ_EXECUTOR || SYZ_ENABLE_KCSAN +#define KCSAN_DEBUGFS_FILE "/sys/kernel/debug/kcsan" + static void setup_kcsan() { - if (!write_file("/sys/kernel/debug/kcsan", "on")) + if (!write_file(KCSAN_DEBUGFS_FILE, "on")) fail("failed to enable KCSAN"); } + +#if SYZ_EXECUTOR +static void setup_kcsan_filterlist(char** frames, int nframes, bool blacklist) +{ + int fd = open(KCSAN_DEBUGFS_FILE, O_WRONLY); + if (fd == -1) + fail("failed to open(\"%s\")", KCSAN_DEBUGFS_FILE); + + const char* const filtertype = blacklist ? "blacklist" : "whitelist"; + printf("adding functions to KCSAN %s: ", filtertype); + dprintf(fd, "%s\n", filtertype); + for (int i = 0; i < nframes; ++i) { + printf("'%s' ", frames[i]); + dprintf(fd, "!%s\n", frames[i]); + } + printf("\n"); + + close(fd); +} + +#define SYZ_HAVE_KCSAN 1 +#endif #endif #elif GOOS_test |
