From owner-svn-src-all@FreeBSD.ORG Thu Oct 13 18:25:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28A0B10657CE; Thu, 13 Oct 2011 18:25:11 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 173A08FC16; Thu, 13 Oct 2011 18:25:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9DIPA6K027208; Thu, 13 Oct 2011 18:25:10 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9DIPAJs027201; Thu, 13 Oct 2011 18:25:10 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201110131825.p9DIPAJs027201@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 13 Oct 2011 18:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226349 - head/sys/compat/freebsd32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Oct 2011 18:25:11 -0000 Author: marcel Date: Thu Oct 13 18:25:10 2011 New Revision: 226349 URL: http://svn.freebsd.org/changeset/base/226349 Log: 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 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_misc.c Thu Oct 13 18:25:10 2011 (r226349) @@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td #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; Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 13 18:25:10 2011 (r226349) @@ -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 *, 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 thr #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 Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Thu Oct 13 18:25:10 2011 (r226349) @@ -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 */ Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Oct 13 18:25:10 2011 (r226349) @@ -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 */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Thu Oct 13 18:25:10 2011 (r226349) @@ -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 */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Oct 13 18:21:11 2011 (r226348) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Oct 13 18:25:10 2011 (r226349) @@ -464,9 +464,9 @@ systrace_args(int sysnum, void *params, *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, break; }; break; - /* mprotect */ + /* freebsd32_mprotect */ case 74: switch(ndx) { case 0: