From 40893cbfd5db8b2213c1f4e8047bef224d2258cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 8 May 2022 11:18:14 +0200 Subject: fuzz-journal-remote: allow -ENODATA too It seems that we try to create a new file, which fails with -ENOSPC, and we later fail when reading a file with ENODATA. journal_file_open() will return -ENODATA if the file is too short or if journal_file_verify_header() fails. We'll unlink a file we newly created if we fail to initialize it immediately after creation. I'm not sure if the file we fail to open is the one we newly created and e.g. failed to create the arena and such, or if it's the file we were trying to rotate away from. Either way, I think we should be OK with with a non-fully-initialized journal file. Failed to create rotated journal: No space left on device Failed to write entry of 2 bytes: No space left on device sd_journal_open_files(["/tmp/fuzz-journal-remote.vELRpI.journal"]) failed: No data available Assertion 'IN_SET(r, -ENOMEM, -EMFILE, -ENFILE)' failed at src/journal-remote/fuzz-journal-remote.c:70, function int LLVMFuzzerTestOneInput(const uint8_t *, size_t)(). Aborting. oss-fuzz-39238: https://oss-fuzz.com/issue/4609851129462784 --- src/journal-remote/fuzz-journal-remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/journal-remote') diff --git a/src/journal-remote/fuzz-journal-remote.c b/src/journal-remote/fuzz-journal-remote.c index 9206b99406..a8e56e21b2 100644 --- a/src/journal-remote/fuzz-journal-remote.c +++ b/src/journal-remote/fuzz-journal-remote.c @@ -66,7 +66,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { r = sd_journal_open_files(&j, (const char**) STRV_MAKE(name), 0); if (r < 0) { log_error_errno(r, "sd_journal_open_files([\"%s\"]) failed: %m", name); - assert_se(IN_SET(r, -ENOMEM, -EMFILE, -ENFILE)); + assert_se(IN_SET(r, -ENOMEM, -EMFILE, -ENFILE, -ENODATA)); return r; } -- cgit v1.2.1