Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109282833
D46954.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D46954.diff
View Options
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
--- a/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
@@ -103,9 +103,7 @@
unsigned long vmin = 0;
size_t len = sizeof(vmin);
#endif
-#if !defined(__aarch64__) && !defined(__riscv)
void *invalid_ptr;
-#endif
void *buf;
#ifdef __FreeBSD__
@@ -159,13 +157,14 @@
#endif
(void)free(buf);
-/* There is no sbrk on AArch64 and RISC-V */
-#if !defined(__aarch64__) && !defined(__riscv)
/*
- * Try to create a pointer to an unmapped page - first after current
- * brk will likely do.
+ * Try to create a pointer to an unmapped page - mmap and then
+ * munmap a page.
*/
- invalid_ptr = (void*)(((uintptr_t)sbrk(0)+page) & ~(page-1));
+ invalid_ptr = mmap(NULL, page, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ ATF_REQUIRE(invalid_ptr != MAP_FAILED);
+ ATF_REQUIRE(munmap(invalid_ptr, page) == 0);
printf("testing with (hopefully) invalid pointer %p\n", invalid_ptr);
errno = 0;
@@ -173,7 +172,6 @@
errno = 0;
ATF_REQUIRE_ERRNO(ENOMEM, munlock(invalid_ptr, page) == -1);
-#endif
}
#ifdef __FreeBSD__
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 12:45 AM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16445490
Default Alt Text
D46954.diff (1 KB)
Attached To
Mode
D46954: mlock_test: use mmap/munmap for unmapped pointer
Attached
Detach File
Event Timeline
Log In to Comment