Commit graph

88 commits

Author SHA1 Message Date
Evgeny Vereshchagin 6b8d32ea7b ci: turn off FuzzBuzz
I don't think anyone uses it.
2020-03-30 14:57:22 +02:00
Zbigniew Jędrzejewski-Szmek 2b4a65b668 sd-bus: export sd_bus_message_dump
Fixes #14640.
2020-01-23 23:38:20 +01:00
Zbigniew Jędrzejewski-Szmek 27cf4c18c7 sd-bus: make dump flags public 2020-01-23 23:38:20 +01:00
Lennart Poettering d642f640bf json: add flags parameter to json_parse_file(), for parsing "sensitive" data
This will call json_variant_sensitive() internally while parsing for
each allocated sub-variant. This is better than calling it a posteriori
at the end, because partially parsed variants will always be properly
erased from memory this way.
2019-12-02 09:47:00 +01:00
Yu Watanabe f5947a5e92 tree-wide: drop missing.h 2019-10-31 17:57:03 +09:00
Yu Watanabe 9648956d1f test: move {test,fuzz}-fido-id-desc.c into src/udev/fido_id 2019-10-31 10:37:42 +09:00
Fabian Henneke d45ee2f31a udev: Add id program and rule for FIDO security tokens
Add a fido_id program meant to be run for devices in the hidraw
subsystem via an IMPORT directive. The program parses the HID report
descriptor and assigns the ID_SECURITY_TOKEN environment variable if a
declared usage matches the FIDO_CTAPHID_USAGE declared in the FIDO CTAP
specification. This replaces the previous approach of whitelisting all
known security token models manually.

This commit is accompanied by a test suite and a fuzzer target for the
descriptor parsing routine.

Fixes: #11996.
2019-09-07 02:23:58 +09:00
Daniel Edgecumbe a95686bb5d journal: Make the output of --update-catalog deterministic
The use of an unordered hashmap means that the output of
'journalctl --update-catalog' differs between runs despite there being no
changes in the input files.

By changing all instances of Hashmap to OrderedHashmap we fix this, and now
the catalog is reproducible.

Motivation: https://reproducible-builds.org

Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
2019-09-06 15:13:54 +02:00
Yu Watanabe 25de7aa7b9 udev: modernize udev-rules.c
This does the following:
- rename enum udev_builtin_cmd -> UdevBuiltinCmd
- rename struct udev_builtin -> UdevBuiltin
- move type definitions to udev-rules.h
- move prototypes of functions defined in udev-rules.c to udev-rules.h
- drop to use strbuf
- propagate critical errors in applying rules,
- drop limitation for number of tokens per line.
2019-06-02 14:15:26 +09:00
Lennart Poettering d768467563 fuzzer: add varlink fuzzer 2019-05-09 14:14:20 -04:00
Evgeny Vereshchagin 87ac55a129 tests: hook up fuzz targets to FuzzBuzz 2019-05-07 21:39:01 +00:00
Franck Bui 9f3f596477 meson: make source files including nspawn-settings.h depend on libseccomp
Since nspawn-settings.h includes seccomp.h, any file that includes
nspawn-settings.h should depend on libseccomp so the correct header path where
seccomp.h lives is added to the header search paths.

It's especially important for distros such as openSUSE where seccomp.h is not
shipped in /usr/include but /usr/include/libseccomp.

This patch is similar to 8238423095.
2019-04-30 19:31:22 +02:00
Zbigniew Jędrzejewski-Szmek 673a1e6fb9 Add fmemopen_unlocked() and use unlocked ops in fuzzers and some other tests
This might make things marginially faster. I didn't benchmark though.
2019-04-12 11:44:57 +02:00
Zbigniew Jędrzejewski-Szmek ca78ad1de9 headers: remove unneeded includes from util.h
This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
2019-03-27 11:53:12 +01:00
Zbigniew Jędrzejewski-Szmek 9ddd62cda1 fuzz-nspawn-oci: add fuzzer for the oci bundle loader 2019-03-22 11:09:52 +01:00
Zbigniew Jędrzejewski-Szmek bcaabf481d fuzz-calendarspec: actually run the second part of the fuzzer
https://github.com/systemd/systemd/pull/11975#issuecomment-473467475
2019-03-16 18:13:17 +01:00
Lennart Poettering d449d63a0d
Merge pull request #11975 from keszybz/fuzzer-fixes-n
Fixes for a few fuzzer issues
2019-03-15 17:34:37 +01:00
Lennart Poettering 0a9707187b util: split out memcmp()/memset() related calls into memory-util.[ch]
Just some source rearranging.
2019-03-13 12:16:43 +01:00
Zbigniew Jędrzejewski-Szmek 0fb729282b fuzz: limit the maximum size of test inputs for a few parsers
We have a few cases or reported issues which are about a timeout to parse
the input in 25 s. In all cases, the input is a few hundred kb. We don't really
care if the config parsers are super efficent, so let's set a limit on the input
size to avoid triggering such issues. The parsers often contain quadratic
algorithms. This is OK, because the numbers of elements are almost always very
small in real use. Rewriting the code to use more complicated data structures
to speed this up would not only complicate the code, but also pessimize behaviour
for the overwhelmingly common case of small samples. Note that in all those
cases, the input data is trusted. We care about memory correctness, and not
not so much about efficiency.

The size checks are done twice: using options for libfuzzer, and using an
internal check for afl. Those should be changed together. I didn't use a define,
because there is no easy mechanism to share the define between the two files.
2019-03-12 19:30:05 +01:00
Frantisek Sumsal 55a365cb74 fuzz: add a fuzzer for time utils 2019-03-12 12:04:25 +01:00
Frantisek Sumsal 415b3f0bb2 fuzz: add a fuzzer for calendarspec 2019-03-12 11:57:09 +01:00
Frantisek Sumsal b5b499b32c fuzz: add nspawn-settings fuzzer 2019-03-11 14:13:00 +01:00
Frantisek Sumsal 04ddab1462 fuzz: add hostname-util fuzzer 2019-03-11 14:12:06 +01:00
Frantisek Sumsal 18d51b4509 fuzz: add env-file fuzzer 2019-03-11 14:11:28 +01:00
Frantisek Sumsal e5f274bee1 fuzz: add bus-label fuzzer 2019-03-11 13:00:32 +01:00
Yu Watanabe 55ac7b6314 fuzz-dhcp6-client: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11584.
2019-03-04 12:04:09 +01:00
Yu Watanabe 358fb6862b fuzz: do not assume the existence of /sys/class/net/lo
Hopefully fixes oss-fuzz#13440.
2019-02-28 10:38:16 +01:00
Lennart Poettering f3892edd5e
Merge pull request #11824 from keszybz/fuzzer-fixes
Fuzzer fixes
2019-02-26 19:02:12 +01:00
Lennart Poettering 8c28360a21
Merge pull request #11823 from keszybz/more-fuzz-coverage
More fuzz coverage
2019-02-26 17:21:32 +01:00
Zbigniew Jędrzejewski-Szmek 9b7f73b03f fuzz-ndisc-rs: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11605.
2019-02-26 13:14:56 +01:00
Zbigniew Jędrzejewski-Szmek d92e7b8fe4 fuzz-lldp: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11603.
2019-02-26 13:13:02 +01:00
Zbigniew Jędrzejewski-Szmek eafadd069c fuzz-journal-stream: avoid assertion failure on samples which don't fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11587.
We had a sample which was large enough that write(2) failed to push all the
data into the pipe, and an assert failed. The code could be changed to use
a loop, but then we'd need to interleave writes and sd_event_run (to process
the journal). I don't think the complexity is worth it — fuzzing works best
if the sample is not too huge anyway. So let's just reject samples above 64k,
and tell oss-fuzz about this limit.
2019-02-26 13:00:35 +01:00
Yu Watanabe 4c9024c2cf fuzz: add fuzzer for udev database 2019-02-26 13:10:31 +09:00
Zbigniew Jędrzejewski-Szmek 4832ce7eec fuzz-unit-file: also run manager_dump()
This should increase coverage a bit.
2019-02-25 15:46:23 +01:00
Zbigniew Jędrzejewski-Szmek 9a07157dd5 udev: use typedef for struct udev_rules 2018-12-17 09:27:21 +01:00
Zbigniew Jędrzejewski-Szmek 1d79128121 udev: make udev_rules_new() return a proper error code 2018-12-14 10:20:43 +01:00
Yu Watanabe ef118d00eb util: drop missing.h from socket-util.h 2018-12-06 13:31:16 +01:00
Yu Watanabe 36dd5ffd5d util: drop missing.h from util.h 2018-12-04 10:00:34 +01:00
Lennart Poettering e4de72876e util-lib: split out all temporary file related calls into tmpfiles-util.c
This splits out a bunch of functions from fileio.c that have to do with
temporary files. Simply to make the header files a bit shorter, and to
group things more nicely.

No code changes, just some rearranging of source files.
2018-12-02 13:22:29 +01:00
Yu Watanabe 466a2bee94
Merge pull request #10952 from evverx/keep-fuzz-udev-rules-going
tests: make fuzz-udev-rules work also in the environment created by run_minijail
2018-11-28 11:33:27 +09:00
Evgeny Vereshchagin 95ccf1aa5f tests: suppress "unwanted log lines" in several fuzzers
According to https://oss-fuzz.com/fuzzer-stats/by-fuzzer/fuzzer/libFuzzer/job/libfuzzer_asan_systemd,
fuzz-network-parser, fuzz-netdev-parser and fuzz-journal-remote produce
a lot of unwanted log lines. Let's set the maximum log level to LOG_CRIT
as we do in the other fuzzers.
2018-11-28 10:10:09 +09:00
Evgeny Vereshchagin fa6e5861f7 tests: make fuzz-udev-rules work also in the environment created by run_minijail
This should close https://oss-fuzz.com/testcase?key=5642013043589120.

See also https://github.com/google/oss-fuzz/issues/1983.
2018-11-28 01:34:38 +01:00
Evgeny Vereshchagin 8e96f161af tests: keep going even if setup_mount_namespace has failed
This should address https://github.com/google/oss-fuzz/issues/1983.
2018-11-27 12:47:06 +01:00
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