Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: siginfo & no-exec permission - please test



On Sat, Feb 21, 2004 at 07:16:25AM -0800, Chuck Silvers wrote:
> hi,
> 
> I tried this patch on a macppc with a modified version of openbsd's
> noexec test (I put a copy of this in
> ftp://ftp.netbsd.org/pub/NetBSD/misc/chs/noexec.c).
> 
> ktrace says it has the right effect:
> 
>    407 noexec   PSIG  SIGSEGV caught handler=0x180075c mask=(): 
> code=SEGV_ACCERR, addr=0xffffe108, trap=1024)
> 
> I'll leave the ibm4xx stuff to someone else, but it looks fine to me.

Same result on explora451 with this line:

Index: trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/trap.c,v
retrieving revision 1.20
diff -u -2 -r1.20 trap.c
--- trap.c      31 Oct 2003 16:44:35 -0000      1.20
+++ trap.c      21 Feb 2004 15:59:04 -0000
@@ -294,4 +294,5 @@
                ksi.ksi_trap = EXC_ISI;
                ksi.ksi_addr = (void *)frame->srr0;
+               ksi.ksi_code = (rv == EACCES ? SEGV_ACCERR : SEGV_MAPERR);
                trapsignal(l, &ksi);
                l->l_flag &= ~L_SA_PAGEFAULT;

> -Chuck
> 
> 
> On Thu, Feb 19, 2004 at 07:19:42PM +0100, Matthias Drochner wrote:
> > 
> > Hi -
> > I don't have a ppc box to test with atm, but I've done
> > related fixes to other architectures, and from code
> > inspection it appears to me that a little fix should be
> > applied to the powerpc port as well:
> > Desired behaviour is that a SIGSEGV is delivered to a
> > process, with a siginfo si_code of SEGV_ACCERR if code
> > execution is attempted from virtual memory mapped without
> > execution permission (especially the stack).
> > The appended patched should implement this.
> > 
> > Unfortunately I don't have a test program ready to verify
> > this -- the regression test in regress/sys/uvm/stack_noexec
> > probably doesn't work because gcc's ppc target doesn't
> > use stack trampolines afaics.
> > Perhaps you've got another idea;-)
> > 
> > While we are here, 2 observations:
> > -powerpc/ibm4xx/trap.c appears to leave ksi.ksi_code
> >  uninitialized at a number of places
> > -it also calls trapsignal() directly, without the
> >  emulation hook
> > 
> > best regards
> > Matthias

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)



Home | Main Index | Thread Index | Old Index