Commit graph

45 commits

Author SHA1 Message Date
Evgeny Vereshchagin 2e646cbed8 tests: add a fuzzer for the udev rules parser (#10929) 2018-11-26 18:14:30 +09:00
Evgeny Vereshchagin a4aa59bae2 tests: add a fuzzer for server_process_native_file 2018-11-23 17:29:59 +01:00
Evgeny Vereshchagin 4928e8adba tests: add a fuzzer for catalog_import_file 2018-11-22 21:02:34 +01:00
Evgeny Vereshchagin 9541f5ff5c tests: add a fuzzer for journald streams 2018-11-20 03:03:32 +01:00
Evgeny Vereshchagin ed62712dc6 tests: introduce dummy_server_init and use it in all journald fuzzers 2018-11-17 13:02:26 +01:00
Evgeny Vereshchagin 090a20cfaf tests: add a fuzzer for process_audit_string 2018-11-16 23:14:31 +01:00
Evgeny Vereshchagin a7891d203c tests: run fuzzers four times in a row (#10794)
This should help to catch issues that are easily detectable by
bad_build_check like the one being fixed in https://github.com/systemd/systemd/pull/10793,
which would totally break the build tomorrow if I hadn't run
`helper.py check_build` manually.
2018-11-16 23:09:24 +09:00
Evgeny Vereshchagin cc55ac0171 test: initialize syslog_fd in fuzz-journald-kmsg too
This is a follow-up to 8857fb9beb that prevents the fuzzer from crashing with
```
==220==ERROR: AddressSanitizer: ABRT on unknown address 0x0000000000dc (pc 0x7ff4953c8428 bp 0x7ffcf66ec290 sp 0x7ffcf66ec128 T0)
SCARINESS: 10 (signal)
    #0 0x7ff4953c8427 in gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35427)
    #1 0x7ff4953ca029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
    #2 0x7ff49666503a in log_assert_failed_realm /work/build/../../src/systemd/src/basic/log.c:805:9
    #3 0x7ff496614ecf in safe_close /work/build/../../src/systemd/src/basic/fd-util.c:66:17
    #4 0x548806 in server_done /work/build/../../src/systemd/src/journal/journald-server.c:2064:9
    #5 0x5349fa in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-journald-kmsg.c:26:9
    #6 0x592755 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:571:15
    #7 0x590627 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:480:3
    #8 0x594432 in fuzzer::Fuzzer::MutateAndTestOne() /src/libfuzzer/FuzzerLoop.cpp:708:19
    #9 0x5973c6 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:839:5
    #10 0x574541 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:764:6
    #11 0x5675fc in main /src/libfuzzer/FuzzerMain.cpp:20:10
    #12 0x7ff4953b382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #13 0x420f58 in _start (/out/fuzz-journald-kmsg+0x420f58)
```
2018-11-16 12:44:47 +01:00
Evgeny Vereshchagin 8857fb9beb tests: add a fuzzer for dev_kmsg_record 2018-11-16 08:44:35 +01:00
Yu Watanabe f2a500eb41 fuzz: explicitly set initial value of global variables 2018-11-12 01:58:17 +09:00
Yu Watanabe 804a6a1759 fuzz: set SOCK_CLOEXEC and SOCK_NONBLOCK 2018-11-12 01:57:27 +09:00
Yu Watanabe c0e3d79970 fuzz: use SOCK_STREAM instead of SOCK_DGRAM
Fixes oss-fuzz#10734.
2018-11-12 01:56:17 +09:00
Lennart Poettering 8cb17a64c4
Merge pull request #10563 from keszybz/lz4-quickfix-quickfix
journal: adapt for new improved LZ4_decompress_safe_partial()
2018-10-30 14:51:55 +01:00
Zbigniew Jędrzejewski-Szmek 029427043b fuzz-compress: add fuzzer for compression and decompression 2018-10-30 11:04:53 +01:00
Evgeny Vereshchagin 28ffcec2cb tests: add an lldp fuzzer
I went through my antique collection of fuzzers the other day
to see which ones I hadn't sent upstream yet. This one
seems to be nice to have and ready to be merged. As far as I can
tell, it hasn't managed to find anything useful yet,
but it's better to be safe than sorry especially when it comes to networking
code :-)
2018-10-29 15:24:16 +00:00
Evgeny Vereshchagin 6315d12bba tests: add a fuzzer for the json parser and dumper 2018-10-10 10:13:30 +02:00
Zbigniew Jędrzejewski-Szmek 56b560c263 fuzz-bus-message: add fuzzer for message parsing
As with other fuzzers, SYSTEMD_FUZZ_OUTPUT=1 and SYSTEMD_LOG_LEVEL=debug can be
used for debugging.
2018-10-02 11:09:05 +02:00
Evgeny Vereshchagin d89a400ed6 fuzz: add a fuzzer for dhcp6_client 2018-09-29 02:27:07 +00:00
Evgeny Vereshchagin 0f0a1dad7d tests: add a fuzzer for sd-ndisc 2018-09-26 16:39:03 +00:00
Zbigniew Jędrzejewski-Szmek 6d7c403324 tests: use a helper function to parse environment and open logging
The advantages are that we save a few lines, and that we can override
logging using environment variables in more test executables.
2018-09-14 09:29:57 +02:00
Evgeny Vereshchagin 231dca5579 tests: put fuzz_journald_processing_function in a .c file 2018-09-08 12:05:14 +02:00
Evgeny Vereshchagin 9cdea02db5 tests: add a fuzzer for server_process_native_message 2018-09-03 07:16:52 +00:00
Evgeny Vereshchagin b1bd453f36 tests: rework the code fuzzing journald
This should make it easier to add a new fuzzer without a lot of
duplication.
2018-09-03 06:46:24 +00:00
Evgeny Vereshchagin a70f343cac tests: add a rudimentary fuzzer for server_process_syslog_message (#9979) 2018-09-03 12:18:26 +09:00
Yu Watanabe f18edd8a0a tree-wide: add multiple inclusion guard 2018-06-25 13:04:59 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Zbigniew Jędrzejewski-Szmek 6dbef3053d fuzz-journal-remote: write to /dev/null not stdout
This makes the fuzzing much more efficient. Optionally provide output is
$SYSTEMD_FUZZ_OUTPUT is set, which makes debugging of any failures much easier.

The case from 056129deb73df17ece4212db39d2ca0842d9a49c is still detected properly.
2018-05-31 14:30:23 +02:00
Zbigniew Jędrzejewski-Szmek bbdad08530 fuzz-journal-remote: try all output modes 2018-05-31 14:30:23 +02:00
Zbigniew Jędrzejewski-Szmek a38f7fec44 fuzz-journal-remote: a fuzzer for journal-remote over-the-wire input 2018-05-31 13:04:18 +02:00
Zbigniew Jędrzejewski-Szmek d6ea3b78a6 fuzz-unit-file: skip BOM (#8723)
Yet another false positive from ListenNetlink,
https://oss-fuzz.com/v2/testcase-detail/4908210742886400/7694.
2018-04-16 10:59:41 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek b834c6cee5 fuzz-unit-file: allow a space between variable name and "=" (#8670)
The parser allows that, so the check when to skip needs this too.

https://oss-fuzz.com/v2/issue/5106486364602368/7422
2018-04-06 11:36:17 +02:00
Zbigniew Jędrzejewski-Szmek 989290dbf1 fuzz-unit-file: add __has_feature(memory_sanitizer) when skipping ListenNetlink=
https://clang.llvm.org/docs/MemorySanitizer.html#id5 documents this
check as the way to detect MemorySanitizer at compilation time. We
only need to skip the test if MemorySanitizer is used.

Also, use this condition in cg_slice_to_path(). There, the code that is
conditionalized is not harmful in any way (it's just unnecessary), so remove
the FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION condition.

Fixes #8482.
2018-03-26 15:28:03 +02:00
Zbigniew Jędrzejewski-Szmek 483ed8a6a0 fuzz-unit-file: adjust check for ListenNetlink yet again
The test for ListenNetlink would abort the loop if a line longer then LINE_MAX
was encountered (read_line() returns -ENOBUFS in that case). Let's use the
the line length limit that the unit file parses uses.

https://oss-fuzz.com/v2/issue/5546208027213824/7094.
2018-03-26 10:42:19 +02:00
Zbigniew Jędrzejewski-Szmek af3865abf1 fuzz-unit-file: fix check if ListenNetlink is used
A line may contain leading spaces which we should skip.
Fixes https://oss-fuzz.com/v2/issue/5546208027213824/7049.
2018-03-21 13:16:52 +01:00
Zbigniew Jędrzejewski-Szmek bd0763b642 fuzz-unit-file: simply do not test ListenNetlink= at all
msan doesn't understand sscanf with %ms, so it falsely reports unitialized
memory. Using sscanf with %ms is quite convenient in
socket_address_parse_netlink(), so let's just not run the fuzzer for
ListenNetlink= at all for now. If msan is fixed, we can remove this.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6884
2018-03-18 21:05:43 +01:00
Zbigniew Jędrzejewski-Szmek d14829c8b7 fuzz-dhcp-server: fix name of options file 2018-03-11 16:33:59 +01:00
Zbigniew Jędrzejewski-Szmek b872843c4d fuzz: allow logging to be configured, disable in fuzz-unit-file
fuzz-unit-file generated too much logs about invalid config lines. This just
slows things down and fills the logs. If necessary, it's better to rerun the
interesting cases with SYSTEMD_LOG_LEVEL=debug.
2018-03-11 16:33:59 +01:00
Zbigniew Jędrzejewski-Szmek ec7a02ea54 Add fuzzer for unit file parser 2018-03-11 16:33:59 +01:00
Yu Watanabe db52db4afa fuzz: cast to void when return value is ignored 2018-01-22 09:58:29 +09:00
Yu Watanabe 0f3da640de fuzz: check return value
Closes CID #1385306 and #1385300.
2018-01-22 09:55:38 +09:00
Yu Watanabe 7444956723 fuzz: fix coding style 2018-01-22 09:54:30 +09:00
Jonathan Rudenberg 2bd37c5be2 fuzz: add DHCP server fuzzer 2018-01-19 21:48:14 -05:00
Jonathan Rudenberg 7db7d5b733 fuzz: add initial fuzzing infrastructure
The fuzzers will be used by oss-fuzz to automatically and
continuously fuzz systemd.

This commit includes the build tooling necessary to build fuzz
targets, and a fuzzer for the DNS packet parser.
2018-01-17 13:57:06 -05:00