[LTP] [PATCH v2 3/3] syscalls/clock_adjtime: create clock_adjtime syscall tests

Rafael David Tinoco rafael.tinoco@linaro.org
Wed Mar 20 22:48:49 CET 2019


> On 20 Mar 2019, at 18:41, Rafael David Tinoco <rafael.tinoco@linaro.org> wrote:
> 
> +	/*
> +	 * special case: EFAULT for NULL pointers
> +	 * txcptr = tst_get_bad_addr() -> SIGSEGV is thrown (and not EFAULT)
> +	 */
> +
> +	if (tc[i].exp_err == EFAULT)
> +		txcptr = NULL;

Cyril,

clock_adjtime() returns an EFAULT in case copy_from_user() returns
errors.

Thing is that, using tst_get_bad_addr(), and having a page with no
permissions, before getting an error from copy_from_user() and returning
- thus getting EFAULT back - we get a SIGSEGV from _copy_from_user()
itself, because it tries to sanitize given address, with memset(0),
before returning to userland (to avoid leaks of some sort ?).

With this, the EFAULT is only got when using NULL pointers, and not a
*bad* pointer… So, right now, I can’tuse tst_get_bad_addr() like you
suggested. Should I remove this test and send a v3 ?

Thanks for reviewing all this.

Best Regards

Rafael D. Tinoco


More information about the ltp mailing list