Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1554351yba; Sun, 14 Apr 2019 13:32:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4JF01TFFLjuPfaIUC9RXpndPOXxXnp6YbkvZ3N+EtDvz0BYJw14D03JA/xjkLejIjJ7rN X-Received: by 2002:a62:209c:: with SMTP id m28mr69487876pfj.233.1555273938765; Sun, 14 Apr 2019 13:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555273938; cv=none; d=google.com; s=arc-20160816; b=aYnhboWJ8FvEaBOcsQkuTWVPthXvfdIQtuNrAa1oL/Ey+of9WEZnSZrZ5tP5OpbJcQ 24t/vw0OqdPZtGJaO4qrZeBdzlvt7Ap5eRmi7BdjWmIPmeaEfueCI/NcCUHOFl8ky4TB Juol4dYGcFwMiEGIZAGncjzZxiDEqXhB8arRRIptYd5mTaACN07f2DZtRoicNEDZNUWL IkPYYQs79Ast46UTEATLFVqORO6V/5BUNVE9ZZe8WQRwPY6wafZ0TQ7ou7Xd+4TLfCck iSoAOw1dis3k4WMvaU17Gw2ZO+k6T8Rwi9VaHbOQRFtslyB3ALf3v/bg4xxqhaz/X4fB 5YHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject:dkim-signature; bh=OqDMtve4D/P5Q6oyq3tvHG3ctD+xyevYdt55M8kqXqQ=; b=1ADFeO8v4lNDDN5PkJlFrGXqr++f1Yuqt9xuNueajTEyTAKWOBx7+qan7LbunPYyrj gR7I+igO+eBL1DtjisYLinYqr0UX2ZJVKouAGWbqsDY62nY71fWalkMRdxz1O2iuGEEu So0KYqlvS9CEcMvHYoM8P+Mc2ptpvfTMVNuPQsPZArzHywWZrih53ad4bwpg6YDhCpTy ywYPXSby81dDUdcajBO8Mp1PEZ90GQFJqH+RxzY8stY6hOOOXN6wrwsxs6uXcr/re7N7 xbGrA50uIIfd9I7PUszlDEfKb+LGvstXBCiiP5OU4qi54wQeOlWpIdi9eP0KuaJcntuk R7YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=g2vXMoBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si42526963plr.406.2019.04.14.13.32.02; Sun, 14 Apr 2019 13:32:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=g2vXMoBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbfDNUbU (ORCPT + 99 others); Sun, 14 Apr 2019 16:31:20 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50805 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbfDNUbU (ORCPT ); Sun, 14 Apr 2019 16:31:20 -0400 Received: by mail-wm1-f66.google.com with SMTP id z11so17985273wmi.0; Sun, 14 Apr 2019 13:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OqDMtve4D/P5Q6oyq3tvHG3ctD+xyevYdt55M8kqXqQ=; b=g2vXMoBWe82jpe06NEoVEXg7oH3KjiKYwsVzsA0ETM25RbUX9b9cyWyOS39L9MR2t3 SWzb1qJ/5RWHG4v1evM+w2cPQmpPRXU6HlCudLRNlBYUAKiuNAyyJUTihZO+sEptTik6 z0uYzwA/6VaUFULRmJQAoh51Pg3PfKctqdhn1hETgOqmSoNrkuadDIxGu/8cbby9rTkf ethcxMTgh1cXTgFlO9xYgvXDA940HrapIxXKPpWHnd/cl3T1d7/6xYsVrZwePZKLU1d1 sn1UOGXMTnc1rwCy99/MnGhtegN8Sq3cm6ObaDf5YtzULIMqTn38SSIuQSe9117Amggf m42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=OqDMtve4D/P5Q6oyq3tvHG3ctD+xyevYdt55M8kqXqQ=; b=gu65v3tov+yUZehj3bZuqSMzIFnGLowgELWO5aswvFXCMyzlAmfawhcU55AQVx5TAU Wt74dfV1Et2UWMyibwPeT5Y2xvZ1ENokL5lHGI9jPzVjqyMihn7OpgGnb1WZRoE+aezs im9duenghwrXTA5qH9rC9Yt1jeBye7PzbZ9c92BT9icwZpCjvvOuJWDw2UOsbi+NXMmQ yWP3YtV1pi/RclZJfcDEsg050KaxsD2/P0UmIJtNCIw9zUB+hX3fFGcL8DZOpGKjpJY9 vS+hlkvTlKU8c1ferCbc2aTgjHdADd70lgVxtNvP7yMZ6au83UjhIlGPzwkS0DFAekk1 BurQ== X-Gm-Message-State: APjAAAXqokmZUuw6OAOhkRwqcHSe0SHppvl8Le2iD2/ubmwSsUfYp3I7 I80vV8R3hHFWbRnF9x6pd1PD4Jhd X-Received: by 2002:a1c:b189:: with SMTP id a131mr18626909wmf.107.1555273878201; Sun, 14 Apr 2019 13:31:18 -0700 (PDT) Received: from [192.168.1.37] (193.red-88-21-103.staticip.rima-tde.net. [88.21.103.193]) by smtp.gmail.com with ESMTPSA id d3sm32993987wmf.46.2019.04.14.13.31.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Apr 2019 13:31:17 -0700 (PDT) Subject: Re: [PATCH] MIPS: scall64-o32: Fix indirect syscall number load To: Aurelien Jarno , Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20190409145355.25842-1-aurelien@aurel32.net> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Openpgp: url=http://pgp.mit.edu/pks/lookup?op=get&search=0xE3E32C2CDEADC0DE Message-ID: <1ebf2209-9fd7-4c1f-0d1f-ff23d5d5e300@amsat.org> Date: Sun, 14 Apr 2019 22:31:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190409145355.25842-1-aurelien@aurel32.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: # 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é