summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-10-31 16:28:28 +1300
committerAndrew Bartlett <abartlet@samba.org>2019-12-10 07:50:28 +0000
commit7b265830ad6796dbbe721f7abfd62a19c2185b65 (patch)
tree86dea325c0e73ef5765b6768a1a8bfade35602d2 /buildtools
parentef5d79e24ba8aec226419e594de0cf91c24d7fc4 (diff)
downloadsamba-7b265830ad6796dbbe721f7abfd62a19c2185b65.tar.gz
lib/fuzzing: add fuzz_ndr_X
This NDR fuzzer links with each "interface" in the IDL files to create avsingle binary. This tries to matches what the fuzzing engines desire. It started as a copy of ndrdump but very little of that remains in place. The fancy build rules try to avoid needing a lof of boilerplate in the wscript_build files and ensure new fuzzers are generated and run when new IDL is added automatically. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_pidl.py12
-rw-r--r--buildtools/wafsamba/wscript2
2 files changed, 11 insertions, 3 deletions
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index a34c871d183..8785563e5e6 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -108,14 +108,22 @@ def SAMBA_PIDL(bld, pname, source,
t.more_includes = '#' + bld.path.path_from(bld.srcnode)
Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
-
def SAMBA_PIDL_LIST(bld, name, source,
options='',
output_dir='.',
- generate_tables=True):
+ generate_tables=True,
+ generate_fuzzers=True):
'''A wrapper for building a set of IDL files'''
for p in TO_LIST(source):
bld.SAMBA_PIDL(name, p, options=options, output_dir=output_dir, generate_tables=generate_tables)
+
+ # Some IDL files don't exactly match between name and
+ # "interface" so we need a way to skip those, while other IDL
+ # files have the table generation skipped entirely, on which
+ # the fuzzers rely
+ if generate_tables and generate_fuzzers:
+ interface = p[0:-4] # strip off the .idl suffix
+ bld.SAMBA_NDR_FUZZ(interface)
Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index b9f2f495617..764e357cc87 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -605,7 +605,7 @@ struct foo bar = { .y = 'X', .x = 1 };
conf.env.enable_libfuzzer = Options.options.enable_libfuzzer
if conf.env.enable_libfuzzer:
- conf.DEFINE('ENABLE_LIBFUZZER', 1)
+ conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1)
conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS
conf.load('clang_compilation_database')