[LTP] [PATCH v2 1/2] syscalls/setrlimit02.c: Add a test for EFAULT

Cyril Hrubis chrubis@suse.cz
Tue Oct 10 14:55:00 CEST 2017


Hi!
> + * DESCRIPTION
> + *  1) Test for EINVAL when resource is invalid.
> + *  2) Test for EFAULT when rlim points outside the accessible address space.
> + *  3) Test for EPERM when an unprivileged process tries to increase the
> + *     hard limit.
>   */
>  #include <pwd.h>
>  #include <errno.h>
> @@ -33,6 +37,7 @@ static struct tcase {
>  	int exp_errno;
>  } tcases[] = {
>  	{-1, &rlim, EINVAL},
> +	{RLIMIT_NOFILE, (void *) -1, EFAULT},
>  	{RLIMIT_NOFILE, &rlim, EPERM}
>  };

I've rembered why there is no EFAULT test for the setrlimit:

commit 259db6fed55f88ab32a0875e66803eee44d298be
Author: Cyril Hrubis <chrubis@suse.cz>
Date:   Thu Aug 17 13:42:20 2017 +0200

    syscalls/setrlimit02: Remove the EFAULT test

    ...

https://github.com/linux-test-project/ltp/issues/193


So if we really want to add this one, we have to either run the test in
the child and produce PASS on SegFault or call the raw syscall for the
EFAULT test. Either way I think that we should put it in a seprate
testcase if the test is really needed.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list