qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Filip Bozuta <Filip.Bozuta@syrmia.com>
Subject: Re: [PATCH v2 2/2] linux-user: fix print_syscall_err() when syscall returned value is negative
Date: Wed, 8 Jul 2020 18:13:14 +0200	[thread overview]
Message-ID: <a9b2795a-9e2f-92ba-2f76-b783b64cd8aa@vivier.eu> (raw)
In-Reply-To: <91f28ac2-c3be-7088-db8a-6bad60fc2c1f@linaro.org>

Le 08/07/2020 à 17:52, Richard Henderson a écrit :
> On 7/8/20 8:24 AM, Laurent Vivier wrote:
>> -static void
>> +static bool
>>  print_syscall_err(abi_long ret)
>>  {
>> -    const char *errstr = NULL;
>> +    const char *errstr;
>>  
>>      qemu_log(" = ");
>>      if (ret < 0) {
> 
> This should be a target-specific test.
> 
> E.g. on most asm-generic I'm pretty sure this should be
> 
>     if ((abi_ulong)ret > -(abi_ulong)512)

I think the test in target_strerror() gives the same result:

    if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) {
        return NULL;
    }

and it also ensures we don't overflow when we will access
target_to_host_errno_table[].

It's why we rely on errstr to know if the errno is valid or not
(we might also remove the "if (ret < 0)" in print_syscall_err).

> whereas for Alpha it should be
> 
>     /*
>      * Syscall writes 0 to V0 to bypass error check, similar
>      * to how this is handled internal to Linux kernel.
>      */
>     if (ret < 0 && env->ir[IR_V0] != 0)

We don't have access to "env" in strace.c.

it's an improvement regarding the code that has been modified.
If we want it I think it should be added in a separate patch.

Thanks,
Laurent



  reply	other threads:[~2020-07-08 16:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 15:24 [PATCH v2 0/2] linux-user: fix print_syscall_err() Laurent Vivier
2020-07-08 15:24 ` [PATCH v2 1/2] linux-user: fix the errno value in print_syscall_err() Laurent Vivier
2020-07-08 15:49   ` Richard Henderson
2020-07-08 16:47   ` Philippe Mathieu-Daudé
2020-07-10 13:48   ` Filip Bozuta
2020-07-13 19:29   ` Laurent Vivier
2020-07-08 15:24 ` [PATCH v2 2/2] linux-user: fix print_syscall_err() when syscall returned value is negative Laurent Vivier
2020-07-08 15:52   ` Richard Henderson
2020-07-08 16:13     ` Laurent Vivier [this message]
2020-07-13 19:34   ` Laurent Vivier

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=a9b2795a-9e2f-92ba-2f76-b783b64cd8aa@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=Filip.Bozuta@syrmia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).