mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 21:20:00 -04:00
Add option to always build fuzz binaries
Currently the fuzzer binaries are only built when someone requests a fuzzer. This might cause us to inadvertently break fuzzing when changing function signatures. It also deviates with the behaviour we had with autotools, where the fuzz binaries were built with make test. This commit splits the -Dfuzzing option into two: fuzzing, and fuzzing-backend. The fuzzing option controls whether the fuzzing binaries are built. The fuzzing-backend option controls which backend to use, and defaults to none. If the value none is used the binaries are built, but no backend is used or guaranteed, which means that the binaries might be non-functional.
This commit is contained in:
parent
024216a4d2
commit
3bd34dd30c
3 changed files with 23 additions and 12 deletions
|
|
@ -9,7 +9,7 @@
|
|||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
if fuzz_opt == 'none'
|
||||
if fuzz_opt.enabled()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
|
|
|
|||
23
meson.build
23
meson.build
|
|
@ -57,6 +57,7 @@ doc_opt = get_option('doc')
|
|||
doh_opt = get_option('doh')
|
||||
fips_opt = get_option('fips')
|
||||
fuzz_opt = get_option('fuzzing')
|
||||
fuzz_backend_opt = get_option('fuzzing-backend')
|
||||
geoip_opt = get_option('geoip')
|
||||
gssapi_opt = get_option('gssapi')
|
||||
idn_opt = get_option('idn')
|
||||
|
|
@ -406,17 +407,19 @@ endif
|
|||
config.set_quoted('FUZZDIR', meson.project_source_root() / 'fuzz')
|
||||
|
||||
fuzz_link_args = []
|
||||
if fuzz_opt != 'none'
|
||||
if get_option('b_lundef') != false
|
||||
warning('fuzzing will fail to build properly without -Db_lundef=false')
|
||||
endif
|
||||
if fuzz_opt.enabled()
|
||||
if fuzz_backed_opt != 'none'
|
||||
if get_option('b_lundef') != false
|
||||
warning('fuzzing will fail to build properly without -Db_lundef=false')
|
||||
endif
|
||||
|
||||
if fuzz_opt == 'afl'
|
||||
elif fuzz_opt == 'libfuzzer'
|
||||
config.set('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1)
|
||||
fuzz_link_args += '-fsanitize=fuzzer,address,undefined'
|
||||
add_project_link_arguments('-fsanitize=address,undefined', language: 'c')
|
||||
add_project_arguments('-fsanitize=fuzzer-no-link,address,undefined', language: 'c')
|
||||
if fuzz_opt == 'afl'
|
||||
elif fuzz_opt == 'libfuzzer'
|
||||
config.set('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1)
|
||||
fuzz_link_args += '-fsanitize=fuzzer,address,undefined'
|
||||
add_project_link_arguments('-fsanitize=address,undefined', language: 'c')
|
||||
add_project_arguments('-fsanitize=fuzzer-no-link,address,undefined', language: 'c')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -169,9 +169,17 @@ option(
|
|||
|
||||
option(
|
||||
'fuzzing',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build fuzzing binaries',
|
||||
)
|
||||
|
||||
option(
|
||||
'fuzzing-backend',
|
||||
type: 'combo',
|
||||
choices: ['none', 'afl', 'libfuzzer', 'oss-fuzz'],
|
||||
description: 'Enable fuzzing',
|
||||
value: 'none',
|
||||
description: 'Fuzzing backend (backend none with -Dfuzzing=enabled only compiles the binary)',
|
||||
)
|
||||
|
||||
option(
|
||||
|
|
|
|||
Loading…
Reference in a new issue