From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/fcntl35: the pipe-max-size should be multiple of PAGE_SIZE
Date: Tue, 8 Aug 2017 09:03:48 +0800 [thread overview]
Message-ID: <59890DF4.6090703@cn.fujitsu.com> (raw)
In-Reply-To: <20170807071059.27653-1-liwang@redhat.com>
Hi Li,
Thanks for fixing this issue! :-)
Thanks,
Xiao Yang.
On 2017/08/07 15:10, Li Wang wrote:
> It's very easy to get failures on a system which the PAGE_SIZE is larger than 4096.
>
> # uname -r
> 4.13.0-rc3
> # getconf PAGESIZE
> 65536
> # echo 4096 >/proc/sys/fs/pipe-max-size
> bash: echo: write error: Invalid argument
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
> testcases/kernel/syscalls/fcntl/fcntl35.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fcntl/fcntl35.c b/testcases/kernel/syscalls/fcntl/fcntl35.c
> index b984584..675da71 100644
> --- a/testcases/kernel/syscalls/fcntl/fcntl35.c
> +++ b/testcases/kernel/syscalls/fcntl/fcntl35.c
> @@ -45,19 +45,23 @@
> #include "tst_test.h"
>
> static int pipe_max_unpriv;
> -static int test_max_unpriv = 4096;
> +static int test_max_unpriv;
> +static int test_max_priv;
> static struct passwd *pw;
> static struct tcase {
> - int exp_sz;
> + int *exp_sz;
> int exp_usr;
> char *des;
> } tcases[] = {
> - {4096, 1, "an unprivileged user"},
> - {65536, 0, "a privileged user"}
> + {&test_max_unpriv, 1, "an unprivileged user"},
> + {&test_max_priv, 0, "a privileged user"}
> };
>
> static void setup(void)
> {
> + test_max_unpriv = getpagesize();
> + test_max_priv = test_max_unpriv * 16;
> +
> if (!access("/proc/sys/fs/pipe-max-size", F_OK)) {
> SAFE_FILE_SCANF("/proc/sys/fs/pipe-max-size", "%d",
> &pipe_max_unpriv);
> @@ -115,7 +119,7 @@ static void do_test(unsigned int n)
> if (tc->exp_usr)
> SAFE_SETUID(pw->pw_uid);
>
> - verify_pipe_size(tc->exp_sz, tc->des);
> + verify_pipe_size(*tc->exp_sz, tc->des);
> }
>
> tst_reap_children();
prev parent reply other threads:[~2017-08-08 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 7:10 [LTP] [PATCH] syscalls/fcntl35: the pipe-max-size should be multiple of PAGE_SIZE Li Wang
2017-08-07 12:57 ` Cyril Hrubis
2017-08-08 1:03 ` Xiao Yang [this message]
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=59890DF4.6090703@cn.fujitsu.com \
--to=yangx.jy@cn.fujitsu.com \
--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 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.