Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4827709yba; Tue, 30 Apr 2019 05:09:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfb5ORsinipZdz1eiDcwjhZcbHE7DK4FusCZcyd54NRNqRJPX7IVQrd/uiAoPBxM42ihri X-Received: by 2002:a17:902:e293:: with SMTP id cf19mr9780441plb.151.1556626158704; Tue, 30 Apr 2019 05:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556626158; cv=none; d=google.com; s=arc-20160816; b=wjxWuczPLDeDOX9tJViQlTqNJvlhexIJwDyiIFD85oSsruP2ExPxOR1s3D/aJx6ux7 31K4fEfy2bGWcntbliIFzDe0KkI4Ec7vgz+j/Z7B+Bok/qr7OMqXNhTMcFWrTN3eq5sc B9TyE7ngfqfbRoH0f7xnWu85ETa0j/GIZim4Lw7QZrKctw0ZLMG0FLlVUyDggVialc0f sRYgIyfD6Rvp5HhFEnSZqBUIN9uvRzwJD+yJMKFOpXpBWw67khoeI6p5AqKInQS9J4dF T7Xnl5ZqzT3pW8jcnpkTA4LXYO+JJj1CxQxQ5bVsroS6Li8a8YVPUCIzwNeCb3Ue+aiu 4AMA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nDByBN9n6TsI5q5tVuto0QI33cI72Cjl6m/jj0H+ogI=; b=GYWEjzUkctTLfZUHkq3/fAPfJnjtGFJniklTBle+WqzXRV/DEl1m++MZN35WoKWdr0 ZDgIBSyixhZXUAzkl1mBGL/Pf/z2nIdMQohdB5PqbEI0PS0shYGGfDPZY/VyRcrYJthz STvjL+YEMg+qXnxchQW9L8bEAvHJXeVHn4hSvsOgpRB02eMgquLdhN/rWEK3HLgz+ViZ Wu+F0jlZ8sMpEgwTFvMCTkecyqLHrIT8P8A7C8yXLjm8tVnUv/5S2Lj9088YiHZWcZUo 6HI3mP51YAfqKh5rAHjoCAch5RT7yBVLIzVaGhS55v33O6pmLWkSRg5HfQzielEkfmI2 8qIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=juKXwUex; 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 f64si38139122pfc.168.2019.04.30.05.09.01; Tue, 30 Apr 2019 05:09: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=pass header.i=@kernel.org header.s=default header.b=juKXwUex; 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 S1728344AbfD3LkN (ORCPT + 99 others); Tue, 30 Apr 2019 07:40:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:46214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728302AbfD3LkL (ORCPT ); Tue, 30 Apr 2019 07:40:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7903521707; Tue, 30 Apr 2019 11:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624411; bh=VcpKBqHheq+0zxr5mfTmUUIAIN1pPJCWkgC44Ioi6eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=juKXwUexu3IftoKNqljaZkbaGflbOE7LE6+CJVtEonplZAWFt0pG0hUoo9ODsJXxN irGGQBoiXyPYDkLhDjP/U4oFcJIyS7ClnEn7TV0HPotE2sgkJa6EWKFu86xAIBMa8e Jq/nRF9ZQzXhHNkv+50FcFp/rVsrxMVLHUWlbuw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paul Burton , Ralf Baechle , James Hogan , linux-mips@vger.kernel.org Subject: [PATCH 4.9 04/41] MIPS: scall64-o32: Fix indirect syscall number load Date: Tue, 30 Apr 2019 13:38:15 +0200 Message-Id: <20190430113525.306156222@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113524.451237916@linuxfoundation.org> References: <20190430113524.451237916@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aurelien Jarno commit 79b4a9cf0e2ea8203ce777c8d5cfa86c71eae86e upstream. 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+ Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paul Burton Cc: Ralf Baechle Cc: James Hogan Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/scall64-o32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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