Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 02:08:07PM +0200, Paul Irofti wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? maybe, but your timing is wrong, we're in ABI lock. -Otto Index: linux_misc.c === RCS file: /cvs/src/sys/compat/linux/linux_misc.c,v retrieving revision 1.65 diff -u -p -r1.65 linux_misc.c --- linux_misc.c 26 Jul 2010 01:56:27 - 1.65 +++ linux_misc.c 7 Feb 2011 10:13:38 - @@ -1474,3 +1474,13 @@ linux_sys_sysinfo(p, v, retval) return (copyout(si, SCARG(uap, sysinfo), sizeof(si))); } + +int +linux_sys_mprotect(struct proc *p, void *v, register_t *retval) +{ + struct sys_mprotect_args *uap = v; + + if (SCARG(uap, prot) (PROT_READ | PROT_WRITE | PROT_EXEC)) + SCARG(uap, prot) |= PROT_READ | PROT_EXEC; + return (sys_mprotect(p, uap, retval)); +} Index: syscalls.master === RCS file: /cvs/src/sys/compat/linux/syscalls.master,v retrieving revision 1.51 diff -u -p -r1.51 syscalls.master --- syscalls.master 30 Jun 2010 21:54:12 - 1.51 +++ syscalls.master 7 Feb 2011 10:13:39 - @@ -223,7 +223,7 @@ 123 STD { int linux_sys_modify_ldt(void); } #endif 124 STD { int linux_sys_adjtimex(void); } -125 NOARGS { int sys_mprotect(caddr_t addr, int len, int prot); } +125 STD { int linux_sys_mprotect(caddr_t addr, int len, int prot); } 126 STD { int linux_sys_sigprocmask(int how, \ linux_old_sigset_t *set, linux_old_sigset_t *oset); } 127 STD { int linux_sys_create_module(void); }
Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 01:15:37PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:08:07PM +0200, Paul Irofti wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? maybe, but your timing is wrong, we're in ABI lock. Hmm... well I guessed if the timing syscalls could go in so could this one. I don't see a difference. -Otto Index: linux_misc.c === RCS file: /cvs/src/sys/compat/linux/linux_misc.c,v retrieving revision 1.65 diff -u -p -r1.65 linux_misc.c --- linux_misc.c26 Jul 2010 01:56:27 - 1.65 +++ linux_misc.c7 Feb 2011 10:13:38 - @@ -1474,3 +1474,13 @@ linux_sys_sysinfo(p, v, retval) return (copyout(si, SCARG(uap, sysinfo), sizeof(si))); } + +int +linux_sys_mprotect(struct proc *p, void *v, register_t *retval) +{ + struct sys_mprotect_args *uap = v; + + if (SCARG(uap, prot) (PROT_READ | PROT_WRITE | PROT_EXEC)) + SCARG(uap, prot) |= PROT_READ | PROT_EXEC; + return (sys_mprotect(p, uap, retval)); +} Index: syscalls.master === RCS file: /cvs/src/sys/compat/linux/syscalls.master,v retrieving revision 1.51 diff -u -p -r1.51 syscalls.master --- syscalls.master 30 Jun 2010 21:54:12 - 1.51 +++ syscalls.master 7 Feb 2011 10:13:39 - @@ -223,7 +223,7 @@ 123STD { int linux_sys_modify_ldt(void); } #endif 124STD { int linux_sys_adjtimex(void); } -125NOARGS { int sys_mprotect(caddr_t addr, int len, int prot); } +125STD { int linux_sys_mprotect(caddr_t addr, int len, int prot); } 126STD { int linux_sys_sigprocmask(int how, \ linux_old_sigset_t *set, linux_old_sigset_t *oset); } 127STD { int linux_sys_create_module(void); }
Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 02:45:31PM +0200, Paul Irofti wrote: On Thu, Feb 10, 2011 at 01:15:37PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:08:07PM +0200, Paul Irofti wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? maybe, but your timing is wrong, we're in ABI lock. Hmm... well I guessed if the timing syscalls could go in so could this one. I don't see a difference. OK, if miod is ok with that, I'm ok too. -Otto
Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 01:53:21PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:45:31PM +0200, Paul Irofti wrote: On Thu, Feb 10, 2011 at 01:15:37PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:08:07PM +0200, Paul Irofti wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? maybe, but your timing is wrong, we're in ABI lock. Hmm... well I guessed if the timing syscalls could go in so could this one. I don't see a difference. OK, if miod is ok with that, I'm ok too. Miod asked me to post it here because he was unsure about always marking it PROT_EXEC. Is that okay with you?
Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 02:58:31PM +0200, Paul Irofti wrote: On Thu, Feb 10, 2011 at 01:53:21PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:45:31PM +0200, Paul Irofti wrote: On Thu, Feb 10, 2011 at 01:15:37PM +0100, Otto Moerbeek wrote: On Thu, Feb 10, 2011 at 02:08:07PM +0200, Paul Irofti wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? maybe, but your timing is wrong, we're in ABI lock. Hmm... well I guessed if the timing syscalls could go in so could this one. I don't see a difference. OK, if miod is ok with that, I'm ok too. Miod asked me to post it here because he was unsure about always marking it PROT_EXEC. Is that okay with you? Indeed, why are you manipulating the flags? I must be missing something. Especially since you seem to introduce WX combinations. -Otto
Re: compat/linux: add mprotect() syscall
On Thu, Feb 10, 2011 at 1:08 PM, Paul Irofti p...@irofti.net wrote: This adds the mprotect syscall to the linux compat layer. This plus the other time syscalls that went in will make the new versions of applications such as Opera and Skype work. Okay? A similar patch was posted on tech@ some years ago. http://marc.info/?l=openbsd-techm=119548686505743 adapted from netbsd. I see yours is way more compact. If it has the same functionality, then i'd like to have it in. ciao, david