Hi David,

On 06/10/14 21:11, David Daney wrote:
> Any userspace thread desiring a non-executable stack,
> must allocate a 4-byte aligned area at least 8 bytes long

<snip>

> +SYSCALL_DEFINE1(set_fpuemul_xol_area, unsigned long, addr)
> +{
> +     struct thread_info *ti = task_thread_info(current);
> +
> +     ti->fpu_emul_xol = addr;
> +     return 0;
> +}
> +

<snip>

> -     /* Ensure that the two instructions are in the same cache line */
> -     fr = (struct emuframe __user *)
> -             ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7);
> +     if (ti->fpu_emul_xol != ~0ul)
> +             fr = (struct emuframe *)ti->fpu_emul_xol;
> +     else
> +             /* Ensure that the two instructions are in the same cache line 
> */
> +             fr = (struct emuframe __user *)
> +                     ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7);

I know your patch was more an RFC, but on a technical note, this
comment/code seems to imply that the address should be 8 byte aligned
(rather than 4 byte) so they both land in the same cache line. Also, I
think the alignment should be validated in the syscall.

Cheers
James
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to