public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>,
	 Rongwei Wang <rongwei.wang@linux.alibaba.com>
Subject: Re: [PATCH] elf: Align argument of __munmap to page size [BZ #28676]
Date: Tue, 14 Dec 2021 15:24:39 +0100	[thread overview]
Message-ID: <877dc7qn6g.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOoDAHo5YFhpG9mgR3-MLbBcji7eo=k0qOgUmP_muit=+A@mail.gmail.com> (H. J. Lu's message of "Tue, 14 Dec 2021 05:48:36 -0800")

* H. J. Lu:

> On Mon, Dec 13, 2021 at 11:40 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>>
>> > On Mon, Dec 13, 2021 at 6:49 PM Rongwei Wang
>> > <rongwei.wang@linux.alibaba.com> wrote:
>> >>
>> >> Hi, HJ
>> >>
>> >> Thanks for your help to fix this bug. And I just found out that the
>> >> patch "elf: Properly align PT_LOAD segments" had been merged into
>> >> glibc/master.
>> >>
>> >> And I saw Florian's email:
>> >>
>> >>  > We should check munmap failure though and rollback everything if
>> >>  > necessary.  It's possible we can undo the initial PROT_NONE mapping even
>> >>  > if future munmap calls fail because unmapping the first mapping does not
>> >>  > need to split a mapping.
>> >>
>> >> It seems rollback initial PROT_NONE mapping when munmap fails is good
>> >> idea. Nice to have. Of course, IMO, this your patch is also can fix this
>> >> munmap failure well. what do you think?
>> >>
>> >> When this fix is stable in glibc upstream, I will backport it into our
>> >> internal glibc repo. So, if you have any improve this fix suggestions, I
>> >> will respond immediately. Sorry for my speed is much slower than your.
>> >>
>> >>
>> >
>> > Let's wait for a few days.
>>
>> Can we please fix the regression in some way?  It impacts development,
>> particularly at this late stage during the 2.34 cycle.
>>
>> Either revert the change, or at least add the unchecked __munmap, and
>> fix that later.
>
> What is the unchecked __munmap?

The __munmap at the end:

diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
index 70a4c40695..54e606aa87 100644
--- a/elf/dl-map-segments.h
+++ b/elf/dl-map-segments.h
@@ -55,6 +55,7 @@ _dl_map_segment (const struct loadcmd *c, ElfW(Addr) mappref,
       if (delta)
 	__munmap ((void *) map_start, delta);
       ElfW(Addr) map_end = map_start_aligned + maplength;
+      map_end = ALIGN_UP (map_end, GLRO(dl_pagesize));
       delta = map_start + maplen - map_end;
       if (delta)
 	__munmap ((void *) map_end, delta);

Thanks,
Florian


  reply	other threads:[~2021-12-14 14:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 15:20 H.J. Lu
2021-12-14  2:49 ` Rongwei Wang
2021-12-14  3:34   ` H.J. Lu
2021-12-14  7:40     ` Florian Weimer
2021-12-14 13:48       ` H.J. Lu
2021-12-14 14:24         ` Florian Weimer [this message]
2021-12-14 15:15           ` H.J. Lu

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=877dc7qn6g.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=rongwei.wang@linux.alibaba.com \
    /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).