]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix coredump_phnum test with ASLR enabled by default
authorEd Maste <emaste@FreeBSD.org>
Sun, 21 Nov 2021 17:17:20 +0000 (12:17 -0500)
committerEd Maste <emaste@FreeBSD.org>
Sun, 21 Nov 2021 17:57:38 +0000 (12:57 -0500)
commit8ec4c5dae32765701ac70811455084efd1570c32
tree8a6a9af84dd4c06d62fb6c9a61c6cfb58e2e1b28
parent77e3db07898461de458caece30f42adceff222a9
Fix coredump_phnum test with ASLR enabled by default

coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR: 259970
Reported by: lwhsu, mw
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33070
tests/sys/kern/coredump_phnum_helper.c