Bug 1988382

Summary: annocheck reports pie/pic test failures on non-x86_64 architectures
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora <jpazdziora>
Component: glibcAssignee: Siddhesh Poyarekar <sipoyare>
Status: CLOSED ERRATA QA Contact: Sergey Kolosov <skolosov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: ashankar, codonell, dj, fweimer, jjaburek, jpazdziora, mnewsome, nickc, pfrankli, rlemosor, sipoyare
Target Milestone: betaKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.34-16.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:48:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2044387    

Description Jan Pazdziora 2021-07-30 12:39:42 UTC
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:

Comment 2 Jan Pazdziora 2021-07-30 13:50:27 UTC
Actually, the problem is present on ppc64le and aarch64 as well, besides s390x.

Comment 4 Siddhesh Poyarekar 2021-07-30 20:33:49 UTC
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.

Comment 5 Carlos O'Donell 2021-08-06 13:46:18 UTC
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.

Comment 6 Carlos O'Donell 2021-09-13 16:13:25 UTC
(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.

Comment 7 Siddhesh Poyarekar 2021-10-27 12:27:23 UTC
I'll try to do this upstream before 2.35 freezes.

Comment 8 Jan Pazdziora 2021-11-29 12:08:40 UTC
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?

Comment 9 Jan Pazdziora 2021-11-29 12:12:47 UTC
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.

Comment 10 Nick Clifton 2021-11-29 12:58:47 UTC
(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.

Comment 11 Florian Weimer 2021-12-03 21:14:29 UTC
Should be fixed by the rebuild.

Comment 12 Florian Weimer 2021-12-07 14:36:24 UTC
(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.

Comment 15 Siddhesh Poyarekar 2021-12-14 04:29:35 UTC
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.

Comment 20 errata-xmlrpc 2022-05-17 15:48:47 UTC
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