Bug 2215968

Summary: new annocheck regression related to abi-note.c
Product: [Fedora] Fedora Reporter: Václav Kadlčík <vkadlcik>
Component: annobinAssignee: Nick Clifton <nickc>
Status: MODIFIED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: arjun.is, codonell, dj, fweimer, jakub, jlaw, mcermak, mcoufal, mfabian, nickc, pfrankli, sipoyare, skolosov, yahmad
Target Milestone: ---Keywords: Bugfix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: annobin-12.13-1.fc39 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Václav Kadlčík 2023-06-19 14:06:45 UTC
glibc-2.37.9000-13.fc39 introduced an annocheck regression when
compared to -10.fc39:

  MAYB: test: lto, reason: a region of code compiled without LTO was detected(abi-note.c)
  FAIL: fortify test because -D_FORTIFY_SOURCE=[2|3] was not present on the command line (abi-note.c)

Can be seen in the CI tests (fedora-ci.koji-build.rpminspect.static-analysis of https://bodhi.fedoraproject.org/updates/FEDORA-2023-3317068e8d).

Reproducible: Always

Comment 1 Siddhesh Poyarekar 2023-06-19 15:08:17 UTC
This is probably yet another exception to add for glibc sources; glibc is not built with _FORTIFY_SOURCE.

Comment 2 Florian Weimer 2023-06-19 15:49:30 UTC
(In reply to Václav Kadlčík from comment #0)
> glibc-2.37.9000-13.fc39 introduced an annocheck regression when
> compared to -10.fc39:
> 
>   MAYB: test: lto, reason: a region of code compiled without LTO was
> detected(abi-note.c)
>   FAIL: fortify test because -D_FORTIFY_SOURCE=[2|3] was not present on the
> command line (abi-note.c)
> 
> Can be seen in the CI tests (fedora-ci.koji-build.rpminspect.static-analysis
> of https://bodhi.fedoraproject.org/updates/FEDORA-2023-3317068e8d).

Which architecture(s) are affected? All of them?

Comment 3 Florian Weimer 2023-06-19 15:51:35 UTC
(In reply to Siddhesh Poyarekar from comment #1)
> This is probably yet another exception to add for glibc sources; glibc is
> not built with _FORTIFY_SOURCE.

We use this kludge in glibc.spec:

%if 0%{?_annotated_build} > 0
# libc_nonshared.a cannot be built with the default hardening flags
# because the glibc build system is incompatible with
# -D_FORTIFY_SOURCE.  The object files need to be marked as to be
# skipped in annobin annotations.  (The -specs= variant of activating
# annobin does not work here because of flag ordering issues.)
# See <https://bugzilla.redhat.com/show_bug.cgi?id=1668822>.
BuildFlagsNonshared="-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generate-missing-build-notes=yes"
%endif

We could probably build with -D_FORTIFY_SOURCE=3 instead, given that this is for the non-shared bits only (where fortification has no impact).

Comment 4 Siddhesh Poyarekar 2023-06-19 16:21:08 UTC
Hmm, I suppose we could even make this wait for a bit (i.e. until we enable fortification in 2.38) and then actually fix this by enabling fortification.  I think the first cut excludes csu, but that can be done incrementally.

Comment 5 Václav Kadlčík 2023-06-20 04:33:41 UTC
(In reply to Florian Weimer from comment #2)
> Which architecture(s) are affected? All of them?

Yes

Comment 6 Nick Clifton 2023-06-20 11:37:03 UTC
It looks like some more additions are needed to annocheck's heuristics for detecting glibc binaries.

The "/dev/null" component name in some of annocheck's messages is coming from the new string based notes which record a filename based upon the gcc command line used to build the binary being checked.  Presumably glibc has some kind of clever method for building some of its files.

Comment 7 Nick Clifton 2023-06-21 11:14:37 UTC
Should be fixed with annobin-12.13-1.fc39

Comment 8 Václav Kadlčík 2023-06-21 12:48:28 UTC
Yes, all the files annocheck complained about:
  /lib64/ld64.so.2                                                                                                                                              
  /lib64/ld-linux-x86-64.so.2                                                                                                                                   
  /lib64/libc.so.6                                                                                                                                              
  /lib/ld64.so.1                                                                                                                                                
  /lib/ld-linux-aarch64.so.1                                                                                                                                    
  /lib/ld-linux.so.2                                                                                                                                            
  /lib/libc.so.6                                                                                                                                                
  /usr/lib64/crt1.o                                                                                                                                             
  /usr/lib64/gcrt1.o                                                                                                                                            
  /usr/lib/crt1.o                                                                                                                                               
  /usr/lib/gcrt1.o
pass cleanly with annobin-12.13-1.fc39.

Comment 9 Fedora Release Engineering 2023-08-16 08:11:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.