All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tycho Andersen <tycho@tycho.pizza>
To: Andreas Schwab <schwab@suse.de>
Cc: David Abdurachmanov <david.abdurachmanov@sifive.com>,
	linux-riscv@lists.infradead.org,
	Palmer Dabbelt <palmer@dabbelt.com>,
	linux-kernel@vger.kernel.org,
	Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: [PATCH] riscv: return -ENOSYS for syscall -1
Date: Tue, 22 Dec 2020 09:22:19 -0700	[thread overview]
Message-ID: <20201222162219.GA710211@cisco> (raw)
In-Reply-To: <mvma6u6vkkv.fsf@suse.de>

On Mon, Dec 21, 2020 at 11:52:00PM +0100, Andreas Schwab wrote:
> Properly return -ENOSYS for syscall -1 instead of leaving the return value
> uninitialized.  This fixes the strace teststuite.
> 
> Fixes: 5340627e3fe0 ("riscv: add support for SECCOMP and SECCOMP_FILTER")
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  arch/riscv/kernel/entry.S | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 524d918f3601..d07763001eb0 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -186,14 +186,7 @@ check_syscall_nr:
>  	 * Syscall number held in a7.
>  	 * If syscall number is above allowed value, redirect to ni_syscall.
>  	 */
> -	bge a7, t0, 1f
> -	/*
> -	 * Check if syscall is rejected by tracer, i.e., a7 == -1.
> -	 * If yes, we pretend it was executed.
> -	 */
> -	li t1, -1
> -	beq a7, t1, ret_from_syscall_rejected
> -	blt a7, t1, 1f
> +	bgeu a7, t0, 1f

IIUC, this is all dead code anyway for the path where seccomp actually
rejects the syscall, since it should do the rejection directly in
handle_syscall_trace_enter(), which is called above this hunk. So it
seems good to me.

Reviewed-by: Tycho Andersen <tycho@tycho.pizza>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Tycho Andersen <tycho@tycho.pizza>
To: Andreas Schwab <schwab@suse.de>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	David Abdurachmanov <david.abdurachmanov@sifive.com>
Subject: Re: [PATCH] riscv: return -ENOSYS for syscall -1
Date: Tue, 22 Dec 2020 09:22:19 -0700	[thread overview]
Message-ID: <20201222162219.GA710211@cisco> (raw)
In-Reply-To: <mvma6u6vkkv.fsf@suse.de>

On Mon, Dec 21, 2020 at 11:52:00PM +0100, Andreas Schwab wrote:
> Properly return -ENOSYS for syscall -1 instead of leaving the return value
> uninitialized.  This fixes the strace teststuite.
> 
> Fixes: 5340627e3fe0 ("riscv: add support for SECCOMP and SECCOMP_FILTER")
> Signed-off-by: Andreas Schwab <schwab@suse.de>
> ---
>  arch/riscv/kernel/entry.S | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
> index 524d918f3601..d07763001eb0 100644
> --- a/arch/riscv/kernel/entry.S
> +++ b/arch/riscv/kernel/entry.S
> @@ -186,14 +186,7 @@ check_syscall_nr:
>  	 * Syscall number held in a7.
>  	 * If syscall number is above allowed value, redirect to ni_syscall.
>  	 */
> -	bge a7, t0, 1f
> -	/*
> -	 * Check if syscall is rejected by tracer, i.e., a7 == -1.
> -	 * If yes, we pretend it was executed.
> -	 */
> -	li t1, -1
> -	beq a7, t1, ret_from_syscall_rejected
> -	blt a7, t1, 1f
> +	bgeu a7, t0, 1f

IIUC, this is all dead code anyway for the path where seccomp actually
rejects the syscall, since it should do the rejection directly in
handle_syscall_trace_enter(), which is called above this hunk. So it
seems good to me.

Reviewed-by: Tycho Andersen <tycho@tycho.pizza>

  reply	other threads:[~2020-12-22 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 22:52 [PATCH] riscv: return -ENOSYS for syscall -1 Andreas Schwab
2020-12-21 22:52 ` Andreas Schwab
2020-12-22 16:22 ` Tycho Andersen [this message]
2020-12-22 16:22   ` Tycho Andersen
2020-12-23  4:04   ` Palmer Dabbelt
2020-12-23  4:04     ` Palmer Dabbelt
2020-12-23  8:24   ` Christoph Hellwig
2020-12-23  8:24     ` Christoph Hellwig
2020-12-24  2:54     ` Palmer Dabbelt
2020-12-24  2:54       ` Palmer Dabbelt
2020-12-24  4:38       ` Tycho Andersen
2020-12-24  4:38         ` Tycho Andersen

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=20201222162219.GA710211@cisco \
    --to=tycho@tycho.pizza \
    --cc=david.abdurachmanov@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=schwab@suse.de \
    /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.