Re: A question about PROT_NONE on ARM and ARM26

Nicolas Pitre
2004-07-01T01:05:31Z

On Thu, 1 Jul 2004, Jamie Lokier wrote:

> Russell King wrote:
> > Ok, this could work, but there's one gotcha - TASK_SIZE-4 doesn't fit
> > in an 8-bit rotated constants, so we need 2 extra instructions:
> >
> > __get_user_4:
> > mov r1, #TASK_SIZE
> > sub r1, r1, #4
> > cmp r0, r1
> > 4: ldrlet r1, [r0]
> > movle r0, #0
> > movle pc, lr
> > ...
>
> One more possibility:
>
> cmp r0, #(TASK_SIZE - (1<<24))
>
> I.e. just compare against the largest constant that can be
> represented. For accesses to the last part of userspace, it's a
> penalty of 4 instructions -- but it might work out to be a net gain.

Maybe not. The user stack is located at the top so any user buffer
allocated on the stack would be penalized.

Nicolas