public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>,
	Joel Molin via Libc-help <libc-help@sourceware.org>,
	 Joel Molin <joelmolin@gmail.com>
Subject: Re: Why does _dl_protect_relro align the end address down?
Date: Tue, 17 Jan 2023 07:48:49 -0800	[thread overview]
Message-ID: <CAMe9rOpKL32vGGpjBuujXQNhVUmRo=0Do1D-kMb1jzATJmEtkQ@mail.gmail.com> (raw)
In-Reply-To: <b6e044b6-a364-bbea-ba35-ad25e9b5ef41@linaro.org>

On Tue, Jan 17, 2023 at 6:30 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 17/01/23 11:16, Florian Weimer wrote:
> > * Adhemerval Zanella Netto:
> >
> >> On 17/01/23 04:57, Florian Weimer via Libc-help wrote:
> >>> * Joel Molin via Libc-help:
> >>>
> >>>> Since mprotect will protect entire pages anyway, wouldn't it make a lot
> >>>> more sense here to say `end = ALIGN_UP(...)`? Apart from feeling more
> >>>> intuitive, it also seems like it would avoid page size inconsistencies
> >>>> between runtime and link editing like the one above.
> >>>
> >>> ALIGN_UP might make memory read-only that should not be.
> >>>
> >>> There's some discussion about the alignment here:
> >>>
> >>>   PT_GNU_RELRO is somewhat broken
> >>>   <https://sourceware.org/pipermail/libc-alpha/2022-May/138638.html>
> >>>
> >>> I still think this is fairly broken, but there does not seem to be much
> >>> desire to fix it.
> >>
> >> It was not clear to me from that discussion what you think it is still
> >> broken with PT_GNU_RELRO.
> >
> > Using ALIGN_DOWN for the start address can't be right.
> >
>
> Do we have a bug report for this? Because H.J explanation [1] only describes
> ld support for the end of the RO segment.
>
> [1] https://sourceware.org/pipermail/libc-alpha/2022-May/138642.html

If the end of the PT_GNU_RELRO segment isn't page aligned,
ALIGN_UP may change the executable page to read-only.

-- 
H.J.

  reply	other threads:[~2023-01-17 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 21:26 Joel Molin
2023-01-17  7:57 ` Florian Weimer
2023-01-17 14:11   ` Adhemerval Zanella Netto
2023-01-17 14:16     ` Florian Weimer
2023-01-17 14:30       ` Adhemerval Zanella Netto
2023-01-17 15:48         ` H.J. Lu [this message]
2023-01-17 15:56           ` Joel Molin

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='CAMe9rOpKL32vGGpjBuujXQNhVUmRo=0Do1D-kMb1jzATJmEtkQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=joelmolin@gmail.com \
    --cc=libc-help@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).