From: Laurent Vivier <laurent@vivier.eu>
To: Riku Voipio <riku.voipio@iki.fi>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Timothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 01/34] linux-user: Fix array bounds in errno conversion
Date: Sat, 31 Oct 2015 03:51:32 +0100 [thread overview]
Message-ID: <56342CB4.3050003@vivier.eu> (raw)
In-Reply-To: <4d9a4d2f-5c12-48e3-964c-65e0922950d8@iki.fi>
Le 12/10/2015 15:42, Riku Voipio a écrit :
> On perjantaina 11. syyskuuta 2015 13.59.29 EEST, Peter Maydell wrote:
>> On 6 September 2015 at 00:56, Timothy E Baldwin
>> <T.E.Baldwin99@members.leeds.ac.uk> wrote:
>>> Check array bounds in host_to_target_errno() and target_to_host_errno().
>>>
>>> Signed-off-by: Timothy Edward Baldwin
>>> <T.E.Baldwin99@members.leeds.ac.uk>
>>> ---
>>> linux-user/syscall.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-) ...
>>
>> Maybe we should also check that the passed in error value is
>> not negative? (Given the errno-is-positive/syscall-return-negative
>> conventions, it's an easy mistake to make...)
>
> I've applied a version of this patch that implements this by setting the
> function argument to unsigned
>
> Riku
>
>
This patch breaks get_errno().
On a 64bit target, if errno is 22, host_to_target_errno(22) is (unsigned
int)-22 = 0xffffffea, and get_errno() is (abi_long)0xffffffea =
0x000000000xffffffea = 4294967274. It is not negative, and thus is not
an error.
host_to_target_errno() and target_to_host_errno() must stay signed.
Laurent
next prev parent reply other threads:[~2015-10-31 2:51 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-05 23:56 [Qemu-devel] [PATCH 00/34] linux-user: Fix signal race conditions and SA_RESTART Timothy E Baldwin
2015-09-05 23:56 ` [Qemu-devel] [PATCH 01/34] linux-user: Fix array bounds in errno conversion Timothy E Baldwin
2015-09-10 18:04 ` Peter Maydell
2015-09-11 10:59 ` Peter Maydell
2015-10-12 13:42 ` Riku Voipio
2015-10-31 2:51 ` Laurent Vivier [this message]
2015-09-05 23:56 ` [Qemu-devel] [PATCH 02/34] linux-user: Reindent signal handling Timothy E Baldwin
2015-09-05 23:56 ` [Qemu-devel] [PATCH 03/34] linux-user: Support for restarting system calls Timothy E Baldwin
2015-09-10 18:08 ` Peter Maydell
2015-09-05 23:56 ` [Qemu-devel] [PATCH 04/34] linux-user: Support for restarting system calls for x86 targets Timothy E Baldwin
2015-09-10 18:08 ` Peter Maydell
2015-09-05 23:56 ` [Qemu-devel] [PATCH 05/34] linux-user: Support for restarting system calls for ARM targets Timothy E Baldwin
2015-09-10 18:09 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 06/34] linux-user: Support for restarting system calls for MIPS targets Timothy E Baldwin
2015-09-10 18:09 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 07/34] linux-user: Support for restarting system calls for PPC targets Timothy E Baldwin
2015-09-10 18:10 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 08/34] linux-user: Support for restarting system calls for SPARC targets Timothy E Baldwin
2015-09-10 18:10 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 09/34] linux-user: Test for restarting system calls Timothy E Baldwin
2015-09-10 18:12 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets Timothy E Baldwin
2015-09-10 18:14 ` Peter Maydell
2016-03-03 20:15 ` Peter Maydell
2016-03-04 0:27 ` Edgar E. Iglesias
2016-03-04 10:11 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 11/34] linux-user: Support for restarting system calls for SH4 targets Timothy E Baldwin
2015-09-10 18:15 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 12/34] linux-user: Support for restarting system calls for APLHA targets Timothy E Baldwin
2015-09-10 18:16 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 13/34] linux-user: Fix signal before blocking system calls race and SA_RESTART Timothy E Baldwin
2015-09-10 18:46 ` Peter Maydell
2015-09-11 10:57 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and write system calls Timothy E Baldwin
2015-09-10 18:48 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno() calls Timothy E Baldwin
2015-09-10 18:50 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 16/34] linux-user: Use safe_syscall for open and openat system calls Timothy E Baldwin
2015-09-10 18:54 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 17/34] linux-user: Use safe_syscall for wait " Timothy E Baldwin
2015-09-10 18:58 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 18/34] linux-user: Fix race between multiple signals Timothy E Baldwin
2015-09-11 14:30 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 19/34] linux-user: Restart fork() if signals pending Timothy E Baldwin
2015-09-11 14:34 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 20/34] linux-user: Remove redundant default action check in queue_signal() Timothy E Baldwin
2015-09-11 14:41 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 21/34] linux-user: Remove redundant gdb_queuesig() Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 22/34] linux-user: Remove real-time signal queuing Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 23/34] linux-user: Queue synchronous signals separately Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 24/34] linux-user: Restart execve() if signal pending Timothy E Baldwin
2015-09-11 14:36 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 25/34] linux-user: Restart exit() " Timothy E Baldwin
2015-09-11 14:36 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 26/34] linux-user: Restart kill() " Timothy E Baldwin
2015-09-05 23:57 ` [Qemu-devel] [PATCH 27/34] linux-user: pause() should not pause " Timothy E Baldwin
2015-09-11 14:36 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 28/34] linux-user: Restart sigaction() " Timothy E Baldwin
2015-09-11 14:37 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 29/34] linux-user: Support for restarting system calls for UniCore32 targets Timothy E Baldwin
2015-09-10 19:05 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 30/34] linux-user: Support for restarting system calls for OpenRISC targets Timothy E Baldwin
2015-09-10 19:06 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 31/34] linux-user: Support for restarting system calls for M68K targets Timothy E Baldwin
2015-09-10 19:06 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 32/34] linux-user: Support for restarting system calls for S390 targets Timothy E Baldwin
2015-09-10 19:07 ` Peter Maydell
2015-09-05 23:57 ` [Qemu-devel] [PATCH 33/34] linux-user: Support for restarting system calls for CRIS targets Timothy E Baldwin
2015-09-10 19:12 ` Peter Maydell
2015-09-11 14:18 ` Edgar E. Iglesias
2015-09-11 14:20 ` Peter Maydell
2015-09-11 14:26 ` Edgar E. Iglesias
2015-09-05 23:57 ` [Qemu-devel] [PATCH 34/34] linux-user: Remove TARGET_USE_ERESTARTSYS Timothy E Baldwin
2015-09-10 19:13 ` Peter Maydell
2015-09-10 18:00 ` [Qemu-devel] [PATCH 00/34] linux-user: Fix signal race conditions and SA_RESTART Peter Maydell
2015-10-02 11:52 ` Riku Voipio
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=56342CB4.3050003@vivier.eu \
--to=laurent@vivier.eu \
--cc=T.E.Baldwin99@members.leeds.ac.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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;
as well as URLs for NNTP newsgroup(s).