Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp519948yba; Wed, 15 May 2019 05:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ1RkGjWJR/1kOe4FZ7827hCzieQMv+VxytGRzewqsPr8ORRwnmHYam06Na0DOYNCYqm9h X-Received: by 2002:aa7:9dc9:: with SMTP id g9mr10038824pfq.228.1557923628382; Wed, 15 May 2019 05:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557923628; cv=none; d=google.com; s=arc-20160816; b=wy2T+ELb9kTKlLPw2aHGTOjdZbkr5Y+ODKjRui+3XFAUnMloeM2sQbr05R9zVR94J5 7u90cpgctVYQfr9wmpN5kjwgn+N7ZocSidQoUaMIZ5SC47ytYjNeRZnAVOLO41+3gTW6 NbokCWmWS4bG98NTWekSuySmFGjq9EsWuplWIu7KQ52bibNJzmLnfSni1wNw1vaVdvlK e1+gE2B1IOX17fQr67OxlM1jGJKT/aqSu6oJ340ijE60HDwqBBEIye90kxQO2hQi739C AuGUb2McESDBbvNQr3PMgIPHLF8BAxNhCYSg/AOzx+gqJc9+++zDkGtd3KxoVCYoiwHi hw8g== 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=+E/FbFCze4+7ty80ZFeYyZ34bMONGedYeRhpZFSJdxI=; b=VAj+T1CpuX9zD5yrmEYeg7C7TppVVmxELia6R8giv2rZdc5QKLX/RXi+yzFZCsN/zM uOF6DCVccyNd2OZEJl2yDhTNIAdY7YCQKS4WmYVAhKSBmJuXYzxX1r1cWpKTxxCxaE99 94HzOg/akQe/JaRg15Wv3Wlq0/rxsk+8CS+kLgTv1OktPHRf+tSb3EHAuLdZBC2oM6Js qBi+9s5PLBmHZ/HP0aTxc1qqBBUZ+NQSUoXNbfA2JUDB5G5XN+6Y5lZJidCRP2XZN9Uy X8l3iI5cN8s0NBSOInddRTmMq4n2bRHjfBqtJFYvkJiAoCQBBPu5KDQ6aZoQJJSIjhyT D7fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IAVXNqPB; 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 v4si1504607plp.404.2019.05.15.05.33.33; Wed, 15 May 2019 05:33:48 -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=IAVXNqPB; 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 S1726510AbfEOK56 (ORCPT + 99 others); Wed, 15 May 2019 06:57:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:54032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbfEOK56 (ORCPT ); Wed, 15 May 2019 06:57:58 -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 C664A20843; Wed, 15 May 2019 10:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557917877; bh=zdqV+gGM1iZKehcvajFQ2Xm8334zHYYzni/D26PO5eA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAVXNqPBMmVpR/WdPgwKgxgw6c5QpB98ufkKNKT5hRUCUyjXoYwWYybdjRxSMqE7K 2tBokGy2DiRQ2KkU9FUpqUgqU437Po4e0I7zJUIMk0IsijPG0dCJjNcZTKv11/4wXk 4LcmPgSkiuBiIhMOvcFbYMIIy9+RQtxUhZG4qIEU= 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 3.18 01/86] MIPS: scall64-o32: Fix indirect syscall number load Date: Wed, 15 May 2019 12:54:38 +0200 Message-Id: <20190515090642.619754300@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090642.339346723@linuxfoundation.org> References: <20190515090642.339346723@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 @@ -124,7 +124,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