Description of problem: Running annocheck against glibc reports --test-pic/--test-pie failures on s390x. Version-Release number of selected component (if applicable): glibc-2.33.9000-42.el9.s390x annobin-annocheck-9.79-1.el9.s390x How reproducible: Deterministic Steps to Reproduce: 1. rpm -qal 'glibc*' | while read f ; do if test -f "$f" -a ! -L "$f" ; then echo $f ; fi ; done | xargs -L 200 annocheck --verbose --verbose --ignore-gaps --skip-all --test-pic --test-pie 2> /dev/null | grep FAIL: Actual results: Hardened: /usr/sbin/iconvconfig: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/sbin/iconvconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10017c0..0x1004780) (source: annobin notes) Hardened: /usr/sbin/iconvconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1003e70..0x10047d2) (source: annobin notes) Hardened: /usr/libexec/getconf/XBS5_LP64_OFF64: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/libexec/getconf/XBS5_LP64_OFF64: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1000d20..0x1001434) (source: annobin notes) Hardened: /usr/libexec/getconf/POSIX_V7_LP64_OFF64: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/libexec/getconf/POSIX_V7_LP64_OFF64: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1000d20..0x1001434) (source: annobin notes) Hardened: /usr/libexec/getconf/POSIX_V6_LP64_OFF64: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/libexec/getconf/POSIX_V6_LP64_OFF64: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1000d20..0x1001434) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1087590..0x1088190) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10879c0..0x10883a6) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10002c0..0x1087362) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1003a00..0x1087590) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10002c0..0x1000512) (source: annobin notes) Hardened: /sbin/ldconfig: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1000308..0x10607b2) (source: annobin notes) Hardened: /usr/sbin/zic: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/sbin/zic: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1001740..0x100a72c) (source: annobin notes) Hardened: /usr/bin/zdump: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/zdump: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10011f0..0x1003120) (source: annobin notes) Hardened: /usr/bin/sprof: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/sprof: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1001a30..0x10046d8) (source: annobin notes) Hardened: /usr/bin/pldd: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/pldd: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10014b0..0x10023a2) (source: annobin notes) Hardened: /usr/bin/pldd: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10023b0..0x10024ea) (source: annobin notes) Hardened: /usr/bin/localedef: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/localedef: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1003700..0x103a83e) (source: annobin notes) Hardened: /usr/bin/localedef: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10047b0..0x103a78c) (source: annobin notes) Hardened: /usr/bin/locale: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/locale: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10025a0..0x100663e) (source: annobin notes) Hardened: /usr/bin/locale: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1004880..0x100658c) (source: annobin notes) Hardened: /usr/bin/iconv: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/iconv: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1002c70..0x100b3cc) (source: annobin notes) Hardened: /usr/bin/iconv: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1003f80..0x100adda) (source: annobin notes) Hardened: /usr/bin/getent: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/getent: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10031a0..0x10052b6) (source: annobin notes) Hardened: /usr/bin/getconf: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/getconf: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1000d20..0x1001434) (source: annobin notes) Hardened: /usr/bin/gencat: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) Hardened: /usr/bin/gencat: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x10016c0..0x1003cda) (source: annobin notes) Hardened: /usr/bin/gencat: FAIL: pic test because -fpic/-fpie not enabled (addr range: 0x1003ce0..0x1003e1a) (source: annobin notes) Expected results: No FAILs reported. Additional info:
Actually, the problem is present on ppc64le and aarch64 as well, besides s390x.
Executables are not built with -pie on s390x and ppc64le because they do not yet support static-pie. It may be worthwhile to add aarch64 to %pie_arches since it is supposed to be functional. That said though, maybe we need to give a thought to enabling PIE on non-static binaries since with the exception of ldconfig, all of them are dynamic executables. It will need some upstream work though.
Siddhesh, I believe that we could fix every executable here except ldconfig. We need to fix up the flag inheritance in the glibc build to achieve this, so there might be some build file changes. However, for ldconfig we will need to work with IBM to enable static PIE for ppc64le and s390x. I will raise this with the IBM teams.
(In reply to Siddhesh Poyarekar from comment #4) > That said though, maybe we need to give a thought to enabling PIE on > non-static binaries since with the exception of ldconfig, all of them are > dynamic executables. It will need some upstream work though. Agreed, we should do this upstream.
I'll try to do this upstream before 2.35 freezes.
With glibc-2.34-8.el9 and annobin-annocheck-10.29-1.el9, we no longer see the pie failure on /usr/sbin/ldconfig /usr/sbin/iconvconfig /usr/libexec/getconf/XBS5_LP64_OFF64 /usr/libexec/getconf/POSIX_V7_LP64_OFF64 /usr/libexec/getconf/POSIX_V6_LP64_OFF64 on s390x and ppc64le (did not test aarch64). Is that expected?
The older compose where we still saw annocheck failing had the same glibc-2.34-8.el9 but older annobin-annocheck-10.23-1.el9, so I guess Nick might have insight into what has changed (or shouldn't have changed) in annocheck.
(In reply to Jan Pazdziora from comment #8) > Is that expected? Yes - I have added some explicit exceptions for glibc binaries to annocheck's heuristics. So now, glibc rpms should pass annocheck cleanly... This change only went in recently (10.24), so that would explain why older versions of annocheck still complain.
Should be fixed by the rebuild.
(In reply to Florian Weimer from comment #11) > Should be fixed by the rebuild. This was not correct. The PIE fixes are not yet in.
This is now pushed to upstream master. The backport to F35 now shows only one failure on s390x: # rpm -qal 'glibc*' | while read f ; do if test -f "$f" -a ! -L "$f" ; then echo $f ; fi ; done | xargs -L 200 annocheck --verbose --verbose --ignore-gaps --skip-all --test-pic --test-pie 2> /dev/null | grep FAIL: Hardened: /sbin/ldconfig: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) (source: ELF header) which is expected since s390x does not support static-pie yet. Rest of the binaries are now built as PIE.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (new packages: glibc), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:3917