Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1995224

Summary: [aarch64] MAYB: test: notes because not all of the .text section is covered by notes
Product: Red Hat Enterprise Linux 9 Reporter: Martin Cermak <mcermak>
Component: annobinAssignee: Nick Clifton <nickc>
Status: CLOSED ERRATA QA Contact: Václav Kadlčík <vkadlcik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: changyp6, fweimer, mcermak, nickc
Target Milestone: betaKeywords: Bugfix, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: annobin-10.06-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 12:33:04 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:
Attachments:
Description Flags
gaps-test binary none

Description Martin Cermak 2021-08-18 16:21:53 UTC
This seems to be aarch64 specific.  Versions:

annobin-annocheck-9.90-1.el9.aarch64
binutils-2.35.2-6.el9.aarch64
gcc-11.2.1-2.1.el9.aarch64
gcc-c++-11.2.1-2.1.el9.aarch64
glibc-2.34-1.el9.aarch64


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 07:30:41 ] :: [  BEGIN   ] :: Running 'echo 'int main (void) { return 0; }' | gcc -xc -o /tmp/tmp.5II0s1fnsU -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -flto  - '
:: [ 07:30:41 ] :: [   PASS   ] :: Command 'echo 'int main (void) { return 0; }' | gcc -xc -o /tmp/tmp.5II0s1fnsU -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -flto  - ' (Expected 0, got 0)
:: [ 07:30:41 ] :: [  BEGIN   ] :: Running 'annocheck -v /tmp/tmp.5II0s1fnsU'
annocheck: Version 9.90.
Hardened: /tmp/tmp.5II0s1fnsU: PASS: pie test 
Hardened: /tmp/tmp.5II0s1fnsU: info: set binary producer to Gimple version 11.
Hardened: /tmp/tmp.5II0s1fnsU: PASS: optimization test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: pic test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: stack-prot test 
Hardened: /tmp/tmp.5II0s1fnsU: info: set binary producer to GCC version 11.
Hardened: /tmp/tmp.5II0s1fnsU: PASS: lto test because detected in DWARF information 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: writeable-got test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: dynamic-segment test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: bind-now test 
Hardened: /tmp/tmp.5II0s1fnsU: info: set binary producer to Gas version 2.
Hardened: /tmp/tmp.5II0s1fnsU: info: notes produced by assembler plugin version 1
Hardened: /tmp/tmp.5II0s1fnsU: info: set binary producer to Gimple version 9.
Hardened: /tmp/tmp.5II0s1fnsU: info: notes produced by lto plugin version 9.90
Hardened: /tmp/tmp.5II0s1fnsU: skip: warnings test because LTO compilation discards preprocessor options 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: stack-clash test 
Hardened: /tmp/tmp.5II0s1fnsU: skip: fortify test because LTO compilation discards preprocessor options 
Hardened: /tmp/tmp.5II0s1fnsU: skip: glibcxx-assertions test because source language not C++ 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: gnu-stack test because stack segment exists with the correct permissions 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: gnu-relro test 
Hardened: /tmp/tmp.5II0s1fnsU: MAYB: test: notes because not all of the .text section is covered by notes 
Hardened: /tmp/tmp.5II0s1fnsU: debug: address range not covered: 610..640.
Hardened: /tmp/tmp.5II0s1fnsU: skip: branch-protection test because not built by gcc 
Hardened: /tmp/tmp.5II0s1fnsU: skip: cf-protection test because not an x86 executable 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: entry test 
Hardened: /tmp/tmp.5II0s1fnsU: skip: go-revision test because no GO compiled code found 
Hardened: /tmp/tmp.5II0s1fnsU: skip: only-go test because not compiled for x86 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: production test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: run-path test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: rwx-seg test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: short-enum test 
Hardened: /tmp/tmp.5II0s1fnsU: skip: stack-realign test because not an x86 executable 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: textrel test 
Hardened: /tmp/tmp.5II0s1fnsU: PASS: threads test 
:: [ 07:30:41 ] :: [   FAIL   ] :: Command 'annocheck -v /tmp/tmp.5II0s1fnsU' (Expected 0, got 1)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Comment 1 Nick Clifton 2021-09-16 15:34:25 UTC
Fixed in annobin-10.06-1.el9

Comment 6 Yupeng Chang 2021-12-28 07:44:21 UTC
This test starts to fail on AARCH64 since annobin 10.34.
Error log shows that
 gaps: annocheck output (with verbose and notes enabled):
annocheck: Version 10.39.
Hardened: main.exe: PASS: pie test 
Hardened: main.exe: PASS: optimization test 
Hardened: main.exe: PASS: pic test 
Hardened: main.exe: PASS: stack-prot test 
Hardened: main.exe: PASS: writable-got test 
Hardened: main.exe: PASS: dynamic-segment test 
Hardened: main.exe: PASS: bind-now test 
Hardened: main.exe: PASS: stack-clash test 
Hardened: main.exe: PASS: glibcxx-assertions test 
Hardened: main.exe: PASS: gnu-stack test because stack segment exists with the correct permissions 
Hardened: main.exe: PASS: gnu-relro test 

Notes: main.exe: 234 notes found.
Notes: Range: 0x618 .. 0x628.
  [O] Version: 3a1 [gas]
Notes: Range: 0x628 .. 0x634.
  [O] Version: 3a1 [gas]
Notes: Range: 0x6c0 .. 0x6c0.
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3g1039 [gcc in LTO mode]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O3 -flto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] FORTIFY: hidden by LTO compilation
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: -fpie
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3g1039 [gcc in LTO mode]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O3 -flto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] FORTIFY: hidden by LTO compilation
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: -fpie
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
Notes: Range: 0x6c0 .. 0x6cc.
  [O] Version: 3g1039 [gcc in LTO mode]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O3 -flto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] FORTIFY: hidden by LTO compilation
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: -fpie
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
Notes: Range: 0x6cc .. 0x6cc.
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3g1039 [gcc in LTO mode]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O3 -flto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] FORTIFY: hidden by LTO compilation
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: -fpie
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
Notes: Range: 0x700 .. 0x734.
  [O] Version: 3a1 [gas]
Notes: Range: 0x734 .. 0x734.
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [O] Version: 3p1032 [gcc]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O2 -Wall -fno-lto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] Control Flow Protection: None
  [O] FORTIFY: not detected
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: none
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
Notes: Range: 0x734 .. 0x748.
  [O] Version: 3a1 [gas]
Notes: Range: 0x760 .. 0x828.
  [O] Version: 3a1 [gas]
Notes: Range: 0x828 .. 0x828.
  [O] Version: 3a1 [gas]
  [O] Version: 3a1 [gas]
  [O] Version: 3g1039 [gcc in LTO mode]
  [O] Tool: running gcc 11.2.1 20211203
  [O] Tool: annobin gcc 11.2.1 20211203
  [O] Tool: plugin name: annobin
  [O] -O3 -flto 
  [O] Stack Protection: Strong
  [O] Stack Clash Protection: Enabled
  [O] FORTIFY: hidden by LTO compilation
  [O] GLIBCXX_ASSERTIONS: Defined
  [O] PIC: -fpie
  [O] Short Enums: Not Used
  [O] Omit Frame Pointer: Yes
  [O] ABI: 1
  [O] AArch64 Branch Protection: standard
  [F] AArch64 Branch Protection: standard
  [F] Control Flow Protection: None
  [F] Omit Frame Pointer: Yes
  [F] FORTIFY: hidden by LTO compilation
  [F] GLIBCXX_ASSERTIONS: Defined
Notes: Range: 0x828 .. 0x834.
  [O] Version: 3a1 [gas]
Notes: Range: 0x834 .. 0x840.
  [O] Version: 3a1 [gas]
Hardened: main.exe: MAYB: test: notes because not all of the .text section is covered by notes 
Hardened: main.exe: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-notes.html
Hardened: main.exe: info: address range not covered: 6d0..760 (probable component: _start).
Hardened: main.exe: skip: go-revision test because no GO compiled code found 
Hardened: main.exe: skip: only-go test because not compiled for x86 
Hardened: main.exe: PASS: production test 
Hardened: main.exe: PASS: run-path test 
Hardened: main.exe: PASS: rwx-seg test 
Hardened: main.exe: PASS: short-enums test 
Hardened: main.exe: PASS: textrel test 
Hardened: main.exe: PASS: threads test 
Hardened: main.exe: PASS: unicode test 
Hardened: main.exe: Overall: FAIL (due to MAYB results).
~/rpmbuild/BUILD/annobin-10.39/tests
FAIL gaps-test (exit status: 1)


After I disassemble the test program main.exe, I found that 0x630 ~ 0x760 covers ".annobin_abi_note.c.hot", "_start" and "call_weak_fn"
.annobin_abi_note.c.hot section all contains "nop",
_start section doesn't contain "nop"
call_week_fn section only contains "nop" at the end of the secion.
It seems that "annocheck" calculated wrong gap size.


Following are the disassembles of main.exe

Disassembly of section .init:

0000000000000618 <_init>:
 618:   d503233f        paciasp
 61c:   a9bf7bfd        stp     x29, x30, [sp, #-16]!
 620:   910003fd        mov     x29, sp
 624:   94000044        bl      734 <call_weak_fn>
 628:   a8c17bfd        ldp     x29, x30, [sp], #16
 62c:   d50323bf        autiasp
 630:   d65f03c0        ret

Disassembly of section .plt:

0000000000000640 <.plt>:
 640:   d503245f        bti     c
 644:   a9bf7bf0        stp     x16, x30, [sp, #-16]!
 648:   f00000f0        adrp    x16, 1f000 <__FRAME_END__+0x1e6dc>
 64c:   f947d611        ldr     x17, [x16, #4008]
 650:   913ea210        add     x16, x16, #0xfa8
 654:   d61f0220        br      x17
 658:   d503201f        nop
 65c:   d503201f        nop

0000000000000660 <__libc_start_main@plt>:
 660:   f00000f0        adrp    x16, 1f000 <__FRAME_END__+0x1e6dc>
 664:   f947da11        ldr     x17, [x16, #4016]
 668:   913ec210        add     x16, x16, #0xfb0
 66c:   d61f0220        br      x17

0000000000000670 <__cxa_finalize@plt>:
 670:   f00000f0        adrp    x16, 1f000 <__FRAME_END__+0x1e6dc>
 674:   f947de11        ldr     x17, [x16, #4024]
 678:   913ee210        add     x16, x16, #0xfb8
 67c:   d61f0220        br      x17

0000000000000680 <__gmon_start__@plt>:
 680:   f00000f0        adrp    x16, 1f000 <__FRAME_END__+0x1e6dc>
 684:   f947e211        ldr     x17, [x16, #4032]
 688:   913f0210        add     x16, x16, #0xfc0
 68c:   d61f0220        br      x17

0000000000000690 <abort@plt>:
 690:   f00000f0        adrp    x16, 1f000 <__FRAME_END__+0x1e6dc>
 694:   f947e611        ldr     x17, [x16, #4040]
 698:   913f2210        add     x16, x16, #0xfc8
 69c:   d61f0220        br      x17

Disassembly of section .text:

00000000000006c0 <main>:
int
main (int n, char ** a) 
{
 6c0:   d503245f        bti     c
    return 0;
}
 6c4:   52800000        mov     w0, #0x0                        // #0
 6c8:   d65f03c0        ret

00000000000006cc <.annobin_abi_note.c.hot>:
 6cc:   d503201f        nop
 6d0:   d503201f        nop
 6d4:   d503201f        nop
 6d8:   d503201f        nop
 6dc:   d503201f        nop
 6e0:   d503201f        nop
 6e4:   d503201f        nop
 6e8:   d503201f        nop
 6ec:   d503201f        nop
 6f0:   d503201f        nop
 6f4:   d503201f        nop
 6f8:   d503201f        nop
 6fc:   d503201f        nop

0000000000000700 <_start>:
 700:   d503245f        bti     c
 704:   d280001d        mov     x29, #0x0                       // #0
 708:   d280001e        mov     x30, #0x0                       // #0
 70c:   aa0003e5        mov     x5, x0
 710:   f94003e1        ldr     x1, [sp]
 714:   910023e2        add     x2, sp, #0x8
 718:   910003e6        mov     x6, sp
 71c:   f00000e0        adrp    x0, 1f000 <__FRAME_END__+0x1e6dc>
 720:   f947f800        ldr     x0, [x0, #4080]
 724:   d2800003        mov     x3, #0x0                        // #0
 728:   d2800004        mov     x4, #0x0                        // #0
 72c:   97ffffcd        bl      660 <__libc_start_main@plt>
 730:   97ffffd8        bl      690 <abort@plt>

0000000000000734 <call_weak_fn>:
 734:   f00000e0        adrp    x0, 1f000 <__FRAME_END__+0x1e6dc>
 738:   f947f400        ldr     x0, [x0, #4072]
 73c:   b4000040        cbz     x0, 744 <call_weak_fn+0x10>
 740:   17ffffd0        b       680 <__gmon_start__@plt>
 744:   d65f03c0        ret
 748:   d503201f        nop
 74c:   d503201f        nop
 750:   d503201f        nop
 754:   d503201f        nop
 758:   d503201f        nop
 75c:   d503201f        nop

0000000000000760 <deregister_tm_clones>:
 760:   90000100        adrp    x0, 20000 <__data_start>
 764:   90000101        adrp    x1, 20000 <__data_start>
 768:   91002000        add     x0, x0, #0x8
 76c:   91002021        add     x1, x1, #0x8
 770:   eb00003f        cmp     x1, x0
 774:   540000c0        b.eq    78c <deregister_tm_clones+0x2c>  // b.none
 778:   f00000e1        adrp    x1, 1f000 <__FRAME_END__+0x1e6dc>
 77c:   f947ec21        ldr     x1, [x1, #4056]
 780:   b4000061        cbz     x1, 78c <deregister_tm_clones+0x2c>
 784:   aa0103f0        mov     x16, x1
 788:   d61f0200        br      x16
 78c:   d65f03c0        ret

0000000000000790 <register_tm_clones>:
 790:   90000100        adrp    x0, 20000 <__data_start>
 794:   90000101        adrp    x1, 20000 <__data_start>
 798:   91002000        add     x0, x0, #0x8
 79c:   91002021        add     x1, x1, #0x8
 7a0:   cb000021        sub     x1, x1, x0
 7a4:   d37ffc22        lsr     x2, x1, #63
 7a8:   8b810c41        add     x1, x2, x1, asr #3
 7ac:   9341fc21        asr     x1, x1, #1
 7b0:   b40000c1        cbz     x1, 7c8 <register_tm_clones+0x38>
 7b4:   f00000e2        adrp    x2, 1f000 <__FRAME_END__+0x1e6dc>
 7b8:   f947fc42        ldr     x2, [x2, #4088]
 7bc:   b4000062        cbz     x2, 7c8 <register_tm_clones+0x38>
 7c0:   aa0203f0        mov     x16, x2
 7c4:   d61f0200        br      x16
 7c8:   d65f03c0        ret

00000000000007cc <__do_global_dtors_aux>:
 7cc:   d503233f        paciasp
 7d0:   a9be7bfd        stp     x29, x30, [sp, #-32]!
 7d4:   910003fd        mov     x29, sp
 7d8:   f9000bf3        str     x19, [sp, #16]
 7dc:   90000113        adrp    x19, 20000 <__data_start>
 7e0:   39401260        ldrb    w0, [x19, #4]
 7e4:   35000140        cbnz    w0, 80c <__do_global_dtors_aux+0x40>
 7e8:   f00000e0        adrp    x0, 1f000 <__FRAME_END__+0x1e6dc>
 7ec:   f947f000        ldr     x0, [x0, #4064]
 7f0:   b4000080        cbz     x0, 800 <__do_global_dtors_aux+0x34>
 7f4:   f00000e0        adrp    x0, 1f000 <__FRAME_END__+0x1e6dc>
 7f8:   91364000        add     x0, x0, #0xd90
 7fc:   97ffff9d        bl      670 <__cxa_finalize@plt>
 800:   97ffffd8        bl      760 <deregister_tm_clones>
 804:   52800020        mov     w0, #0x1                        // #1
 808:   39001260        strb    w0, [x19, #4]
 80c:   f9400bf3        ldr     x19, [sp, #16]
 810:   a8c27bfd        ldp     x29, x30, [sp], #32
 814:   d50323bf        autiasp
 818:   d65f03c0        ret
 81c:   d503201f        nop

0000000000000820 <frame_dummy>:
 820:   d503245f        bti     c
 824:   17ffffdb        b       790 <register_tm_clones>

Disassembly of section .fini:

0000000000000828 <_fini>:
 828:   d503233f        paciasp
 82c:   a9bf7bfd        stp     x29, x30, [sp, #-16]!
 830:   910003fd        mov     x29, sp
 834:   a8c17bfd        ldp     x29, x30, [sp], #16
 838:   d50323bf        autiasp
 83c:   d65f03c0        ret

Comment 7 Yupeng Chang 2021-12-28 08:19:47 UTC
It turned out that gaps-test before 10.34 was never started on my build.
It seems that gaps-test always fail on my AARCH64 cortex-a76 box.
My GCC generates the same binary as above, which causes annocheck fail on gaps-test

Comment 8 Nick Clifton 2022-01-04 11:57:58 UTC
(In reply to Yupeng Chang from comment #6)
Hi Yupeng,

> Hardened: main.exe: MAYB: test: notes because not all of the .text section
> is covered by notes 
> Hardened: main.exe: info: address range not covered: 6d0..760 (probable
> component: _start).

I assume that the _start() function comes from the C library start-up code ?

(The notes show that this code was created by GAS rather than GCC, but often
this means that in fact it was compiled by GCC, but it was compiled without
annobin notes, but with a special option to add a "built-by-GAS" note...)


> After I disassemble the test program main.exe, I found that 0x630 ~ 0x760
> covers ".annobin_abi_note.c.hot", "_start" and "call_weak_fn"
> .annobin_abi_note.c.hot section all contains "nop",
> _start section doesn't contain "nop"
> call_week_fn section only contains "nop" at the end of the secion.
> It seems that "annocheck" calculated wrong gap size.

No, I think that annocheck did calculate the correct gap size, but it
failed to realize that the code in the gap came from the C library start
up code, and hence that the gap could be ignored.

I can add a special check for the _start symbol, and have annocheck not
complain about such gaps.

Would you mind uploading your test binary so that I can check that my
change works ?

Cheers
  Nick

Comment 9 Yupeng Chang 2022-01-05 08:00:56 UTC
Created attachment 1848994 [details]
gaps-test binary

gaps-test binary
run command:
tar Jxvf gaps-test.tar.xz
to get the original gaps-test binary

Comment 10 Yupeng Chang 2022-01-05 08:03:10 UTC
(In reply to Nick Clifton from comment #8)
> (In reply to Yupeng Chang from comment #6)
> Hi Yupeng,
> 
> > Hardened: main.exe: MAYB: test: notes because not all of the .text section
> > is covered by notes 
> > Hardened: main.exe: info: address range not covered: 6d0..760 (probable
> > component: _start).
> 
> I assume that the _start() function comes from the C library start-up code ?
> 
> (The notes show that this code was created by GAS rather than GCC, but often
> this means that in fact it was compiled by GCC, but it was compiled without
> annobin notes, but with a special option to add a "built-by-GAS" note...)
> 
> 
> > After I disassemble the test program main.exe, I found that 0x630 ~ 0x760
> > covers ".annobin_abi_note.c.hot", "_start" and "call_weak_fn"
> > .annobin_abi_note.c.hot section all contains "nop",
> > _start section doesn't contain "nop"
> > call_week_fn section only contains "nop" at the end of the secion.
> > It seems that "annocheck" calculated wrong gap size.
> 
> No, I think that annocheck did calculate the correct gap size, but it
> failed to realize that the code in the gap came from the C library start
> up code, and hence that the gap could be ignored.
> 
> I can add a special check for the _start symbol, and have annocheck not
> complain about such gaps.
> 
> Would you mind uploading your test binary so that I can check that my
> change works ?
> 
> Cheers
>   Nick

Hi Nick,
Sorry for the late reply.
The gaps-test binary is attached in comment 9

@

Comment 11 Nick Clifton 2022-01-05 10:52:42 UTC
(In reply to Yupeng Chang from comment #10)
> The gaps-test binary is attached in comment 9

Thanks!  With that I was able to confirm that my patch works.  I will update rawhide today and the fix will make its way into RHEL-9 eventually.

Cheers
  Nick

Comment 13 errata-xmlrpc 2022-05-17 12:33:04 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: annobin), 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/RHEA-2022:2342