public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nsz at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/26988] New: aarch64: BTI mprotect address is not page aligned
Date: Tue, 01 Dec 2020 11:46:06 +0000	[thread overview]
Message-ID: <bug-26988-131@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2020-12-01 11:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 11:46 nsz at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26988-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).