Commit Graph

82 Commits

Author SHA1 Message Date
Evgeny Vereshchagin b62ec52e8f tests: add a fuzz target calling fdisk_script_read_file
It has already found a couple of issues mentioned in
https://github.com/karelzak/util-linux/issues/1023#issuecomment-671910621
2020-08-10 23:30:50 +00:00
Evgeny Vereshchagin 6e277b7a97 tests: pack testcases into zip archives
so that OSS-Fuzz can use them as seed corpora

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 2cdbf06f5e tests: add a fuzzer for process_wtmp_file
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 02f5fc1407 tools: make it possible to set all the fuzzing flags with config-gen
so that the fuzz targets (along with everything else) can be built
and run with:
```
./tools/config-gen fuzz
make check
```

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin ccdc47b7f5 tests: add a fuzzer for mnt_table_parse_stream
The fuzzer is supposed to cover `mnt_table_parse_stream`, which is
used by systemd to parse /proc/self/mountinfo. The systemd project
has run into memory leaks there at least twice:

https://github.com/systemd/systemd/pull/12252#issuecomment-482804040
https://github.com/systemd/systemd/issues/8504

so it seems to be a good idea to continuously fuzz that particular
function.

The patch can be tested locally by installing clang and running
./tools/oss-fuzz.sh. Currently the fuzzer is failing with
```
=================================================================
==96638==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 216 byte(s) in 1 object(s) allocated from:
    #0 0x50cd77 in calloc (/home/vagrant/util-linux/out/test_mount_fuzz+0x50cd77)
    #1 0x58716a in mnt_new_fs /home/vagrant/util-linux/libmount/src/fs.c:36:25
    #2 0x54f224 in __table_parse_stream /home/vagrant/util-linux/libmount/src/tab_parse.c:728:9
    #3 0x54eed8 in mnt_table_parse_stream /home/vagrant/util-linux/libmount/src/tab_parse.c:804:8
    #4 0x5448b2 in LLVMFuzzerTestOneInput /home/vagrant/util-linux/libmount/src/fuzz.c:19:16
    #5 0x44cc88 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/util-linux/out/test_mount_fuzz+0x44cc88)
    #6 0x44d8b0 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) (/home/vagrant/util-linux/out/test_mount_fuzz+0x44d8b0)
    #7 0x44e270 in fuzzer::Fuzzer::MutateAndTestOne() (/home/vagrant/util-linux/out/test_mount_fuzz+0x44e270)
    #8 0x450617 in fuzzer::Fuzzer::Loop(std::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) (/home/vagrant/util-linux/out/test_mount_fuzz+0x450617)
    #9 0x43adbb in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/util-linux/out/test_mount_fuzz+0x43adbb)
    #10 0x42ad46 in main (/home/vagrant/util-linux/out/test_mount_fuzz+0x42ad46)
    #11 0x7fa084f621a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

SUMMARY: AddressSanitizer: 216 byte(s) leaked in 1 allocation(s).
INFO: to ignore leaks on libFuzzer side use -detect_leaks=0.
```

Once the bug is fixed and the OSS-Fuzz counterpart is merged it should be possible
to turn on CIFuzz to make sure the fuzz target can be built and run for some time
without crashing: https://google.github.io/oss-fuzz/getting-started/continuous-integration/

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Karel Zak 63f4e19928 tools: remove changes merged by accident
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-23 11:22:42 +02:00
Karel Zak d35d646f17 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-22 12:20:36 +02:00
Karel Zak bb6561f1a7 build-sys: add --enable-werror to devel build scenarios
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:37:06 +02:00
Karel Zak fadb5ebf9c build-sys: add --with-cryptsetup to config-gen.d/all.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-05 14:57:50 +01:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-01 13:01:43 +02:00
Sami Kerola 218b1dd6f9
misc: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-09-12 19:41:46 +01:00
Karel Zak 4750cb9126 build-sys: add devel-non-asan.conf
This allows to use "./tools/config-gen devel-non-asan" for ./configure.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:04:24 +02:00
Karel Zak 58354269eb build-sys: add 'make checklibdoc'
Let's to be sure that all libs API symbols are documented.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-24 18:02:39 +02:00
Karel Zak 7bd44e8ade build-sys: enable ASAN on travis-ci
Addresses: Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-15 13:05:33 +02:00
Karel Zak 1007fb6d9c tools: improve checkmans
* ignore .git/
* don't print error messages when error counters are zero
* add new KNOWN_REPEATS[]

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-01 13:52:07 +01:00
Ruediger Meier 66b7469960 tools: add segfault detection for checkusage.sh
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 14:04:29 +02:00
Ruediger Meier 99267518a6 tools: checkusage can dump all command output
use
$ make CU_DUMP=1 checkusage

for easily reviewing and comparing all output in
  /tmp/checkusage--help
  /tmp/checkusage--version
  /tmp/checkusage--unknownopt

This was a big help when doing all my last usage cleanup.
Actually I used it to dump the original output, edited it
how I would like it, and then changed our programs to match
the wanted output.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 08:25:22 +02:00
Ruediger Meier e8e9267f5d tools: ignore unsafe commands in checkusage.sh
These commands behave unusual with --unknownopt.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 08:25:10 +02:00
Ruediger Meier 22174021f8 build-sys: fix chown mistake, add checkusage.sh to the dist
Sorry, don't know why I reverted fad561b0.

But for travis we need it only in check_nonroot().
check_root() *can* do chown and the check_dist() is handled
by Makefile.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 21:00:09 +02:00
Ruediger Meier a3c29314f1 tools: add checkusage.sh
Just some simple generic tests for our UL commands, regarding
options --help, --version and --unknownopt.

The script looks still a bit weired but could be polished to
be used in tests/. It would be the first time testing at least
"something" for *all* built binaries (currently 109! commands).

For the record here are the current candidates with possible
problems:

$ make checkusage
agetty: --unknownopt, stderr too long: 45
blockdev: --unknownopt, stderr too long: 28
flock: --help, no stdout
flock: --help, non-empty stderr
getopt: --help, returns error
kill: --unknownopt, stderr too short: 1
lsipc: --unknownopt, stderr too long: 77
pg: --unknownopt, stderr too long: 23
renice: --unknownopt, stderr too long: 18
rtcwake: --unknownopt, non-empty stdout
rtcwake: --unknownopt, stderr too long: 21
sulogin: --unknownopt, stderr too long: 17
write: --unknownopt, stderr too long: 12

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Karel Zak 6f2eb03433 build-sys: fix --disable-all-programs --enable-schedutils
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
  according to MASTERNAME. Note that we have to use $build_<mastername>,
  the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
  $build_ is evaluated and modified by our UL_...() functions.

* add enable-schedutils.conf to have build-system regression test for
  this use-case

Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-20 14:17:37 +01:00
Karel Zak 1854d6dfc6 build-sys: add non-widechar.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-16 13:47:44 +01:00
Karel Zak e1a0fd98cd build-sys: use sed to substitute
Travis CI:
tools/git-version-gen: 116: tools/git-version-gen: Bad substitution

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-29 14:25:23 +01:00
Ruediger Meier 85004b142a build-sys: fix "remove the g in git describe"
The "g" was not always removed and "-rc*" follow-ups were handled
incorrectly.

So now after last commits we have these versions:

 git describe            -> blkid -V
 --------------------------------------------------------------
 v2.29-rc4               -> 2.29-rc4          (libblkid 2.29.0)
 v2.29-rc4-3-g4c8928d    -> 2.29-rc4-3-4c89   (libblkid 2.29.0)

 v2.29                   -> 2.29              (libblkid 2.29.0)
 v2.29-78-g4c8928d       -> 2.29.78-4c89      (libblkid 2.29.78)

 v2.29.1                 -> 2.29.1            (libblkid 2.29.1)
 v2.29.1-4-g4c8928d      -> 2.29.1.4-4c89     (libblkid 2.29.1)

 v2.29.1-rc2             -> 2.29.1-rc2        (libblkid 2.29.1)
 v2.29.1-rc2-3-g4c8928d  -> 2.29.1-rc2-3-4c89 (libblkid 2.29.1)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier 6ac59b5bd5 build-sys: remove old git fallback from git-version-gen
Just make the script more readable. Nobody is using 10 years old
git.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Karel Zak b5a58919a9 tools: make ko-release-gen usable with gpg2
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-01 01:20:06 +02:00
Karel Zak 702b6b5f7f build-sys: add tools/Makemodule.am
We have "make" targets which depends on tools/check*.sh scripts. It's
ugly to exclude these scripts from the release tar balls (as generated
by "make distcheck").

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-25 15:59:15 +02:00
Karel Zak 5d25b7814f tools: add script to load .po from translationproject.org
I use it for years, let's keep it in the repository.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-25 15:28:42 +02:00
Karel Zak 5ae7ae8adb tools: add missing checkcompletion.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-17 14:34:29 +01:00
Ruediger Meier 51658498c4 build-sys: portable usage of find command
- use dot instead of skipping search-path
 - avoid -perm /a+x
 - avoid -path

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 12:53:47 +01:00
Sami Kerola 6e93ae8414 tools: stop checkmans.sh validating libtool builds
The checkmans.sh tried to validate shared libraries, such as
./.libs/libsmartcols.so.1, causing the check output to a have
lot of pointless garbage.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-08-07 21:34:42 +01:00
Karel Zak d43ec106e4 tools: add hexdump badconv() to noreturn smatch list
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-05 13:18:40 +02:00
Karel Zak 06df240c92 tools: add err_oom() to smatch no_return_funcs
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-05 12:41:17 +02:00
Karel Zak 9465221848 tools: add libfdisk docs to kernel.org release generator
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-19 13:43:42 +01:00
J William Piggott b8239769f9 tools: checkmans.sh add stats
Add test results statistics.
Fix-up 'KNOWN_REPEATS'.
Version bump.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:46 -05:00
J William Piggott 7d2ba7ad23 tools: checkmans.sh clean up 'let'
Clean up 'let' issues and loop iteration.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:45 -05:00
J William Piggott 34317b9292 tools: checkman.sh portability lexgrog
checkman.sh depends upon the man-db package:
   Add using grog when lexgrog not installed.

   /dev/null some troff noise.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:45 -05:00
J William Piggott d1fd99e8e0 tools: checkman.sh portability
checkman.sh fails if 'git' or 'lib' are
anywhere in the tested file's path:
   Change to using relative paths.
   Improve the 'find' command call.

checkman.sh depends upon the man-db package:
   Remove all instants of the man command and
   use troff directly to improve portability.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-13 11:43:45 -05:00
Karel Zak ae2f2f5617 build-sys: add libsmartcols to ko-release-gen script
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 15:42:09 +02:00
Karel Zak b56dd06df6 tests: update build tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 12:46:04 +02:00
Karel Zak fd0e5ae46e build-sys: add non-libsmartcols.conf
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 12:44:37 +02:00
Karel Zak f080cc99c8 build-sys: add disable-all.conf to config-gen
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-27 11:37:18 +02:00
Sami Kerola 22c3c4f936 tools: make config-gen to require build target argument
When argument is not supplied help user by telling what arguments can be
used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-07 11:45:54 +01:00
Karel Zak 65acdc8734 build-sys: remove deprecated-mount/
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 13:19:19 +01:00
Sami Kerola 052a6cf285 tools: add usage information to checkconfig.sh
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:35 +01:00
Karel Zak 413875b649 build-sys: add --with-smack to config-gen.d
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-12 15:48:42 +01:00
Sami Kerola 0a2c1e8ed7 tools: generate autotools files if missing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-09-10 12:57:31 +02:00
Sami Kerola eb7069693e tools: make checkmans.sh to find missing manuals
Finding missing manuals is loosely based on ideas in man-page-day-1.sh,
wrote by Peter Schiffer.

CC: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:26:48 +02:00
Sami Kerola 12cc556bca tools: add checks to manual page test script
This change includes

- better way to detect manual page inclusion
- man -k header test, which uses lexgrog
- repeated word detection
- static declaration to known repeated words

Most of the  changes are based on man-page-day-1.sh, that is in use at
RedHat Quality Assurance, and wrote by Peter Schiffer.

CC: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:26:44 +02:00
Karel Zak 456857a49a build-sys: add config-gen.d stuff for chsh-chfn
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-13 13:49:05 +01:00