1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib/fuzzing: Link only the required NDR_ subsystems into ndr_fuzz_X binaries

This reduces the binary size and shows that we are linked against the correct
ndr_table_ global variable.  This might help the fuzzing engine know there
is not much more of the binary to find if unreachable code is not included.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2019-11-29 12:07:34 +13:00
parent 3ca76f5907
commit 6f7a9e8788
2 changed files with 8 additions and 3 deletions

View File

@ -123,7 +123,7 @@ def SAMBA_PIDL_LIST(bld, name, source,
# the fuzzers rely
if generate_tables and generate_fuzzers:
interface = p[0:-4] # strip off the .idl suffix
bld.SAMBA_NDR_FUZZ(interface)
bld.SAMBA_NDR_FUZZ(interface, auto_deps=True)
Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST

View File

@ -43,7 +43,7 @@ bld.SAMBA_BINARY('fuzz_ldb_parse_tree',
deps='fuzzing ldb',
fuzzer=True)
def SAMBA_NDR_FUZZ(bld, interface):
def SAMBA_NDR_FUZZ(bld, interface, auto_deps=False):
name = "fuzz_ndr_%s" % (interface.lower())
fuzz_dir = os.path.join(bld.env.srcdir, 'lib/fuzzing')
fuzz_reldir = os.path.relpath(fuzz_dir, bld.path.abspath())
@ -59,9 +59,14 @@ def SAMBA_NDR_FUZZ(bld, interface):
target=fuzz_named_src,
rule='cp ${SRC} ${TGT}')
if auto_deps:
deps = "talloc ndr NDR_%s" % interface.upper()
else:
deps = "ndr-table NDR_DCERPC"
bld.SAMBA_BINARY(name, source=fuzz_named_src,
cflags = "-D FUZZ_PIPE_TABLE=ndr_table_%s" % interface,
deps = "ndr-table NDR_DCERPC",
deps = deps,
install=False,
fuzzer=True)