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

Cyril Hrubis chrubis@suse.cz
Thu Mar 21 15:10:15 CET 2019


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);

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list