From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] cve/cve-2016-10044.c: fix two errors
Date: Thu, 26 Oct 2017 17:02:05 +0800 [thread overview]
Message-ID: <59F1A48D.6010801@cn.fujitsu.com> (raw)
In-Reply-To: <1506391449-5646-1-git-send-email-yangx.jy@cn.fujitsu.com>
Hi Cyril,
Could you help me review this patch? Thanks a lot. :-)
Thanks,
Xiao Yang
On 2017/09/26 10:04, Xiao Yang wrote:
> 1) If the number of nr_events exceeds the limit of available events
> defined in /proc/sys/fs/aio-max-nr, it returns EAGAIN. We should
> call io_destroy() to cleanup the AIO context after finishing test.
>
> Steps to reproduce this error:
> #echo 4 > /proc/sys/fs/aio-max-nr
> # ./cve-2016-10044 -i 5
> tst_test.c:908: INFO: Timeout per run is 0h 05m 00s
> cve-2016-10044.c:62: FAIL: AIO mapping is executable: rwxs!
> cve-2016-10044.c:62: FAIL: AIO mapping is executable: rwxs!
> cve-2016-10044.c:62: FAIL: AIO mapping is executable: rwxs!
> cve-2016-10044.c:62: FAIL: AIO mapping is executable: rwxs!
> cve-2016-10044.c:49: BROK: Failed to create AIO context: EAGAIN/EWOULDBLOCK
>
> 2) This case fails with TBROK on an old kernel(e.g. v2.6.32) because
> the mapping file does not exist.
>
> The old format of file is set to 'anon_inode:[aio]' by the following
> patch set:
> '55708698c5f1("fs/anon_inode: Introduce a new lib function anon_inode_getfile_private()")'
> '36bc08cc0170("fs/aio: Add support to aio ring pages migration")'
>
> The current format of file is set to '/[aio]' by the following patch:
> '71ad7490c1f3("rework aio migrate pages to use aio fs")'
>
> We change the keyword into '[aio]' to match as many formats as
> possible, and return TCONF if the mapping file does not exist.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
> testcases/cve/cve-2016-10044.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/cve/cve-2016-10044.c b/testcases/cve/cve-2016-10044.c
> index 7928d27..14fa0a4 100644
> --- a/testcases/cve/cve-2016-10044.c
> +++ b/testcases/cve/cve-2016-10044.c
> @@ -50,10 +50,10 @@ static void run(void)
>
> f = SAFE_FOPEN("/proc/self/maps", "r");
> while (fgets(line, BUFSIZ, f) != NULL) {
> - if (strstr(line, "/[aio]") != NULL)
> + if (strstr(line, "[aio]") != NULL)
> goto found_mapping;
> }
> - tst_brk(TBROK, "Could not find mapping in /proc/self/maps");
> + tst_brk(TCONF, "Could not find mapping in /proc/self/maps");
>
> found_mapping:
> if (sscanf(line, "%*x-%*x %s7", perms) < 0)
> @@ -63,6 +63,9 @@ found_mapping:
> else
> tst_res(TPASS, "AIO mapping is not executable: %s", perms);
>
> + if (tst_syscall(__NR_io_destroy, ctx))
> + tst_brk(TBROK | TERRNO, "Failed to destroy AIO context");
> +
> SAFE_FCLOSE(f);
> f = NULL;
> }
next prev parent reply other threads:[~2017-10-26 9:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 9:21 [LTP] [PATCH] cve/cve-2016-10044.c: fix two errors Xiao Yang
2017-09-22 11:06 ` Richard Palethorpe
2017-09-25 10:47 ` Xiao Yang
2017-09-25 11:16 ` Richard Palethorpe
2017-09-26 2:04 ` [LTP] [PATCH v2] " Xiao Yang
2017-10-05 2:11 ` Xiao Yang
2017-10-13 7:48 ` Xiao Yang
2017-10-26 9:02 ` Xiao Yang [this message]
2017-10-26 10:23 ` Cyril Hrubis
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=59F1A48D.6010801@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox