All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, Warner Losh <imp@bsdimp.com>
Subject: Re: [PULL 02/15] linux-user: Move syscall error detection into safe_syscall_base
Date: Tue, 4 Jan 2022 14:51:01 +0100	[thread overview]
Message-ID: <69f6a9fc-d2b3-661c-38d7-1991b34c55ca@vivier.eu> (raw)
In-Reply-To: <20211220202500.111897-3-richard.henderson@linaro.org>

Le 20/12/2021 à 21:24, Richard Henderson a écrit :
> The current api from safe_syscall_base() is to return -errno, which is
> the interface provided by *some* linux kernel abis.  The wrapper macro,
> safe_syscall(), detects error, stores into errno, and returns -1, to
> match the api of the system syscall().
> 
> For those kernel abis that do not return -errno natively, this leads
> to double syscall error detection.  E.g. Linux ppc64, which sets the
> SO flag for error.
> 
> Simplify the usage from C by moving the error detection into assembly,
> and usage from assembly by providing a C helper with which to set errno.
> 
> Reviewed-by: Warner Losh <imp@bsdimp.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/safe-syscall.h                  | 16 +++-------
>   linux-user/safe-syscall-error.c            | 28 ++++++++++++++++
>   linux-user/host/aarch64/safe-syscall.inc.S | 20 ++++++------
>   linux-user/host/arm/safe-syscall.inc.S     | 27 ++++++++++------
>   linux-user/host/i386/safe-syscall.inc.S    | 37 +++++++++++++++-------
>   linux-user/host/ppc64/safe-syscall.inc.S   | 24 +++++++-------
>   linux-user/host/riscv/safe-syscall.inc.S   | 20 ++++++------
>   linux-user/host/s390x/safe-syscall.inc.S   | 32 ++++++++++++-------
>   linux-user/host/x86_64/safe-syscall.inc.S  | 29 +++++++++--------
>   linux-user/meson.build                     |  1 +
>   10 files changed, 147 insertions(+), 87 deletions(-)
>   create mode 100644 linux-user/safe-syscall-error.c
> 
>

This patch breaks command execution in bash command line interface:

- if I run "chroot chroot/powerpc/jessie ls", it works

- if I run "echo ls |  chroot chroot/powerpc/jessie", it hangs

- if I run "chroot chroot/powerpc/jessie bash invalid_command",
   it does nothing whereas it should return "bash: invalid_command: No such file or directory".

I think the exit status of the command is not correctly detected by bash.

Thanks,
Laurent





  reply	other threads:[~2022-01-04 13:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 20:24 [PULL 00/15] *-user: simplify safe signal handling Richard Henderson
2021-12-20 20:24 ` [PULL 01/15] linux-user: Untabify all safe-syscall.inc.S Richard Henderson
2021-12-20 20:24 ` [PULL 02/15] linux-user: Move syscall error detection into safe_syscall_base Richard Henderson
2022-01-04 13:51   ` Laurent Vivier [this message]
2022-01-04 18:12     ` Richard Henderson
2021-12-20 20:24 ` [PULL 03/15] linux-user/host/mips: Add safe-syscall.inc.S Richard Henderson
2021-12-20 20:24 ` [PULL 04/15] linux-user/host/sparc64: " Richard Henderson
2021-12-20 20:24 ` [PULL 05/15] linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h Richard Henderson
2021-12-20 20:24 ` [PULL 06/15] linux-user: Rename TARGET_ERESTARTSYS to QEMU_ERESTARTSYS Richard Henderson
2021-12-20 20:24 ` [PULL 07/15] bsd-user: " Richard Henderson
2021-12-20 20:24 ` [PULL 08/15] linux-user: Rename TARGET_QEMU_ESIGRETURN to QEMU_ESIGRETURN Richard Henderson
2021-12-20 20:24 ` [PULL 09/15] linux-user: Create special-errno.h Richard Henderson
2021-12-20 20:24 ` [PULL 10/15] bsd-user: " Richard Henderson
2021-12-20 20:24 ` [PULL 11/15] common-user: Move safe-syscall.* from linux-user Richard Henderson
2021-12-20 20:24 ` [PULL 12/15] common-user: Adjust system call return on FreeBSD Richard Henderson
2021-12-20 20:24 ` [PULL 13/15] linux-user: Move thunk.c from top-level Richard Henderson
2021-12-20 20:24 ` [PULL 14/15] meson: Move linux_user_ss to linux-user/ Richard Henderson
2021-12-20 20:25 ` [PULL 15/15] meson: Move bsd_user_ss to bsd-user/ Richard Henderson
2021-12-20 23:54 ` [PULL 00/15] *-user: simplify safe signal handling Richard Henderson

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=69f6a9fc-d2b3-661c-38d7-1991b34c55ca@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=imp@bsdimp.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 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.