Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103015144
D41435.id125930.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D41435.id125930.diff
View Options
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2
--- a/lib/libc/sys/mmap.2
+++ b/lib/libc/sys/mmap.2
@@ -28,7 +28,7 @@
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
.\" $FreeBSD$
.\"
-.Dd December 24, 2020
+.Dd August 14, 2023
.Dt MMAP 2
.Os
.Sh NAME
@@ -145,7 +145,6 @@
If a suitable region cannot be found,
.Fn mmap
will fail.
-This flag is only available on 64-bit platforms.
.It Dv MAP_ALIGNED Ns Pq Fa n
Align the region on a requested boundary.
If a suitable region cannot be found,
diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c
--- a/lib/libsysdecode/flags.c
+++ b/lib/libsysdecode/flags.c
@@ -913,20 +913,11 @@
/*
* MAP_ALIGNED can't be handled directly by print_mask_int().
- * MAP_32BIT is also problematic since it isn't defined for
- * all platforms.
*/
printed = false;
align = flags & MAP_ALIGNMENT_MASK;
val = (unsigned)flags & ~MAP_ALIGNMENT_MASK;
print_mask_part(fp, mmapflags, &val, &printed);
-#ifdef MAP_32BIT
- if (val & MAP_32BIT) {
- fprintf(fp, "%sMAP_32BIT", printed ? "|" : "");
- printed = true;
- val &= ~MAP_32BIT;
- }
-#endif
if (align != 0) {
if (printed)
fputc('|', fp);
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -1549,11 +1549,7 @@
/* MAP_PRIVATE is disabled */
if ((flags & ~(MAP_SHARED | MAP_FIXED | MAP_EXCL |
- MAP_NOCORE |
-#ifdef MAP_32BIT
- MAP_32BIT |
-#endif
- MAP_ALIGNMENT_MASK)) != 0)
+ MAP_NOCORE | MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)
return (EINVAL);
vms = td->td_proc->p_vmspace;
@@ -1573,10 +1569,8 @@
if ((foff & mask) != 0)
return (EINVAL);
maxaddr = vm_map_max(map);
-#ifdef MAP_32BIT
if ((flags & MAP_32BIT) != 0 && maxaddr > MAP_32BIT_MAX_ADDR)
maxaddr = MAP_32BIT_MAX_ADDR;
-#endif
if (size == 0 || (size & mask) != 0 ||
(*addr != 0 && ((*addr & mask) != 0 ||
*addr + size < *addr || *addr + size > maxaddr)))
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -104,9 +104,7 @@
#define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
-#ifdef __LP64__
#define MAP_32BIT 0x00080000 /* map in the low 2GB of address space */
-#endif
/*
* Request specific alignment (n == log2 of the desired alignment).
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -272,11 +272,7 @@
}
if ((flags & ~(MAP_SHARED | MAP_PRIVATE | MAP_FIXED | MAP_HASSEMAPHORE |
MAP_STACK | MAP_NOSYNC | MAP_ANON | MAP_EXCL | MAP_NOCORE |
- MAP_PREFAULT_READ | MAP_GUARD |
-#ifdef MAP_32BIT
- MAP_32BIT |
-#endif
- MAP_ALIGNMENT_MASK)) != 0)
+ MAP_PREFAULT_READ | MAP_GUARD | MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0)
return (EINVAL);
if ((flags & (MAP_EXCL | MAP_FIXED)) == MAP_EXCL)
return (EINVAL);
@@ -287,10 +283,7 @@
return (EINVAL);
if ((flags & MAP_GUARD) != 0 && (prot != PROT_NONE || fd != -1 ||
pos != 0 || (flags & ~(MAP_FIXED | MAP_GUARD | MAP_EXCL |
-#ifdef MAP_32BIT
- MAP_32BIT |
-#endif
- MAP_ALIGNMENT_MASK)) != 0))
+ MAP_32BIT | MAP_ALIGNMENT_MASK)) != 0))
return (EINVAL);
/*
@@ -331,7 +324,6 @@
/* Address range must be all in user VM space. */
if (!vm_map_range_valid(&vms->vm_map, addr, addr + size))
return (EINVAL);
-#ifdef MAP_32BIT
if (flags & MAP_32BIT && addr + size > MAP_32BIT_MAX_ADDR)
return (EINVAL);
} else if (flags & MAP_32BIT) {
@@ -342,7 +334,6 @@
*/
if (addr + size > MAP_32BIT_MAX_ADDR)
addr = 0;
-#endif
} else {
/*
* XXX for non-fixed mappings where no hint is provided or
@@ -1621,18 +1612,15 @@
else
findspace = VMFS_OPTIMAL_SPACE;
max_addr = 0;
-#ifdef MAP_32BIT
if ((flags & MAP_32BIT) != 0)
max_addr = MAP_32BIT_MAX_ADDR;
-#endif
if (curmap) {
- default_addr =
- round_page((vm_offset_t)td->td_proc->p_vmspace->
- vm_daddr + lim_max(td, RLIMIT_DATA));
-#ifdef MAP_32BIT
- if ((flags & MAP_32BIT) != 0)
+ if (__predict_true((flags & MAP_32BIT) == 0))
+ default_addr =
+ round_page((vm_offset_t)td->td_proc->p_vmspace->
+ vm_daddr + lim_max(td, RLIMIT_DATA));
+ else
default_addr = 0;
-#endif
rv = vm_map_find_min(map, object, foff, addr, size,
default_addr, max_addr, findspace, prot, maxprot,
docow);
diff --git a/tests/sys/vm/Makefile b/tests/sys/vm/Makefile
--- a/tests/sys/vm/Makefile
+++ b/tests/sys/vm/Makefile
@@ -9,14 +9,9 @@
page_fault_signal \
shared_shadow_inval_test
-.if ${MACHINE_ARCH} != "i386" && ${MACHINE} != "arm" && \
- (${MACHINE} != "powerpc" || (${MACHINE_ARCH} != "powerpc" && \
- ${MACHINE_ARCH} != "powerpcspe"))
- # MAP_32BIT is only available on 64-bit platforms
BINDIR= ${TESTSDIR}
ATF_TESTS_SH+= mmap_map_32bit_test
PROGS+= mmap_map_32bit_helper
-.endif
SUBDIR= soxstack
TESTS_SUBDIRS+= stack
diff --git a/tests/sys/vm/mmap_map_32bit_helper.c b/tests/sys/vm/mmap_map_32bit_helper.c
--- a/tests/sys/vm/mmap_map_32bit_helper.c
+++ b/tests/sys/vm/mmap_map_32bit_helper.c
@@ -11,7 +11,6 @@
#include <stdlib.h>
#include <unistd.h>
-_Static_assert(sizeof(vm_offset_t) >= 8, "Test is not intended for ILP32");
#define MAP_32BIT_MAX_ADDR ((vm_offset_t)1 << 31)
int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 8:38 PM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14746822
Default Alt Text
D41435.id125930.diff (5 KB)
Attached To
Mode
D41435: vm: Allow MAP_32BIT for all architectures
Attached
Detach File
Event Timeline
Log In to Comment