public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned
@ 2020-12-01 11:46 nsz at gcc dot gnu.org
  2020-12-01 12:10 ` [Bug dynamic-link/26988] " nsz at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nsz at gcc dot gnu.org @ 2020-12-01 11:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26988

            Bug ID: 26988
           Summary: aarch64: BTI mprotect address is not page aligned
           Product: glibc
           Version: 2.32
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

bti enabled glibc does not handle elf binaries correctly
that have an executable load segment with virtual address
that is not page aligned.

mprotect fails, which is currently treated as fatal error.

i think the bfd linker does not produce such binaries,
but lld does that by default, typical exe layout:

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  PHDR           0x000040 0x0000000000200040 0x0000000000200040 0x0002d8
0x0002d8 R   0x8
  INTERP         0x000318 0x0000000000200318 0x0000000000200318 0x00001b
0x00001b R   0x1
      [Requesting program interpreter: /lib/ld-linux-aarch64.so.1]
  LOAD           0x000000 0x0000000000200000 0x0000000000200000 0x000704
0x000704 R   0x10000
  LOAD           0x000710 0x0000000000210710 0x0000000000210710 0x000290
0x000290 R E 0x10000
  LOAD           0x0009a0 0x00000000002209a0 0x00000000002209a0 0x0001c8
0x0001c8 RW  0x10000
  LOAD           0x000b68 0x0000000000230b68 0x0000000000230b68 0x000048
0x000049 RW  0x10000
  DYNAMIC        0x0009b0 0x00000000002209b0 0x00000000002209b0 0x0001b0
0x0001b0 RW  0x8
  GNU_RELRO      0x0009a0 0x00000000002209a0 0x00000000002209a0 0x0001c8
0x000660 R   0x1
  GNU_EH_FRAME   0x0005bc 0x00000000002005bc 0x00000000002005bc 0x000044
0x000044 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0
  GNU_PROPERTY   0x000358 0x0000000000200358 0x0000000000200358 0x000020
0x000020 R   0x8
  NOTE           0x000334 0x0000000000200334 0x0000000000200334 0x000020
0x000020 R   0x4
  NOTE           0x000358 0x0000000000200358 0x0000000000200358 0x000020
0x000020 R   0x8

(i.e. the readonly program headers and notes are not covered by the
executable load segment and there is no page alignment either:
with bfd linker either program headers are covered or executable
segment has an alignment gap.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/26988] aarch64: BTI mprotect address is not page aligned
  2020-12-01 11:46 [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned nsz at gcc dot gnu.org
@ 2020-12-01 12:10 ` nsz at gcc dot gnu.org
  2020-12-11 15:19 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nsz at gcc dot gnu.org @ 2020-12-01 12:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26988

Szabolcs Nagy <nsz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |nsz at gcc dot gnu.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/26988] aarch64: BTI mprotect address is not page aligned
  2020-12-01 11:46 [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned nsz at gcc dot gnu.org
  2020-12-01 12:10 ` [Bug dynamic-link/26988] " nsz at gcc dot gnu.org
@ 2020-12-11 15:19 ` cvs-commit at gcc dot gnu.org
  2020-12-11 15:58 ` nsz at gcc dot gnu.org
  2021-01-21 10:43 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-11 15:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26988

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Szabolcs Nagy <nsz@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8b8f616e6a594b91d0afb152384bf2a9f72b7288

commit 8b8f616e6a594b91d0afb152384bf2a9f72b7288
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Dec 1 10:12:32 2020 +0000

    aarch64: align address for BTI protection [BZ #26988]

    Handle unaligned executable load segments (the bfd linker is not
    expected to produce such binaries, but other linkers may).

    Computing the mapping bounds follows _dl_map_object_from_fd more
    closely now.

    Fixes bug 26988.

    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/26988] aarch64: BTI mprotect address is not page aligned
  2020-12-01 11:46 [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned nsz at gcc dot gnu.org
  2020-12-01 12:10 ` [Bug dynamic-link/26988] " nsz at gcc dot gnu.org
  2020-12-11 15:19 ` cvs-commit at gcc dot gnu.org
@ 2020-12-11 15:58 ` nsz at gcc dot gnu.org
  2021-01-21 10:43 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nsz at gcc dot gnu.org @ 2020-12-11 15:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26988

Szabolcs Nagy <nsz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.33
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Szabolcs Nagy <nsz at gcc dot gnu.org> ---
fixed for 2.33, needs backport

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/26988] aarch64: BTI mprotect address is not page aligned
  2020-12-01 11:46 [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned nsz at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-12-11 15:58 ` nsz at gcc dot gnu.org
@ 2021-01-21 10:43 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-21 10:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26988

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.32/master branch has been updated by Szabolcs Nagy
<nsz@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c6090dcebd1fc2a39a95b6fd420e072a2039a81b

commit c6090dcebd1fc2a39a95b6fd420e072a2039a81b
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Dec 1 10:12:32 2020 +0000

    aarch64: align address for BTI protection [BZ #26988]

    Handle unaligned executable load segments (the bfd linker is not
    expected to produce such binaries, but other linkers may).

    Computing the mapping bounds follows _dl_map_object_from_fd more
    closely now.

    Fixes bug 26988.

    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
    (cherry picked from commit 8b8f616e6a594b91d0afb152384bf2a9f72b7288)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-21 10:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 11:46 [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned nsz at gcc dot gnu.org
2020-12-01 12:10 ` [Bug dynamic-link/26988] " nsz at gcc dot gnu.org
2020-12-11 15:19 ` cvs-commit at gcc dot gnu.org
2020-12-11 15:58 ` nsz at gcc dot gnu.org
2021-01-21 10:43 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).