Page MenuHomeFreeBSD

D33070.id98798.diff
No OneTemporary

D33070.id98798.diff

Index: tests/sys/kern/coredump_phnum_helper.c
===================================================================
--- tests/sys/kern/coredump_phnum_helper.c
+++ tests/sys/kern/coredump_phnum_helper.c
@@ -42,18 +42,19 @@
main(int argc __unused, char **argv __unused)
{
void *v;
- unsigned i;
+ size_t i, pages;
- for (i = 0; i < UINT16_MAX + 1000; i++) {
+ pages = UINT16_MAX + 1000;
+ if (posix_memalign(&v, PAGE_SIZE, pages * PAGE_SIZE) != 0)
+ err(1, "posix_memalign");
+ for (i = 0; i < pages; i += 2) {
/*
- * Alternate protections; otherwise the kernel will just extend
- * the adjacent same-protection previous mapping.
+ * Alternate protections to interleave RW and R PT_LOAD
+ * segments.
*/
- v = mmap(NULL, PAGE_SIZE,
- (((i % 2) == 0) ? PROT_READ : 0) | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- if (v == MAP_FAILED)
- err(1, "mmap");
+ if (mprotect((char *)v + (i + 1) * PAGE_SIZE, PAGE_SIZE,
+ PROT_READ) != 0)
+ err(1, "mprotect");
}
/* Dump core. */

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 2:25 AM (20 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28526027
Default Alt Text
D33070.id98798.diff (1021 B)

Event Timeline