Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3695974imu; Mon, 28 Jan 2019 09:11:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KxU/dTpibVJa4fWKv6/3YHPJeB8jU4aIDTmAoY2D8ZPIwyIfvdHDWMBarAHiX7gnxFvbE X-Received: by 2002:a17:902:8346:: with SMTP id z6mr22518876pln.340.1548695518217; Mon, 28 Jan 2019 09:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695518; cv=none; d=google.com; s=arc-20160816; b=AJdhhyGLcc0764pqdp2Uh2a1o5xXNjyO6UWgyCPtxn/mRAhJm3xqGQLNf3bWQg7JO0 bJCzU+LNyi6tV9PhvcSw0brjK6FL5XfJxKH8qI+zy/8scwKKEBY4JdyMhj85FZQtZdfp ekeWwe2KOfzjTxvlLWBHZmZ/ZOwJoWXcn9+5M7BdmNPa38hLGWOh7dUkWuxhi9H6p6XV MmFZ2DEhlFEF51o34FRjpjLikw8SWqAxspYDyg5lHtNpDH0MpKKJm0QzbLsWrKWgM6cQ hYxmguAXM6S8vjRytWEMO1BpLEb26oZAleahJs5+6Tdhem13jCZXM10gc2ULG+Zg/WFf s14g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G2tb9bWxI62AsJ7pW85ebIxLFmSMdSdOE/uwuu5tEAg=; b=ByWFEGj3z2IPBdiLPK6Ncq+fxX5mtzMsyOmBkjvCaokoQOdMu68tM6YWQBzdEjpycM NVSEtYqJIb9sigHGA7RzAqydZY/4o7BgIBCtcsI6KmxN7pAnnVc5ZBduqVhg8WHzDuXO 1M+xAgX8eMuQmRcOFXuEdbJmQ58byGP5/Vtx6cCuVFVSbg1yFnT7k7PZYUsteRInix4N rWUda15WD+XxdXDz3NBAcCQ8j3kxhANFhuegt96NoiDj4Oa55eSggMI3HS6HQGkbDGzv 6aEcgLp10Y/WFMfNo06iSIMnFruaVwVY65dxSxd/KKMx2rmRii32Q9+8Laicn6M4zbNY EEAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XFCbOYfi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si32784870pgm.25.2019.01.28.09.11.42; Mon, 28 Jan 2019 09:11:58 -0800 (PST) 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=XFCbOYfi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731481AbfA1QJi (ORCPT + 99 others); Mon, 28 Jan 2019 11:09:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:34490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732625AbfA1QJf (ORCPT ); Mon, 28 Jan 2019 11:09:35 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7260D2147A; Mon, 28 Jan 2019 16:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691774; bh=RMi0e0CDUAuFkaSbf4p/powFKhaSq2krp0wsTVJA5CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XFCbOYfivsc6y4sDL0kG3a/ry7G/sRYI4IwaWW6TaZr4Rp6a5v7i2Mhsy/Dh8JDZh tVa796StSzowOsveawP9BDfzostsguVoNZGzeL1tsXyj3+qUk/ze2r9e+oAhuWVTUZ YvtQEuLBdwAstWVZhhxCuThq/PbRh3j4QQZM+L24= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe Leroy , Michael Ellerman , Sasha Levin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 4.19 212/258] powerpc/mm: Fix reporting of kernel execute faults on the 8xx Date: Mon, 28 Jan 2019 10:58:38 -0500 Message-Id: <20190128155924.51521-212-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit ffca395b11c4a5a6df6d6345f794b0e3d578e2d0 ] On the 8xx, no-execute is set via PPP bits in the PTE. Therefore a no-exec fault generates DSISR_PROTFAULT error bits, not DSISR_NOEXEC_OR_G. This patch adds DSISR_PROTFAULT in the test mask. Fixes: d3ca587404b3 ("powerpc/mm: Fix reporting of kernel execute faults") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/mm/fault.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index d51cf5f4e45e..365526ee29b8 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -221,7 +221,9 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, static bool bad_kernel_fault(bool is_exec, unsigned long error_code, unsigned long address) { - if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT))) { + /* NX faults set DSISR_PROTFAULT on the 8xx, DSISR_NOEXEC_OR_G on others */ + if (is_exec && (error_code & (DSISR_NOEXEC_OR_G | DSISR_KEYFAULT | + DSISR_PROTFAULT))) { printk_ratelimited(KERN_CRIT "kernel tried to execute" " exec-protected page (%lx) -" "exploit attempt? (uid: %d)\n", -- 2.19.1