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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1645BC433FE for ; Thu, 3 Nov 2022 17:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ks2SnuOgBWv3Ljf/2ujQBHsE4FLdBl4Qvmt/QH6a0mc=; b=lQjuvadjQiKBs/ XYqRZgaSHIB3J5wbEE66hAvmzA7APqUDoxZGO5whHFWj+kYWxJLbLh8s0z8Fce6EdUlpuvxnaximq pEIUJeIEAe6AYqryD6Cjbdd3tEdG+SAjWuqsJwcCnwurxcf28f2ThnkWLGMvDHRCq6uFweg9Lly5z R62ygULjCy92L/KNgig22C+V0NTjcilMffjl/N7RrbW++HdeDVPI6X0SLi2DWXSDWS6rXPfHMBDgb LZaVUpxurJwIj0L2OnwrY1g8nEZF42VdgJye2BGdE8T+ZEECeNu4jG+ytRoXvTMJnt4u0znahe0zl SHo6mr8VDQzTw/5NHk+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqdn6-000zHr-4Y; Thu, 03 Nov 2022 17:14:08 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqdZu-000tUn-GS for linux-arm-kernel@lists.infradead.org; Thu, 03 Nov 2022 17:00:32 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 6CC3361F5D; Thu, 3 Nov 2022 17:00:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 954ECC433C1; Thu, 3 Nov 2022 17:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667494828; bh=Y34czfNUehZ/VjyPSPbFXCZfqx8cIfegzRZ5a237UrI=; h=From:To:Cc:Subject:Date:From; b=KMGfDC0V0n/qRHlJrbwzQXQ6sG2mhql6OyAc0nDLsq80TBxIxX2BhItacQsCXiARF eR/aDF3PkS/Brbn8NB61Kvg9LQTLdxAMFVyYJMKqZbNYxOPYLn2E1DtfhV8/4UKRVi T2LWLDJIoUqUlFobokHT8+/op58ej671+IYZeJu6dM+ew7yk03cdWJNIvHOqUaYfOT uVgUMWMxfad2g7PYKrH/R22vRNIzXzLYJIDxOR5Em0olBvwQ270FwJ+Sfg5NP24VKb G+Ze4IQbdg68iPLJjAxn5U7JtQtnzzN2uZFXTxwDID3d4DZhd9u4y1n4n9V8w7WKth 6Quj7YgAwfHOA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, Ard Biesheuvel Subject: [PATCH] arm64: fix rodata=full again Date: Thu, 3 Nov 2022 18:00:15 +0100 Message-Id: <20221103170015.4124426-1-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2033; i=ardb@kernel.org; h=from:subject; bh=Y34czfNUehZ/VjyPSPbFXCZfqx8cIfegzRZ5a237UrI=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjY/OeTRQWZ/xi7pduCHEsIkmjQTJPjjKnky0aCBsb XbmMEgmJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY2PzngAKCRDDTyI5ktmPJGYGC/ 93Ah+eCpoSkvSGYv/acFH1Wrmvz9IXP1Dc92rjR77PUpfb7UDHwmwrwAqLg3ifllm2zYj/vCd6Sa/k 5e4USM8jp8Wne1kqzZupI1HwQ1DazbRzqRUGplmX9r7/vbbvkfp7VYCK9J29TsE+e7tINUjpTeTK52 u1SwC8I8daUupFdMUDbUashYSyyHU0RtYXtVyRU1GOHmW/jWuLGTHHA/p3sjGIpzQJ/I/N1AZ/t1Wa cq3ypu8OyS5M5xrRA6eR4x4LnVMkNKRf/HyGO8jUvTl/9+xOX0VU9V9m+pbjoT62UFvhYhzJCZSwUw SGEA/JXLbXJ5ucS6jvWUoHhHIKkyZK4hGUGv1tpGmskAjrchWh1Wq2KUdgyb7ptRhH1LSPDcVSM59w 9sB2u7s+Kr1b940FnsfTmsprI9JOwZLgTduAMOUstt+qxzKKVod4lxcyhEGVab4i9ui8A4FiUct5OM Ll/zgY/Fc7UOwlmpexeu/03vDWXazQvmmguGzNkjhtc5Q= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221103_100030_699680_6DBC42F6 X-CRM114-Status: GOOD ( 17.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 2e8cff0a0eee87b2 ("arm64: fix rodata=full") addressed a couple of issues with the rodata= kernel command line option, which is not a simple boolean on arm64, and inadvertently got broken due to changes in the generic bool handling. Unfortunately, the resulting code never clears the rodata_full boolean variable if it defaults to true and rodata=on or rodata=off is passed, as the generic code is not aware of the existence of this variable. Given the way this code is plumbed together, clearing rodata_full when returning false from arch_parse_debug_rodata() may result in inconsistencies if the generic code decides that it cannot parse the right hand side, so the best way to deal with this is to only take rodata_full in account if rodata_enabled is also true. Fixes: 2e8cff0a0eee87b2 ("arm64: fix rodata=full") Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/pageattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c index d107c3d434e22455..5922178d7a064c1c 100644 --- a/arch/arm64/mm/pageattr.c +++ b/arch/arm64/mm/pageattr.c @@ -26,7 +26,7 @@ bool can_set_direct_map(void) * mapped at page granularity, so that it is possible to * protect/unprotect single pages. */ - return rodata_full || debug_pagealloc_enabled() || + return (rodata_enabled && rodata_full) || debug_pagealloc_enabled() || IS_ENABLED(CONFIG_KFENCE); } @@ -102,7 +102,8 @@ static int change_memory_common(unsigned long addr, int numpages, * If we are manipulating read-only permissions, apply the same * change to the linear mapping of the pages that back this VM area. */ - if (rodata_full && (pgprot_val(set_mask) == PTE_RDONLY || + if (rodata_enabled && + rodata_full && (pgprot_val(set_mask) == PTE_RDONLY || pgprot_val(clear_mask) == PTE_RDONLY)) { for (i = 0; i < area->nr_pages; i++) { __change_memory_common((u64)page_address(area->pages[i]), -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel