Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9111799pxu; Mon, 28 Dec 2020 06:57:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVUorU99vxDcfscNZUXmSVYvEasYTmUd2e+iygdIE0TNfuN0foczGCxqikWOxCc5J6woWH X-Received: by 2002:a17:906:fc3:: with SMTP id c3mr43265485ejk.474.1609167461447; Mon, 28 Dec 2020 06:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167461; cv=none; d=google.com; s=arc-20160816; b=bGAjYbL0SndAAcxjABqKVbgZaOFMFYeK5/SMccU5wkAmqNgM5OL2slIwP8ICBrH896 8KPx9xgLd9qrWGJomZ4+rkxo6DacDcjgDPlVTvPKMlZ7wAtq00+cpPkrIxVlkIubeVZ0 VGqK2pOxP5CNCqly63ynzKY3aS4o56j+JYfXcJUk0c/hLFX77ff+iSIHzBIlV9ga8sK0 LYrzxmAuV5pS3p2kNLpBH6vruJhyydB18/hC7i3nKPQC8ePY9ZiBaO8Dmj2/FLU+BaFO Xh4mCbkHXR39jCkdkbCnTGhQdKRY1zQeYcbGbXI0UuabkaI2eFawP7xV1+ed/sLUuFT8 Ixww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kS4MNVLK2xW1hQthltBeQU8hRrxpQmjldo7tgpyfcbY=; b=UbKjbQMX7GNWI8LbOtpkYn3kajsTGxcnjwwqTlzk5vq53o9eaTsDdazKPtnUVk3FOO i8jEf0uIq5nM6MxpY88HBtDmhBFpVHzRaG35J2+9CKZGKPXkphV89U68s6QjuvF0gjFC 4gACUDFGrlT8qqvJ7FqMr9bA/XjsxxbpoMjNTiVNU03WLZC1rQ9hZX0asZRVbCUkGqzB mOL5c7/RNA8NSvZNamCe+d9IW7oIKsAlUtsLtHkC8i3RGenn9oG52Nnvmuudj6KlEOTY QKlhc05W28/tZ9wnzlqg3Egrsc36bzO3O8fk/guU3pSV5yIpSP3jLVe8xqYEjxUCUyVk qdVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OBRlbtUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si8849186edd.322.2020.12.28.06.57.15; Mon, 28 Dec 2020 06:57:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OBRlbtUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439286AbgL1Oyg (ORCPT + 99 others); Mon, 28 Dec 2020 09:54:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:52332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441393AbgL1ORM (ORCPT ); Mon, 28 Dec 2020 09:17:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59E61205CB; Mon, 28 Dec 2020 14:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164992; bh=RlDsBlXLsQ3QoR4KAsOlMurTbZ/ADKzYradXQZvelg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OBRlbtUft8X9UM5uR1FQQ6w5dhei7K1B2LhLihOAG8NtWf9umXKCGk3V6STqzlGBH dU+2CzybvTnOVN4Ua2qy76M5iS0/1esw+TJyReKUgrErwk59hM9VdYYbUdaW09Z/sA SgNa8Wq0PJy2/kjTfH6Pg9pfwOeuBeelhRX/2Olw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.10 371/717] powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S Date: Mon, 28 Dec 2020 13:46:09 +0100 Message-Id: <20201228125038.782440876@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy [ Upstream commit 7ceb40027e19567a0a066e3b380cc034cdd9a124 ] The verification and message introduced by commit 374f3f5979f9 ("powerpc/mm/hash: Handle user access of kernel address gracefully") applies to all platforms, it should not be limited to BOOK3S. Make the BOOK3S version of sanity_check_fault() the one for all, and bail out earlier if not BOOK3S. Fixes: 374f3f5979f9 ("powerpc/mm/hash: Handle user access of kernel address gracefully") Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/fe199d5af3578d3bf80035d203a94d742a7a28af.1607491748.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 0add963a849b3..72e1b51beb10c 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -303,7 +303,6 @@ static inline void cmo_account_page_fault(void) static inline void cmo_account_page_fault(void) { } #endif /* CONFIG_PPC_SMLPAR */ -#ifdef CONFIG_PPC_BOOK3S static void sanity_check_fault(bool is_write, bool is_user, unsigned long error_code, unsigned long address) { @@ -320,6 +319,9 @@ static void sanity_check_fault(bool is_write, bool is_user, return; } + if (!IS_ENABLED(CONFIG_PPC_BOOK3S)) + return; + /* * For hash translation mode, we should never get a * PROTFAULT. Any update to pte to reduce access will result in us @@ -354,10 +356,6 @@ static void sanity_check_fault(bool is_write, bool is_user, WARN_ON_ONCE(error_code & DSISR_PROTFAULT); } -#else -static void sanity_check_fault(bool is_write, bool is_user, - unsigned long error_code, unsigned long address) { } -#endif /* CONFIG_PPC_BOOK3S */ /* * Define the correct "is_write" bit in error_code based -- 2.27.0