Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to --disable-no-undefined #24

Closed
wants to merge 21 commits into from
Closed

switch to --disable-no-undefined #24

wants to merge 21 commits into from

Conversation

evverx
Copy link
Owner

@evverx evverx commented Dec 3, 2021

It should address #11

evverx added a commit that referenced this pull request Dec 3, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit that referenced this pull request Dec 3, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit that referenced this pull request Dec 5, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit that referenced this pull request Dec 5, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit that referenced this pull request Dec 6, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
evverx added a commit that referenced this pull request Dec 7, 2021
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
@evverx evverx force-pushed the disable-no-undefined branch 2 times, most recently from 5d2ff74 to 0dd539f Compare December 7, 2021 21:07
* ci: run the tests built with GCC under ASan/UBSan

* ci: more ASAN_OPTIONS

* ci: turn off strict_string_checks

#9
* ci: run the tests built with clang under ASan/UBSan

* ci: unset ZDEFS_LDFLAGS while compiling with clang

* ci: drop --no-undefined while compiling with clang

#11

* ci: turn off unaliagned access

* ci: no longer report UBSan issue while compiling elfutils

#12

* ci: turn off test-nlist under ASan/UBsan

```
clang -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/usr/local/share/locale"' -I. -I..  \
  -I. -I. -I../lib -I.. -I../libasm -I../libdw -I../libdwfl -I../libdwelf -I../libebl -I../libelf -I../lib -I..  \
  -g -O0  -o test-nlist test-nlist.c ../libelf/libelf.so
/usr/bin/ld: ../libelf/libelf.so: undefined reference to `__asan_report_store_n'
/usr/bin/ld: ../libelf/libelf.so: undefined reference to `__asan_report_load8'
/usr/bin/ld: ../libelf/libelf.so: undefined reference to `__asan_report_load2'
/usr/bin/ld: ../libelf/libelf.so: undefined reference to `__asan_report_load4'
```

* ci: pass -fno-addrsig

```
2021-12-02T16:24:58.0514411Z section [27] '.llvm_addrsig' has unsupported type 1879002115
2021-12-02T16:24:58.0515517Z *** failure in /home/runner/work/elfutils/elfutils/src/elflint --quiet --gnu-ld /home/runner/work/elfutils/elfutils/src/size.o
2021-12-02T16:24:58.0516774Z section [28] '.llvm_addrsig' has unsupported type 1879002115
2021-12-02T16:24:58.0519640Z *** failure in /home/runner/work/elfutils/elfutils/src/elflint --quiet --gnu-ld /home/runner/work/elfutils/elfutils/src/strip.o
2021-12-02T16:24:58.0521001Z FAIL run-elflint-self.sh (exit status: 1)
```

* ci: turn off UBSan for now

* ci: turn off run-debuginfod-archive-groom.sh run-debuginfod-archive-rename.sh run-debuginfod-archive-test.sh

they are failing under ASan: #8

* ci: more ASAN_OPTIONS

* ci: turn off strict_string_checks

#9

* ci: bring back UBSan

* ci: turn off the pointer overflow check for now

A lot of tests fail with it
```
2021-12-02T17:46:03.3206166Z Testsuite summary for elfutils 0.186
2021-12-02T17:46:03.3206857Z ============================================================================
2021-12-02T17:46:03.3207357Z # TOTAL: 255
2021-12-02T17:46:03.3207794Z # PASS:  160
2021-12-02T17:46:03.3208240Z # SKIP:  7
2021-12-02T17:46:03.3208663Z # XFAIL: 0
2021-12-02T17:46:03.3209102Z # FAIL:  88
2021-12-02T17:46:03.3209546Z # XPASS: 0
2021-12-02T17:46:03.3209969Z # ERROR: 0
2021-12-02T17:46:03.3251479Z FAIL: run-arextract.sh
2021-12-02T17:46:03.3251978Z ======================
2021-12-02T17:46:03.3252282Z
2021-12-02T17:46:03.3253134Z Extracting symbols... elf_begin.c:444:63: runtime error: applying non-zero offset 3938 to null pointer
2021-12-02T17:46:03.3254143Z     #0 0x7fe8b56b60ad in file_read_elf /home/runner/work/elfutils/elfutils/libelf/elf_begin.c:444:63
2021-12-02T17:46:03.3255095Z     #1 0x7fe8b56c3ca2 in read_unmmaped_file /home/runner/work/elfutils/elfutils/libelf/elf_begin.c:622:9
2021-12-02T17:46:03.3256036Z     #2 0x7fe8b56c1405 in read_file /home/runner/work/elfutils/elfutils/libelf/elf_begin.c:713:10
2021-12-02T17:46:03.3256930Z     #3 0x7fe8b56c33c5 in dup_elf /home/runner/work/elfutils/elfutils/libelf/elf_begin.c:1060:12
2021-12-02T17:46:03.3258020Z     #4 0x7fe8b56c109f in lock_dup_elf /home/runner/work/elfutils/elfutils/libelf/elf_begin.c:1112:10
2021-12-02T17:46:03.3258990Z     #5 0x7fe8b56c0ddd in elf_begin /home/runner/work/elfutils/elfutils/libelf/elf_begin.c
2021-12-02T17:46:03.3259866Z     #6 0x4c337e in main /home/runner/work/elfutils/elfutils/tests/arextract.c:72:20
2021-12-02T17:46:03.3261031Z     #7 0x7fe8b52c10b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
2021-12-02T17:46:03.3262003Z     #8 0x41b39d in _start (/home/runner/work/elfutils/elfutils/tests/arextract+0x41b39d)
2021-12-02T17:46:03.3262566Z
2021-12-02T17:46:03.3263535Z SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior elf_begin.c:444:63 in
2021-12-02T17:46:03.3264834Z FAIL run-arextract.sh (exit status: 1)
```
and so on.

https://reviews.llvm.org/D67122

* ci: turn off the vla-bound check

#15

* ci: try to build elfutils with halt_on_error

now that the pointer-overflow check is off
* ci: build elfutils without -Wno-error with clang

* ci: -Wno-error=xor-used-as-pow

https://sourceware.org/pipermail/elfutils-devel/2021q1/003538.html

* ci: -Wno-error=gnu-variable-sized-type-not-at-end

```
lang -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"/usr/local/share/locale"' -I. -I..  -I. -I. -I../lib -I.. -I../libelf -I../libebl -I../libdw -I../libdwelf  -std=gnu99 -Wall -Wshadow -Wformat=2 -Wold-style-definition -Wstrict-prototypes    -Wnull-dereference -Wimplicit-fallthrough -Werror -Wunused -Wextra    -D_FORTIFY_SOURCE=2 -g -O2 -fno-addrsig -Wno-error=xor-used-as-pow -MT asm_newscn_ingrp.o -MD -MP -MF .deps/asm_newscn_ingrp.Tpo -c -o asm_newscn_ingrp.o asm_newscn_ingrp.c
asm_newscn.c:49:22: error: field 'pattern' with variable sized type 'struct FillPattern' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
  struct FillPattern pattern;
                     ^
1 error generated.
```

* ci: -Wno-error=unused-const-variable

* ci: drop -Wno-error in the CLANG_ASAN_UBSAN stage as well
Now that #8 is gone
it should be safe to run them under ASan.
evverx and others added 4 commits December 9, 2021 00:59
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@e095058...546b30f)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
* ci: turn on LSan

Now that #21 is gone
it can be brought back

* ci: switch to --enable-sanitize-undefined --enable-sanitize-address
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs:
https://clang.llvm.org/docs/AddressSanitizer.html#usage
google/sanitizers#380
so to build elfutils with clang with the sanitizers it should be possible
to turn them off.

Without this patch something like

sed -i 's/^\(ZDEFS_LDFLAGS=\).*/\1/' configure.ac
find -name Makefile.am | xargs sed -i 's/,--no-undefined//'

should be used to make elfutils compile.

The patch was tested in #24 by
compiling elfutils with both gcc and clang with and without ASan/UBsan
and running `make check && make distcheck`. --no-undefined and -z,defs
are still passed by default as expected.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant