Re: [patch 08/11] Modify Ptrace routines to access breakpointregisters

From: Roland McGrath
Date: Wed Mar 11 2009 - 23:16:16 EST


> I dont see where this security check has been carried over into
> the generic code. The new code has:
>
> +int arch_check_va_in_userspace(unsigned long va, struct task_struct *tsk)
> +{
> + return (va < TASK_SIZE);
> +}
>
> but i think that misses the detail that it's not just the start
> address of an x86 breakpoint that has to be considered, but also
> the end addess of it.

It also needs to be TASK_SIZE_OF(tsk), which is shorthand for the same
logic already in the 64-bit debugreg_addr_limit().

For the end-of-range issue, it perhaps ought to check size-1 instead of
wordsize-1, i.e. through the end of the actual breakpoint range, not of the
word containing it. What debugreg_addr_limit() does is the historical
ptrace check on x86, but I don't see a reason to disallow a 1-byte
watchpoint on the last addressable user-space byte if the hardware will
support it.

So either the arch check should take a size parameter, or the
arch-independent code can just call it with address+size-1.


Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/