From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Aurelien Jarno <aurelien@aurel32.net>,
Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: scall64-o32: Fix indirect syscall number load
Date: Sun, 14 Apr 2019 22:31:16 +0200 [thread overview]
Message-ID: <1ebf2209-9fd7-4c1f-0d1f-ff23d5d5e300@amsat.org> (raw)
In-Reply-To: <20190409145355.25842-1-aurelien@aurel32.net>
On 4/9/19 4:53 PM, Aurelien Jarno wrote:
> Commit 4c21b8fd8f14 (MIPS: seccomp: Handle indirect system calls (o32))
> added indirect syscall detection for O32 processes running on MIPS64,
> but it did not work correctly for big endian kernel/processes. The
> reason is that the syscall number is loaded from ARG1 using the lw
> instruction while this is a 64-bit value, so zero is loaded instead of
> the syscall number.
>
> Fix the code by using the ld instruction instead. When running a 32-bit
> processes on a 64 bit CPU, the values are properly sign-extended, so it
> ensures the value passed to syscall_trace_enter is correct.
>
> Recent systemd versions with seccomp enabled whitelist the getpid
> syscall for their internal processes (e.g. systemd-journald), but call
> it through syscall(SYS_getpid). This fix therefore allows O32 big endian
> systems with a 64-bit kernel to run recent systemd versions.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> Cc: <stable@vger.kernel.org> # v3.15+
> ---
> arch/mips/kernel/scall64-o32.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
> index f158c5894a9a..feb2653490df 100644
> --- a/arch/mips/kernel/scall64-o32.S
> +++ b/arch/mips/kernel/scall64-o32.S
> @@ -125,7 +125,7 @@ trace_a_syscall:
> subu t1, v0, __NR_O32_Linux
> move a1, v0
> bnez t1, 1f /* __NR_syscall at offset 0 */
> - lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */
> + ld a1, PT_R4(sp) /* Arg1 for __NR_syscall case */
> .set pop
>
> 1: jal syscall_trace_enter
>
>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
next prev parent reply other threads:[~2019-04-14 20:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 14:53 Aurelien Jarno
2019-04-14 20:31 ` Philippe Mathieu-Daudé [this message]
2019-04-15 17:36 ` Paul Burton
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=1ebf2209-9fd7-4c1f-0d1f-ff23d5d5e300@amsat.org \
--to=f4bug@amsat.org \
--cc=aurelien@aurel32.net \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®