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

Rafael David Tinoco rafael.tinoco@linaro.org
Thu Mar 21 15:17:12 CET 2019


> On 21 Mar 2019, at 11:10, Cyril Hrubis <chrubis@suse.cz> wrote:
> 
> Hi!
>>> checking lib/usercopy.c -> _copy_from_user(), memset() is only done in
>>> kernel buffer if there was an error in raw_copy_from_user(), so.. you???re
>>> right. Since mmap???ed buffer has PROT_NONE, I guess the SIGSEGV is thrown
>>> during ???raw_copy_from_user()??? when referencing the user page with no
>>> permissions. This might not happen when a NULL is passed, making adjtime
>>> to ret EFAULT. Anyway, can???t use tst_get_bad_addr() as it seems...
>> 
>> Looking at strace of the test we manage to get -1 and EFAULT followed by
>> the signal, which is strange. I do wonder why this is the only syscall
>> that behaves that way.
> 
> Found the bug :-), the kernel is not the problem but rather the lines:
> 
> 	if (txcptr)
> 		timex_show("TEST", *txcptr);
> 
> 
> You have to change these to something as:
> 
> 	if (tcxptr != bad_addr)
> 		timex_show("TEST", *txcptr);

/me blushes for not having opened it in gdb :o)

tks

> 
> -- 
> Cyril Hrubis
> chrubis@suse.cz




More information about the ltp mailing list