PERFORCE change 113546 for review
Jung-uk Kim
jkim at FreeBSD.org
Fri Jan 26 05:01:12 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113546
Change 113546 by jkim at jkim_hammer on 2007/01/26 05:00:44
Stop mimicking Linux mmap behavior and use Linux/ia64 wisdom.
Many Linux/i386 distros have shown different mmap behaviors.
Affected files ...
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#29 edit
.. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#23 edit
Differences ...
==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#29 (text+ko) ====
@@ -852,12 +852,14 @@
bsd_args.flags |= MAP_STACK;
/*
- * Linux has added READ_IMPLIES_EXEC personality but we do not support
- * the feature yet. We just assume READ_IMPLIES_EXEC is always on.
+ * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
+ * on Linux/i386. We do this to ensure maximum compatibility.
+ * Linux/ia64 does the same in i386 emulation mode.
*/
bsd_args.prot = linux_args->prot;
- if (bsd_args.prot & PROT_READ)
- bsd_args.prot |= PROT_EXEC;
+ if ((bsd_args.prot & PROT_WRITE) ||
+ (bsd_args.prot & (PROT_READ | PROT_EXEC)))
+ bsd_args.prot |= PROT_READ | PROT_EXEC;
if (linux_args->fd != -1) {
/*
@@ -977,9 +979,9 @@
bsd_args.addr = uap->addr;
bsd_args.len = uap->len;
bsd_args.prot = uap->prot;
- /* XXX PROT_READ implies PROT_EXEC; see linux_mmap_common(). */
- if (bsd_args.prot & PROT_READ)
- bsd_args.prot |= PROT_EXEC;
+ if ((bsd_args.prot & PROT_WRITE) ||
+ (bsd_args.prot & (PROT_READ | PROT_EXEC)))
+ bsd_args.prot |= PROT_READ | PROT_EXEC;
return (mprotect(td, &bsd_args));
}
==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#23 (text+ko) ====
@@ -653,12 +653,14 @@
bsd_args.flags |= MAP_STACK;
/*
- * Linux has added READ_IMPLIES_EXEC personality but we do not support
- * the feature yet. We just assume READ_IMPLIES_EXEC is always on.
+ * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
+ * on Linux/i386. We do this to ensure maximum compatibility.
+ * Linux/ia64 does the same in i386 emulation mode.
*/
bsd_args.prot = linux_args->prot;
- if (bsd_args.prot & PROT_READ)
- bsd_args.prot |= PROT_EXEC;
+ if ((bsd_args.prot & PROT_WRITE) ||
+ (bsd_args.prot & (PROT_READ | PROT_EXEC)))
+ bsd_args.prot |= PROT_READ | PROT_EXEC;
if (linux_args->fd != -1) {
/*
@@ -778,9 +780,9 @@
bsd_args.addr = uap->addr;
bsd_args.len = uap->len;
bsd_args.prot = uap->prot;
- /* XXX PROT_READ implies PROT_EXEC; see linux_mmap_common(). */
- if (bsd_args.prot & PROT_READ)
- bsd_args.prot |= PROT_EXEC;
+ if ((bsd_args.prot & PROT_WRITE) ||
+ (bsd_args.prot & (PROT_READ | PROT_EXEC)))
+ bsd_args.prot |= PROT_READ | PROT_EXEC;
return (mprotect(td, &bsd_args));
}
More information about the p4-projects
mailing list