[PATCH 2/2] ARM: fix personality flag propagation across an exec

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Apr 8 15:10:35 EDT 2011


On Fri, Apr 08, 2011 at 09:00:07AM -0400, Nicolas Pitre wrote:
> On Fri, 8 Apr 2011, Russell King - ARM Linux wrote:
> 
> > On Thu, Apr 07, 2011 at 10:52:53PM -0400, Nicolas Pitre wrote:
> > >  	/*
> > > +	 * Inherit most personality flags from parent, except for those
> > > +	 * we're about to choose.  Beware: PER_LINUX_32BIT carries flag bits
> > > +	 * outside of PER_MASK.
> > > +	 */
> > > +	personality &= ~(PER_MASK | PER_LINUX | PER_LINUX_32BIT);
> > 
> > PER_LINUX and PER_LINUX_32BIT aren't bitflags - the LSB is a numeric
> > personality ID.  So this looks wrong.
> 
> >From include/linux/personality.h:
> 
> enum {
>         PER_LINUX =             0x0000,
>         PER_LINUX_32BIT =       0x0000 | ADDR_LIMIT_32BIT,
>         PER_LINUX_FDPIC =       0x0000 | FDPIC_FUNCPTRS,
>         PER_SVR4 =              0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
>         [...]
> 
> So this is a combination of a personality ID and flag bits.  And the 
> only difference between PER_LINUX and PER_LINUX_32BIT is one of those 
> flag bits.

Yes but its wrong to clear the bitmask using ~PER_LINUX etc.

What you want to be doing is:

	personality &= ~(PER_MASK | ADDR_LIMIT_32BIT);

so you're clearing the LSB being the personality type, and the 32-bit
address limit.



More information about the linux-arm-kernel mailing list