summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2011-10-13 18:25:10 +0000
committermarcel <marcel@FreeBSD.org>2011-10-13 18:25:10 +0000
commit9d926ddf66d0bdefacfd2f642dd15d42f3a2194b (patch)
treee0bcb891d2dcbc4edfe9624ada0632fd829643d0 /sys/compat
parent86b6ac698de529d3992fcb46e432db182beadf5c (diff)
downloadFreeBSD-src-9d926ddf66d0bdefacfd2f642dd15d42f3a2194b.zip
FreeBSD-src-9d926ddf66d0bdefacfd2f642dd15d42f3a2194b.tar.gz
Wrap mprotect(2) so that we can add execute permissions when read
permissions are requested. This is needed on amd64 and ia64 for JDK 1.4.x
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c15
-rw-r--r--sys/compat/freebsd32/freebsd32_proto.h9
-rw-r--r--sys/compat/freebsd32/freebsd32_syscall.h4
-rw-r--r--sys/compat/freebsd32/freebsd32_syscalls.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_sysent.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_systrace_args.c6
6 files changed, 32 insertions, 10 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index ae80ef2..feb4d81 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end,
#endif
int
+freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap)
+{
+ struct mprotect_args ap;
+
+ ap.addr = (void *)(uintptr_t)uap->addr;
+ ap.len = uap->len;
+ ap.prot = uap->prot;
+#if defined(__amd64__) || defined(__ia64__)
+ if (ap.prot & PROT_READ)
+ ap.prot |= PROT_EXEC;
+#endif
+ return (sys_mprotect(td, &ap));
+}
+
+int
freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
{
struct mmap_args ap;
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 335f64c..3fce6d8 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 2011-10-13 18:21:11Z marcel
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -76,6 +76,11 @@ struct freebsd32_execve_args {
char argv_l_[PADL_(u_int32_t *)]; u_int32_t * argv; char argv_r_[PADR_(u_int32_t *)];
char envv_l_[PADL_(u_int32_t *)]; u_int32_t * envv; char envv_r_[PADR_(u_int32_t *)];
};
+struct freebsd32_mprotect_args {
+ char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+};
struct freebsd32_setitimer_args {
char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];
char itv_l_[PADL_(struct itimerval32 *)]; struct itimerval32 * itv; char itv_r_[PADR_(struct itimerval32 *)];
@@ -585,6 +590,7 @@ int freebsd32_recvfrom(struct thread *, struct freebsd32_recvfrom_args *);
int freebsd32_sigaltstack(struct thread *, struct freebsd32_sigaltstack_args *);
int freebsd32_ioctl(struct thread *, struct freebsd32_ioctl_args *);
int freebsd32_execve(struct thread *, struct freebsd32_execve_args *);
+int freebsd32_mprotect(struct thread *, struct freebsd32_mprotect_args *);
int freebsd32_setitimer(struct thread *, struct freebsd32_setitimer_args *);
int freebsd32_getitimer(struct thread *, struct freebsd32_getitimer_args *);
int freebsd32_select(struct thread *, struct freebsd32_select_args *);
@@ -943,6 +949,7 @@ int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_
#define FREEBSD32_SYS_AUE_freebsd32_execve AUE_EXECVE
#define FREEBSD32_SYS_AUE_ofreebsd32_fstat AUE_FSTAT
#define FREEBSD32_SYS_AUE_ofreebsd32_getpagesize AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_mprotect AUE_MPROTECT
#define FREEBSD32_SYS_AUE_freebsd32_setitimer AUE_SETITIMER
#define FREEBSD32_SYS_AUE_freebsd32_getitimer AUE_GETITIMER
#define FREEBSD32_SYS_AUE_freebsd32_select AUE_SELECT
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index b74f38f..c0e2ed2 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 2011-10-13 18:21:11Z marcel
*/
#define FREEBSD32_SYS_syscall 0
@@ -80,7 +80,7 @@
/* 71 is obsolete ommap */
#define FREEBSD32_SYS_vadvise 72
#define FREEBSD32_SYS_munmap 73
-#define FREEBSD32_SYS_mprotect 74
+#define FREEBSD32_SYS_freebsd32_mprotect 74
#define FREEBSD32_SYS_madvise 75
/* 76 is obsolete vhangup */
/* 77 is obsolete vlimit */
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index 4411943..d5ed1c5 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 2011-10-13 18:21:11Z marcel
*/
const char *freebsd32_syscallnames[] = {
@@ -84,7 +84,7 @@ const char *freebsd32_syscallnames[] = {
"obs_ommap", /* 71 = obsolete ommap */
"vadvise", /* 72 = vadvise */
"munmap", /* 73 = munmap */
- "mprotect", /* 74 = mprotect */
+ "freebsd32_mprotect", /* 74 = freebsd32_mprotect */
"madvise", /* 75 = madvise */
"obs_vhangup", /* 76 = obsolete vhangup */
"obs_vlimit", /* 77 = obsolete vlimit */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 426ecb1..43297e1 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 2011-10-13 18:21:11Z marcel
*/
#include "opt_compat.h"
@@ -121,7 +121,7 @@ struct sysent freebsd32_sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 71 = obsolete ommap */
{ AS(ovadvise_args), (sy_call_t *)sys_ovadvise, AUE_O_VADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 72 = vadvise */
{ AS(munmap_args), (sy_call_t *)sys_munmap, AUE_MUNMAP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 73 = munmap */
- { AS(mprotect_args), (sy_call_t *)sys_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 74 = mprotect */
+ { AS(freebsd32_mprotect_args), (sy_call_t *)freebsd32_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 74 = freebsd32_mprotect */
{ AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 75 = madvise */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 76 = obsolete vhangup */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 77 = obsolete vlimit */
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 39b66fd..11959e9 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -464,9 +464,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
*n_args = 2;
break;
}
- /* mprotect */
+ /* freebsd32_mprotect */
case 74: {
- struct mprotect_args *p = params;
+ struct freebsd32_mprotect_args *p = params;
uarg[0] = (intptr_t) p->addr; /* const void * */
uarg[1] = p->len; /* size_t */
iarg[2] = p->prot; /* int */
@@ -3737,7 +3737,7 @@ systrace_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
break;
};
break;
- /* mprotect */
+ /* freebsd32_mprotect */
case 74:
switch(ndx) {
case 0:
OpenPOWER on IntegriCloud