Commit Graph

50 Commits

Author SHA1 Message Date
Milan Broz
63f7dc739b fuzz: Better log from installation script
Print last commit from each git repo.
Also use master branch for zlib.
2025-02-15 14:57:19 +01:00
Milan Broz
3899484be8 fuzz: Fix use of PWD variable.
The PWD variable is set by bash itself on every cd command,
rename it so it works as expected.
2025-02-08 15:06:33 +01:00
Milan Broz
c9008528f9 tests: Remove function xx() bashism.
Posix does not use function keyword, moreover, we use it inconsistently.
2025-01-27 20:43:33 +01:00
Milan Broz
8364178b38 Update copyright year. 2025-01-15 23:09:36 +01:00
Milan Broz
3dc5d50918 fuzz: Fix build as upstream xz repo has disabled cloning 2024-07-23 08:41:53 +02:00
Milan Broz
661f57def4 Use SPDX license identifiers.
This patch switches code to SPDX one-line license identifiers according to
https://spdx.dev/learn/handling-license-info/
and replacing long license text headers.

I used C++ format on the first line in style
// SPDX-License-Identifier: <id>
except exported libcryptsetup.h, when only C comments are used.

The only additional changes are:
- switch backend utf8.c from LGPL2+ to LGPL2.1+ (as in systemd)
- add some additional formatting lines.
2024-06-03 16:38:15 +00:00
Milan Broz
bd0ef58b3a Update copyright notice to include 2024 year. 2024-01-23 16:10:44 +01:00
Milan Broz
5e7bd7a36b fuzz: Try to limit image size in crypt2_load_proto_plain_json_fuzz
It seems that we see a lot of out of space in fuzzer run,
so try to avoid writing excessive big images here.
2023-11-30 15:01:04 +01:00
Milan Broz
e1ef5214e7 Fix some typos found by lintian. 2023-11-29 09:49:55 +01:00
Milan Broz
6262da3a11 fuzz: add missing flex (util-linux req.) to fix fuzzing build 2023-11-26 10:39:22 +01:00
Milan Broz
800ec5d1ed fuzzing: Fix crypt2_load_fuzz to not touch const data
The crypt2_load_fuzz fuzzer needs to calculate LUKS2 header checksum
to speed up fuzzing. Currently we incorrectly touch const data input.

This patch
 - calculates only primary LUKS2 header checksum (ignores secondary header)
 - uses temporary struct for modified data
 - keps fuzzer going even with original data if checksum calc fails.

Hopefully solves unknown write issue in fuzzer (not real utils) on oss-fuzz.
2023-10-30 13:11:31 +01:00
Milan Broz
0c9258484a tests: fix oss-fuzz build
- xz now requires some configure options to build with sanitizer
- lvm2 official repository moved
2023-10-27 09:03:50 +02:00
Milan Broz
841c681825 Workaround for oss-fuzz build. 2023-04-29 16:28:29 +02:00
Milan Broz
192ff16cd8 Fix fuzz tests build. 2023-03-18 11:16:22 +01:00
Milan Broz
428c2f323b fuzz: Do not calculate checksum for too small headers.
LUKS2 header must be at least binary header size.
2023-03-03 20:24:37 +01:00
Daniel Zatovic
114a13af84 Add support for meson build system.
For now, let's keep support for both - autotools and meson.
2023-03-03 13:49:47 +00:00
Daniel Zatovic
384b7f2e94 fuzzing: Fix OSS-Fuzz static build script.
The scrip for building dependencies statically still builds popt as a
shared library. The libdevmapper library is installed manually, but
incorrectly (libdevmapper.pc is installed, but it should be
devmapper.pc).
2023-02-15 14:48:02 +01:00
Milan Broz
72f799b393 Update Copyright year. 2023-02-09 17:11:18 +01:00
Milan Broz
8b90d16762 Add fuzz patch file to tarball. 2023-02-01 16:02:26 +01:00
Daniel Zatovic
5ed0358f12 fuzzing: Fix protobuf fuzzer errors when using MSAN
Patch libprotobuf-mutator to unpoison buffers obtained from libfuzzer
via LLVMFuzzerMutate. This is required as libfuzzer is usually not
compiled with memory sanitizer support (not even in OSS-Fuzz project,
see https://github.com/google/oss-fuzz/issues/864). Therefore, we
manually mark the buffer as initialized using __msan_unpoison.

Fixes OSS-fuzz bug 52541, 52543 and 52533.
2023-01-31 23:45:34 +01:00
Daniel Zatovic
7bbfccbbfa fuzzing: update script to build popt using CMake
Popt library removed support for autotools build system and can be built
only using CMake.
2023-01-11 14:02:47 +01:00
David Flor
50e8879528 fuzzing: add new fuzzer for fuzzing multiple types at once
* added fuzz target 'crypt2_load_ondisk_fuzz' that tries to load fuzz input as LUKS1, FileVault2, BitLocker in that order.
* added dictionary for this fuzz target
* added fuzz target to relevant files
2022-12-23 15:00:01 +01:00
Milan Broz
cde7b90735 fuzzing: Build OpenSSL with no-shared options
The -static option always disables threads, we want to use no-shared
build option instead.
2022-10-22 10:10:34 +00:00
daniel.zatovic
b380fa7494 CI: Add fuzzer jobs. 2022-10-19 10:07:03 +02:00
Milan Broz
00baa92756 fuzzing: Yet another dependency fix.
Previous fix breaks make dist. Let's set dependency
on object file explicitly.
2022-10-14 15:02:03 +02:00
Milan Broz
c464d61995 fuzzing: Fix dependence issue
This patch avoids a race when running parallel jobs.
2022-10-14 06:48:32 +00:00
Milan Broz
d05a2a6c99 fuzzing: Force dependence for generated header. 2022-10-10 12:32:10 +02:00
Milan Broz
758a2974f5 fuzzing: Clean up includes. 2022-10-09 12:59:57 +02:00
Milan Broz
4b5e814094 fuzzing: Remove unused code.
Also use C comments style in C-only file.
2022-10-09 12:36:52 +02:00
Milan Broz
98f5e0538a fuzzing: use ftruncate() instead of seeking to end of the file 2022-10-09 12:36:24 +02:00
Milan Broz
f03180d06a fuzzing: Simplify converters and used common defines for exit code. 2022-10-09 12:36:09 +02:00
Milan Broz
39b94ae530 fuzzing: Simplify plain JSON fuzzer. 2022-10-09 12:35:58 +02:00
Milan Broz
3690d5f532 fuzzing: Simplify proto fuzzer. 2022-10-09 12:35:20 +02:00
Milan Broz
e595940637 fuzzing: LLVMFuzzerTestOneInput must always return 0.
Also simplify the fuzzer function.
2022-10-09 12:34:26 +02:00
Milan Broz
dab939c3c9 fuzzing: Fix possible overflow in crypt2_load_fuzz.
Fixes OSS-Fuzz 52201.
2022-10-08 20:13:24 +02:00
daniel.zatovic
cc276527c7 fuzzing: Disable assembly in openssl build
Sanitizers can not instrument openssl's assembly and wrongly report
buffers from openssl as uninitialized.
2022-10-06 23:23:06 +02:00
Milan Broz
27429daf5d Fix typo. 2022-10-05 09:49:55 +02:00
Milan Broz
b20821a520 Fuzzing: disable po4a in static library dependence build as it seems to freeze. 2022-10-04 23:42:07 +02:00
Milan Broz
46b465ff2e Use upstream git for protobuf-mutator as required patches are merged now. 2022-10-04 13:10:36 +02:00
Milan Broz
d8fd9caa6a Add missing files to Makefile.am (and reformat lists). 2022-10-04 13:00:38 +02:00
daniel.zatovic
dad11f97ce Copy only selected fuzzers to out directory. 2022-10-04 13:00:33 +02:00
daniel.zatovic
c06e853938 Fix missing prototypes by adding a header file. 2022-10-04 13:00:29 +02:00
daniel.zatovic
c35e4479d5 Update fuzzing README 2022-10-04 13:00:25 +02:00
daniel.zatovic
8585fb29eb Add dictionary for the plain JSON fuzzer. 2022-10-04 13:00:21 +02:00
daniel.zatovic
97b3926655 Fix potential integer underflow. 2022-10-04 13:00:18 +02:00
Milan Broz
a3f248df9b Fix some clang++ warnings. 2022-10-04 13:00:15 +02:00
Milan Broz
e1a84607cc Rework build of fuzzers.
- Do not require any libraries installed, download everything
from upstream git, statically compile (use include, libs and pkg-config
from local directory under tests/fuzz).
Script should work both from OSS-Fuzz and locally.

- Do not require local protobuf (only staticallly compiled, see above).

- Add README.md (TBD, still not finished).

- Fix make dist and distcheck.

- Remove common.[ch] as we can use internal function.
  This makes fuzzers also C++ only (remove CFLAGS from Makefile).
2022-10-04 13:00:10 +02:00
daniel.zatovic
2f4267ba81 Add plain JSON metadata fuzzing 2022-10-04 12:59:07 +02:00
daniel.zatovic
99e8ee6b7e Add checks for compiler when building fuzz targets. 2022-10-04 12:59:04 +02:00
daniel.zatovic
f58aff21a9 Add fuzz targets, custom mutator and fuzzing dictionary 2022-10-04 12:58:59 +02:00