[LTP] [PATCH v1 3/4] syscalls/capset03: add new EPERM error test without CAP_SETPCAP

Cyril Hrubis chrubis@suse.cz
Tue Jan 7 14:39:13 CET 2020


Hi!
> +static void setup(void)
> +{
> +	pid_t pid;
> +
> +	pid = getpid();
> +	header.pid = pid;
> +	if (geteuid() == 0) {
> +		TEST(tst_syscall(__NR_capset, &header, data));
> +		if (TST_RET == -1)
> +			tst_brk(TBROK | TTERRNO, "capset data failed");
> +	}

Please don't do that. If tests needs root (even for a subset of the
test) just set the .needs_root flag.

> +}
> +
> +static struct tst_test test = {
> +	.setup = setup,
> +	.test_all = verify_capset,
> +	.caps = (struct tst_cap []) {
> +		TST_CAP(TST_CAP_DROP, CAP_SETPCAP),
> +		{}
> +	},
> +};
> -- 
> 2.18.0
> 
> 
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list