splice07.c: Skip invalid splice() tests involving memfd secret
RFC PATCH 1/1 splice07.c: Skip invalid splice() tests involving memfd secret
Linux commit cbe4134ea4bc ("fs: export anon_inode_make_secure_inode() and fix secretmem LSM bypass") prevents any access to secret memory pages from other kernel subsystems.
Splice operations involving memfd secret are no longer valid and return EACCES. These test cases are skipped accordingly.
This avoids false negatives in splice07 test:
[skip]
splice07.c:54: TFAIL: splice() on pipe read end -> memfd secret expected EBADF, EINVAL: EACCES (13)
[skip]
splice07.c:54: TFAIL: splice() on memfd secret -> pipe write end expected EBADF, EINVAL: EACCES (13)
[skip]Reference: cbe4134ea4bc ("fs: export anon_inode_make_secure_inode() and fix secretmem LSM bypass")
--- testcases/kernel/syscalls/splice/splice07.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/splice/splice07.c +2 -0
@@ -27,6 +27,7 @@ static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out)case TST_FD_UNIX_SOCK :case TST_FD_INET_SOCK :case TST_FD_MEMFD : +case TST_FD_MEMFD_SECRET :return ;default :break ;
@@ -40,6 +41,7 @@ static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out)case TST_FD_FILE :case TST_FD_PROC_MAPS :case TST_FD_MEMFD : +case TST_FD_MEMFD_SECRET :return ;/* And this complains about socket not being connected */ case TST_FD_INET_SOCK :
Signature · 5 lines
2.50.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 34 lines · Jan Polensky
Linux commit
cbe4134ea4bc("fs: exportanon_inode_make_secure_inode()and fix secretmem LSM bypass") prevents any access to secret memory pages from other kernel subsystems.Splice operations involving memfd secret are no longer valid and return EACCES. These test cases are skipped accordingly.
This avoids false negatives in splice07 test:
[skip] splice07.c:54: TFAIL: splice() on pipe read end -> memfd secret expected EBADF, EINVAL: EACCES (13) [skip] splice07.c:54: TFAIL: splice() on memfd secret -> pipe write end expected EBADF, EINVAL: EACCES (13) [skip]Reference:
cbe4134ea4bc("fs: exportanon_inode_make_secure_inode()and fix secretmem LSM bypass")Signed-off-by Jan Polensky <[email protected]>--- testcases/kernel/syscalls/splice/splice07.c | 2 ++ 1 file changed, 2 insertions(+)testcases/kernel/syscalls/splice/splice07.c +1
-0@@ -27,6 +27,7 @@ static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out)case TST_FD_UNIX_SOCK :case TST_FD_INET_SOCK :case TST_FD_MEMFD : +case TST_FD_MEMFD_SECRET :return ;default :break ;
testcases/kernel/syscalls/splice/splice07.c static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out) · line 47
Quoted 7 lines
testcases/kernel/syscalls/splice/splice07.c +1
-0@@ -40,6 +41,7 @@ static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out)case TST_FD_FILE :case TST_FD_PROC_MAPS :case TST_FD_MEMFD : +case TST_FD_MEMFD_SECRET :return ;/* And this complains about socket not being connected */ case TST_FD_INET_SOCK :
Another option maybe we can add this error into exp_errnos, i guess can fix your issue?
for example:
const int exp_errnos[] = {EBADF, EINVAL};+ const int exp_errnos[] = {EBADF, EINVAL, EACCES};
Quoted 6 lines
Signature · 5 lines
2.50.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Wei,
Quoted 2 lines · Wei Gao
Quoted 1 line · Jan Polensky
Linux commit
cbe4134ea4bc("fs: exportanon_inode_make_secure_inode()and fix
[skip]
Quoted 9 lines
Quoted 1 line
case
TST_FD_INET_SOCK:Another option maybe we can add this error into
exp_errnos, i guess can fix your issue?for example:
const int exp_errnos[] = {EBADF, EINVAL};+ const int exp_errnos[] = {EBADF, EINVAL, EACCES};
I’m concerned that this approach might make the tests too unspecific.
Associating specific combinations with corresponding error codes would provide much more precise results. However, given the vast number of possible combinations, such an effort seems hardly practical.
Quoted 6 lines
Quoted 6 lines
--
2.50.0--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 7 lines · Jan Polensky
Quoted 7 lines
Another option maybe we can add this error into
exp_errnos, i guess can fix your issue?for example:
const int exp_errnos[] = {EBADF, EINVAL};+ const int exp_errnos[] = {EBADF, EINVAL, EACCES};
Quoted 5 lines
I’m concerned that this approach might make the tests too unspecific.
Associating specific combinations with corresponding error codes would provide much more precise results. However, given the vast number of possible combinations, such an effort seems hardly practical.
A specific approach for the TST_FD_MEMFD_SECRET is probably required, because we don't really want to test EACCESS for all the other file descriptions. That might hide a bug in the kernel. We need to create a new test, since this one is only checking for EBADF/EINVAL according to the description.
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedMerged, thanks!
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp