[LTP] [PATCH 3/3] Add lockdown checks to init_module* and finit_module* tests
Cyril Hrubis
chrubis@suse.cz
Tue Jul 20 14:02:53 CEST 2021
Hi!
> +static void lockdown_setup(struct tcase *tc)
> +{
> + if (kernel_lockdown)
> + tc->exp_errno = EPERM;
> +}
> +
> static struct tcase tcases[] = {
> {"invalid-fd", &fd_invalid, "", O_RDONLY | O_CLOEXEC, 0, 0, 0, bad_fd_setup},
> {"zero-fd", &fd_zero, "", O_RDONLY | O_CLOEXEC, 0, 0, EINVAL, NULL},
> - {"null-param", &fd, NULL, O_RDONLY | O_CLOEXEC, 0, 0, EFAULT, NULL},
> - {"invalid-param", &fd, "status=invalid", O_RDONLY | O_CLOEXEC, 0, 0, EINVAL, NULL},
> + {"null-param", &fd, NULL, O_RDONLY | O_CLOEXEC, 0, 0, EFAULT,
> + lockdown_setup},
> + {"invalid-param", &fd, "status=invalid", O_RDONLY | O_CLOEXEC, 0, 0,
> + EINVAL, lockdown_setup},
> {"invalid-flags", &fd, "", O_RDONLY | O_CLOEXEC, -1, 0, EINVAL, NULL},
> {"no-perm", &fd, "", O_RDONLY | O_CLOEXEC, 0, 1, EPERM, NULL},
> {"module-exists", &fd, "", O_RDONLY | O_CLOEXEC, 0, 0, EEXIST, NULL},
I'm slightly afraid that the order of checks may change over the time
and we will get EPERM in all these cases, but maybe I'm just overly
cautious. Other than this the code looks good.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list