public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Align argument of __munmap to page size [BZ #28676]
@ 2021-12-13 15:20 H.J. Lu
  2021-12-14  2:49 ` Rongwei Wang
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2021-12-13 15:20 UTC (permalink / raw)
  To: libc-alpha

On Linux/x86-64, for elf/tst-align3, we now get

munmap(0x7f88f9401000, 1126424)         = 0

instead of

munmap(0x7f1615200018, 544768)          = -1 EINVAL (Invalid argument)
---
 elf/dl-map-segments.h | 1 +
 1 file changed, 1 insertion(+)

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);
-- 
2.33.1


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

end of thread, other threads:[~2021-12-14 15:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 15:20 [PATCH] elf: Align argument of __munmap to page size [BZ #28676] 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
2021-12-14 15:15           ` H.J. Lu

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).