public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kaleshsingh at google dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/31076] Extra struct vm_area_struct with ---p created when PAGE_SIZE < max-page-size
Date: Tue, 28 Nov 2023 18:59:33 +0000	[thread overview]
Message-ID: <bug-31076-131-NSHiYNmER6@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31076-131@http.sourceware.org/bugzilla/>

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

--- Comment #15 from Kalesh Singh <kaleshsingh at google dot com> ---
(In reply to Adhemerval Zanella from comment #9)
> (In reply to Florian Weimer from comment #8)
> > (In reply to Adhemerval Zanella from comment #7)
> > > So the mprotect is essentially a hardening feature, assuming that the
> > > dynamic object padding/holes might contain gadgets.  It still does not
> > > happen for loader and main program itself, since normally they would be
> > > mapped by the kernel and its does do anything with holes,
> > 
> > There's no expectation that these are contiguous in memory, yes. Such an
> > expectation exists for shared objects loaded by glibc.
> 
> Right, but my point is if this is a hardening feature that glibc aims to
> provide it does not help if the kernel still does not provide it for the
> loader (if this is built with a different page size) and the main program
> itself. Should we push for kernel to implement a similar handling?
> 
> And the holes seem to be always from the initial read-only segment, which
> makes the whole gadget avoidance argument moot. This would make sense back
> when RELRO was not wildly used/deployed (even with the current somewhat
> broken status), but it still does not make much sense to me.
> 
> > 
> > > and IMHO it should
> > > up to the static linker to fill the padding with NOP/trap instruction to
> > > avoid such issues. 


Hi folks,

I was wondering if this is really a security feature or rather a result of how
the original VA space is reserved (split VMAs from the original mapping).

AIUI if the runtime-page-size equals the max-page-size, the holes are also
mapped in as part of the segment mapping and share the same permissions. Does
this mean that on such systems, any protection it offers becomes void?

Sorry if dumb questions (I'm not too familiar with this area)

Thanks,
Kalesh


> > 
> > That requires padding to the maximum page size on disk, though.
> 
> But this is what binutils does [1], and while not being optimized it seems
> that it would be somewhat hard to fix it (at least with Fangrui Song
> suggestion).
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=30612

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

  parent reply	other threads:[~2023-11-28 18:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 18:48 [Bug dynamic-link/31076] New: " jyescas at google dot com
2023-11-18 18:50 ` [Bug dynamic-link/31076] " jyescas at google dot com
2023-11-21 13:42 ` carlos at redhat dot com
2023-11-22  0:39 ` i at maskray dot me
2023-11-22  4:33 ` kaleshsingh at google dot com
2023-11-22 18:19 ` jyescas at google dot com
2023-11-23 11:42 ` sam at gentoo dot org
2023-11-24 17:40 ` adhemerval.zanella at linaro dot org
2023-11-27 15:11 ` fweimer at redhat dot com
2023-11-27 15:22 ` fweimer at redhat dot com
2023-11-27 16:27 ` adhemerval.zanella at linaro dot org
2023-11-27 17:19 ` fweimer at redhat dot com
2023-11-27 17:39 ` adhemerval.zanella at linaro dot org
2023-11-27 17:45 ` fweimer at redhat dot com
2023-11-27 17:58 ` adhemerval.zanella at linaro dot org
2023-11-27 19:47 ` jyescas at google dot com
2023-11-27 19:55 ` jyescas at google dot com
2023-11-28  8:48 ` rprichard at google dot com
2023-11-28 18:59 ` kaleshsingh at google dot com [this message]
2023-11-28 23:58 ` jyescas at google dot com
2023-12-02 17:08 ` i at maskray dot me
2023-12-06 11:57 ` fweimer at redhat dot com
2023-12-07  5:11 ` i at maskray dot me
2023-12-07  9:30 ` fweimer at redhat dot com
2023-12-08  3:22 ` i at maskray dot me

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-31076-131-NSHiYNmER6@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).