[LTP] [RFC PATCH v1 1/1] splice07.c: Skip invalid splice() tests involving memfd secret

Wei Gao wegao@suse.com
Thu Jul 10 15:32:12 CEST 2025


On Wed, Jul 09, 2025 at 06:30:22PM +0200, Jan Polensky wrote:
> 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")
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>
> ---
>  testcases/kernel/syscalls/splice/splice07.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/splice/splice07.c b/testcases/kernel/syscalls/splice/splice07.c
> index 2228e2f269de..c750a14bf439 100644
> --- a/testcases/kernel/syscalls/splice/splice07.c
> +++ b/testcases/kernel/syscalls/splice/splice07.c
> @@ -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:

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};

> -- 
> 2.50.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp


More information about the ltp mailing list