All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: xuwenjie04 <xuwenjie04@baidu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] pipe/pipe15.c: Adjust fd check for pipe creation
Date: Fri, 1 Mar 2024 13:41:29 +0100	[thread overview]
Message-ID: <20240301124129.GE1661970@pevik> (raw)
In-Reply-To: <EF89BFA1-4088-4497-B0C3-788743AAED3C@baidu.com>

HI Wenjie, Marius,

> A pipe occupies 2 fds, and considering 3 standard fds,
> we should compare rlim_max with such *2+3 calculated value
> to verify whether the maximum file descriptor configuration
> of the current machine is sufficient.

Indeed, 1024*2+3 is the lowest number which passes with non-default ulimit:

ulimit -n $((1024*2+3)) && ./pipe15

Therefore I merged, thank you!

BTW I wonder how did you encounter this?

@Marius FYI I also fixed SIGSEGV when low ulimit, see
https://github.com/linux-test-project/ltp/commit/fc6adb8454df34fa87b462844b740cc3a0b84caa

> Signed-off-by: Wenjie Xu <xuwenjie04@baidu.com>
> ---
> testcases/kernel/syscalls/pipe/pipe15.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/kernel/syscalls/pipe/pipe15.c b/testcases/kernel/syscalls/pipe/pipe15.c
> index c85ad1820..9e02fe2eb 100644
> --- a/testcases/kernel/syscalls/pipe/pipe15.c
> +++ b/testcases/kernel/syscalls/pipe/pipe15.c
> @@ -59,7 +59,7 @@ static void setup(void)
>       tst_res(TINFO, "Creating %i pipes", pipe_count);

>       SAFE_GETRLIMIT(RLIMIT_NOFILE, &nfd);
> -     if (nfd.rlim_max < (unsigned long)pipe_count)
> +    if (nfd.rlim_max < (unsigned long)pipe_count * 2 + 3)
nit: you mixed tabs with spaces or broke indent. And patch was not applicable
(even before my changes), therefore I needed to do the changes myself and thus I
put my fix fc6adb845 ("pipe15: Avoid SIGSEGV in cleanup") before.

Kind regards,
Petr

>              tst_brk(TCONF, "NOFILE limit max too low: %lu < %i", nfd.rlim_max, pipe_count);
>       if (nfd.rlim_cur < nfd.rlim_max) {
>              nfd.rlim_cur = nfd.rlim_max;

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

  reply	other threads:[~2024-03-01 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  2:12 [LTP] [PATCH] pipe/pipe15.c: Adjust fd check for pipe creation xuwenjie04 via ltp
2024-03-01 12:41 ` Petr Vorel [this message]
2024-03-05  7:20   ` Wenjie Xu via ltp
2024-03-06 12:46     ` Petr Vorel
2024-03-07  2:55       ` Wenjie Xu via ltp

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=20240301124129.GE1661970@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=xuwenjie04@baidu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.