btrfs-progs: ci: add sanitizer coverage

Add builds with ASAN and UBSAN for both gcc. Clang + asan fails at
some tests due to wrong asan runtime, clang + ubsan fails at
libbtrfsutil/btrfsutil_internal.h:71:20:

	memcpy(&tmp, &sh->type, sizeof(__u32));

which seems to be too strict.

    [TEST/cli]   008-subvolume-get-set-default
subvolume get-default: default id is not 256, but
libbtrfsutil/btrfsutil_internal.h:71:20: runtime error: member access within
misaligned address 0x7ffcc8017f67 for type 'const struct
btrfs_ioctl_search_header', which requires 8 byte alignment

0x7ffcc8017f67: note: pointer points here

 00 00 00 00 07  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 05  00 00 00 00 00 00 00 90  00 00 00
             ^

libbtrfsutil/btrfsutil_internal.h:64:20: runtime error: member access within
misaligned address 0x7ffcc8017f67 for type 'const struct
btrfs_ioctl_search_header', which requires 8 byte alignment

0x7ffcc8017f67: note: pointer points here

 00 00 00 00 07  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 05  00 00 00 00 00 00 00 90  00 00 00
             ^

libbtrfsutil/btrfsutil_internal.h:78:20: runtime error: member access within
misaligned address 0x7ffcc8017f67 for type 'const struct
btrfs_ioctl_search_header', which requires 8 byte alignment

0x7ffcc8017f67: note: pointer points here

 00 00 00 00 07  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 05  00 00 00 00 00 00 00 90  00 00 00

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2020-10-02 20:58:24 +02:00
parent 726026f7da
commit f43df8a863
2 changed files with 15 additions and 4 deletions

View File

@ -19,9 +19,19 @@
sudo: required
language: c
compiler:
- gcc
- clang
matrix:
include:
- os: linux
compiler: gcc
- os: linux
compiler: gcc
env: D=asan
- os: linux
compiler: gcc
env: D=ubsan
- os: linux
compiler: clang
cache:
ccache: true
@ -73,7 +83,7 @@ addons:
script:
# quick build tests
- "if ci/should-run-test; then docker run -it --env CC=$CC kdave/ci-musl-x86_64 ./test-build $TRAVIS_BRANCH --disable-documentation --disable-backtrace; fi"
- "if ci/should-run-test; then make TEST_LOG=dump library-test; fi"
- "if ci/should-run-test && ci/not-asan-build; then make TEST_LOG=dump library-test; fi"
# real tests
- "if ci/should-run-test; then make TEST_LOG=dump test-cli; fi"
- "if ci/should-run-test; then make TEST_LOG=dump test-mkfs; fi"

View File

@ -10,4 +10,5 @@ set -e
./autogen.sh
./configure "$@"
echo "D=$D"
make