Subject: Re: W^X with PowerPC
To: Matt Thomas <matt@3am-software.com>
From: Tim Kelly <hockey@dialectronics.com>
List: port-macppc
Date: 10/15/2004 14:18:13
On Fri, 15 Oct 2004 14:13:54 -0700
Matt Thomas <matt@3am-software.com> wrote:

> Not quite accurate.   read & read/write and independent of executable
> & non-executable.

Ok. I was interpreting executable to also be readable, but I guess that
would pertain more to data rather than instructions.

> The MMU and the pmap implementation fully supports NX.  The problem is
> in the ELF32 ABI we use.

What about other formats, such as Mach-o? I see that work has been
done (completed?) toward compatibility with this format.

> >Is it written somewhere that in segment page combinations all parts
> >must be within the same segment?
> 
> Yes.  The SVR4 ABI for PPC.

Has this been compounded by the rather large segment size of the PPC
chip?

> >I know that 4.4BSD is purely paged. However, would it be possible to
> >shim prior to pmap such that pmap gets fooled into thinking it is
> >purely paged? Can pmap differentiate between one virtual address
> >space and another if both are established prior to pmap? Would it be
> >possible at the page level to exclude two processes in the same
> >segment from seeing each other?
> 
> Huh?  Each process has its own 4GB virtual address space.  Completely
> independent of every other process.

I was looking at it from the perspective that if the segments are 256M
in size (and fixed), obviously some processes could figure out that
other processes existed within the same segment and attempt to access
them by examining some page IDs within its memory. This would be an
intentional act for the purpose of "snooping" to gain priviledge
escalation or other illicit activity.

However, upon further reflection, it seems to me that the only way this
could be exploited would be for the process to have supervisor level
access to the CPU and if it had that it could change segment permissions
as needed.

> As long as we use the SVR4 ABI, we are unable to do anything.  ELF64,
> an XCOFF descendent, does allow better use for NX.

Ok, please forgive me while I ask a newbie question (my experience is
with MacOS PEF formats, closed source stub libs, et al): why does NetBSD
use the SVR4 ELF32 ABI?

thanks!
tim