Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4812698yba; Tue, 30 Apr 2019 04:56:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0/s9hXrBgLpYHqXjJ6n089VrTWiNx5a+ugHcUwDiW41BmMMozfeO1EeVSTRleXrs+umgP X-Received: by 2002:a63:7d0a:: with SMTP id y10mr65117299pgc.292.1556625391916; Tue, 30 Apr 2019 04:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625391; cv=none; d=google.com; s=arc-20160816; b=v0GDz6y8cZCs9oOtof8JsCnzCgrhaYyNXR1ZDrnp9Yz2nFg/4XCYa1FW6jnTB7YdJm gXAzhaJGSpUz/Pitxs1TrxXFZBtugAswL5d8EJdEiDHJreswtRqiq+OxIg8rDVWyYfeZ +gFign85nSLex9HyKyGCf79tUpXcuWZak+cZJWLrR2AqpAQocN6ze373Ku39cso4UaRE 1pkTV5fkgaLbkOggJ3ok+yML7GYS5Fvzuqn8TNb6A6giX0jl1zvLNC38HaAoHDo2TQZw bOADXoh+Hn2/5LCksPsIwYT/kJnIScTvhuEmqujjc3TxKwrww25ifTfdq2SDfyA51ERr VXJg== 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=CgnGSXSota2i8QTOAFgq7PaxkjjFOJ0EW8JEAsKTH6n7oRBOgbajeMQqVoScJvw9fM eHPsACWanrZRU5D4Y3Bf8Qhr5pMFOzvDzzPLzXV1ZmZtoxaek0hrxJehEaMEJXBaUlvL d0ibPmvm/ZYJ2WiGq6oeGGhG7JcTr9G3cpU7/0OlVFBllerRX9QH2okzE6Aqg7EAyNI/ bMbGSGqHfOKTDDgeCN/I6vXpScUtagprxnWeLPyni3PCrApD5AesQVeXGOV6+To7ttRP 2br0iS67yhsHVXUoFilsMG3uD7x4DPq+GY/TstTy74z259m/q2u0wadysM1QOWmMSPLl yBUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ja10iL6b; 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 t21si4526190pgm.438.2019.04.30.04.56.16; Tue, 30 Apr 2019 04:56:31 -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=ja10iL6b; 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 S1730773AbfD3LuB (ORCPT + 99 others); Tue, 30 Apr 2019 07:50:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:36736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728292AbfD3Lt7 (ORCPT ); Tue, 30 Apr 2019 07:49:59 -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 C1AD92173E; Tue, 30 Apr 2019 11:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624999; bh=VcpKBqHheq+0zxr5mfTmUUIAIN1pPJCWkgC44Ioi6eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ja10iL6bC1ja59PDwGnq91fkFVpz3izxjHkkx66HeOZ03GPP7lmFkG3oP4S6aYiGW Iipq571P0J5xPg4k1zbp2+Rm8MUYF58wlHdU867We89QJHWBuNpRYIqDI5Eiqf7mrp AG9kr3B4Xf7hb1ynzDePH3id645usdUYvVdNvo8U= 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 5.0 18/89] MIPS: scall64-o32: Fix indirect syscall number load Date: Tue, 30 Apr 2019 13:38:09 +0200 Message-Id: <20190430113610.599586112@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@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