From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE7EAC43334 for ; Mon, 13 Jun 2022 10:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344582AbiFMKbo (ORCPT ); Mon, 13 Jun 2022 06:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244430AbiFMK0d (ORCPT ); Mon, 13 Jun 2022 06:26:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDB50245B2; Mon, 13 Jun 2022 03:19:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74F1EB80E5C; Mon, 13 Jun 2022 10:19:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1D2EC34114; Mon, 13 Jun 2022 10:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115583; bh=0evX1aX+8vGsL+wWX4IQfjHNmGv7ZxnUybITsf+ORBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUtSNPHZtuZlTbWgJBjSCn7TfKAWQrqosC4D0JZqTxoYsdDyZn7NBLpOm5BMWbYub LByomx/5BuXcm3Zdb+N+5tc1jxkQboE4AFn4wwJRorjFiSB2cywtXv4maz3snmPHCX lC/1YehJYJwT4un6ylackIhKO5Hr0TIR1qM5vHRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickens , Greg Ungerer , Sasha Levin Subject: [PATCH 4.9 129/167] m68knommu: set ZERO_PAGE() to the allocated zeroed page Date: Mon, 13 Jun 2022 12:10:03 +0200 Message-Id: <20220613094911.120736832@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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: Greg Ungerer [ Upstream commit dc068f46217970d9516f16cd37972a01d50dc055 ] The non-MMU m68k pagetable ZERO_PAGE() macro is being set to the somewhat non-sensical value of "virt_to_page(0)". The zeroth page is not in any way guaranteed to be a page full of "0". So the result is that ZERO_PAGE() will almost certainly contain random values. We already allocate a real "empty_zero_page" in the mm setup code shared between MMU m68k and non-MMU m68k. It is just not hooked up to the ZERO_PAGE() macro for the non-MMU m68k case. Fix ZERO_PAGE() to use the allocated "empty_zero_page" pointer. I am not aware of any specific issues caused by the old code. Link: https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#t Reported-by: Hugh Dickens Signed-off-by: Greg Ungerer Signed-off-by: Sasha Levin --- arch/m68k/include/asm/pgtable_no.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h index ac7d87a02335..269443e1084b 100644 --- a/arch/m68k/include/asm/pgtable_no.h +++ b/arch/m68k/include/asm/pgtable_no.h @@ -41,7 +41,8 @@ extern void paging_init(void); * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ -#define ZERO_PAGE(vaddr) (virt_to_page(0)) +extern void *empty_zero_page; +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) /* * No page table caches to initialise. -- 2.35.1