Re: [LTP] [PATCH v2 4/4] Add error coverage for landlock network support

Cyril Hrubis
2024-11-06T10:38:37Z

Hi!
> >> - verify_landlock_is_enabled();
> >> + abi_current = verify_landlock_is_enabled();
> >>
> >> ruleset_attr->handled_access_fs = LANDLOCK_ACCESS_FS_EXECUTE;
> >>
> >> ruleset_fd = TST_EXP_FD_SILENT(tst_syscall(__NR_landlock_create_ruleset,
> >> - ruleset_attr, sizeof(struct tst_landlock_ruleset_attr_abi1), 0));
> >> + ruleset_attr, sizeof(struct tst_landlock_ruleset_attr_abi4), 0));
> > ^
> > This should be abi_current otherwise we
> > will fail on v1 only system.
> >
> >> }
> >>
>
> In what sense? abi4 is already the last one. At least the last supported
> by LTP.

Because if we request abi4 it will fail on kernels that only support
abi1. We try hard to skip the abi4 tests, but we wouldn't get there at
all on abi1 kernel because we would fail to create the ruleset_fd in the
test setup.

And we cannot initialize the abi to anything newer than abi4 either,
because we pass abi4 structure in the test. It's fine that we pass abi4
structure on abi1 system here, because the test only checks for invalid
cases and all we need here is to pass a valid attr and size so that we
get rejected by the kernel on the rest of the parameters.

--
Cyril Hrubis
chrubis@suse.cz