From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/read02: Don't pass invalid buffer to read when testing for bad fds
Date: Fri, 15 Jul 2016 06:38:53 -0400 (EDT) [thread overview]
Message-ID: <854542372.5188570.1468579133841.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1468578250-26463-1-git-send-email-peter.maydell@linaro.org>
----- Original Message -----
> From: "Peter Maydell" <peter.maydell@linaro.org>
> To: ltp@lists.linux.it
> Cc: patches@linaro.org
> Sent: Friday, 15 July, 2016 12:24:10 PM
> Subject: [LTP] [PATCH] syscalls/read02: Don't pass invalid buffer to read when testing for bad fds
>
> The read02 testcases 1 and 2 are intended to check the handling
> of the read syscall with an invalid fd (should fail EBADF) and
> an fd which is a directory (should fail EISDIR). However a bug
> in the test code meant that it also passed a NULL pointer as
> the buffer argument, and so the test only succeeded because of
> the implementation detail that the kernel happens to check for
> the EBADF and EISDIR errors before it checks the buffer pointer
> validity for an EFAULT error.
>
> The 'buf' field in the test_case_t structure is supposed to be
> a pointer to the address of the buffer, but it was being
> initialised with the address of the buffer itself; fix this by
> adding the extra indirection via a new 'bufaddr' variable, so
> that the test is checking the condition it intends to and nothing
> more.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
I shortened subject a bit and pushed.
Thanks,
Jan
next prev parent reply other threads:[~2016-07-15 10:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 10:24 [LTP] [PATCH] syscalls/read02: Don't pass invalid buffer to read when testing for bad fds Peter Maydell
2016-07-15 10:38 ` Jan Stancek [this message]
2016-07-15 10:45 ` Peter Maydell
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=854542372.5188570.1468579133841.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.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