Linux Test Project
 help / color / mirror / Atom feed
From: Avinesh Kumar <akumar@suse.de>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] Disable io_uring fd in ioctl_pidfd01 for selinux
Date: Tue, 29 Jul 2025 10:32:48 +0200	[thread overview]
Message-ID: <5913636.DvuYhMxLoT@thinkpad> (raw)
In-Reply-To: <20250729-ioctl_pidfd01_selinux-v1-1-432e100a5a53@suse.com>

On Tuesday, July 29, 2025 10:06:45 AM CEST Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
> 
> Disable io_uring bad file descriptor in ioctl_pidfd01 when SELinux is
> enabled with enforcing mode. The reason is that SELinux inhibits usage
> of the io_uring file descriptor with EACCESS, causing test to fail
> without a real underlying bug.

We also have same failure for memfd_secret case in this test:

ioctl_pidfd01.c:37: TINFO: memfd secret -> ...
ioctl_pidfd01.c:28: TFAIL: ioctl(memfd secret, PIDFD_GET_INFO, info) expected EINVAL, EBADF, ENOTTY: EACCES (13)

If we are opting for skipping the tests when selinux is enforcing mode,
this also needs to be skipped.

> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> ioctl_pidfd01.c:37: TINFO: io uring -> ...
> ioctl_pidfd01.c:28: TFAIL: ioctl(io uring, PIDFD_GET_INFO, info) expected EINVAL, EBADF, ENOTTY: EACCES (13)
> ---
>  testcases/kernel/syscalls/ioctl/ioctl_pidfd01.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_pidfd01.c b/testcases/kernel/syscalls/ioctl/ioctl_pidfd01.c
> index 92c51c6c0d0dcbb2308c1a8d82b2a92650f3a6b3..1ccb4bcd8a5d4283d29e0a005aef57fbb6753759 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_pidfd01.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_pidfd01.c
> @@ -17,6 +17,7 @@ static int exp_errnos[] = {
>  };
>  
>  static struct pidfd_info *info;
> +static int selinux_enforcing;
>  
>  static void test_bad_pidfd(struct tst_fd *fd_in)
>  {
> @@ -25,6 +26,11 @@ static void test_bad_pidfd(struct tst_fd *fd_in)
>  		return;
>  	}
>  
> +	if (fd_in->type == TST_FD_IO_URING && selinux_enforcing) {
> +		tst_res(TINFO, "Skipping io_uring: SELinux enforcing enabled");
> +		return;
> +	}
> +
>  	TST_EXP_FAIL_ARR(ioctl(fd_in->fd, PIDFD_GET_INFO, info),
>  		  exp_errnos, ARRAY_SIZE(exp_errnos),
>  		  "ioctl(%s, PIDFD_GET_INFO, info)",
> @@ -44,6 +50,8 @@ static void setup(void)
>  	if (!ioctl_pidfd_info_exit_supported())
>  		tst_brk(TCONF, "PIDFD_INFO_EXIT is not supported by ioctl()");
>  
> +	selinux_enforcing = tst_selinux_enforcing();
> +
>  	info->mask = PIDFD_INFO_EXIT;
>  }
>  
> 
> ---
> base-commit: 91e6272febf95e19a8300695dfc2089569adf9d8
> change-id: 20250729-ioctl_pidfd01_selinux-1479ea457850
> 
> Best regards,
> 

Thanks,
Avinesh



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

  reply	other threads:[~2025-07-29  8:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29  8:06 [LTP] [PATCH] Disable io_uring fd in ioctl_pidfd01 for selinux Andrea Cervesato
2025-07-29  8:32 ` Avinesh Kumar [this message]
2025-07-29  8:34   ` Andrea Cervesato via ltp
2025-07-29  8:47     ` Petr Vorel
2025-07-29  9:38       ` Andrea Cervesato via ltp
2025-07-29 16:17       ` Cyril Hrubis
2025-07-29 16:48         ` Andrea Cervesato via ltp
2025-07-30 10:40           ` Wei Gao via ltp
2025-07-30  6:35             ` Andrea Cervesato via ltp
2025-07-30  8:17               ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5913636.DvuYhMxLoT@thinkpad \
    --to=akumar@suse.de \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox