From patchwork Tue Dec 21 15:52:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 12696999 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 409D7C433F5 for ; Tue, 21 Dec 2021 15:54:32 +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=nOBAQd0zJOOwXfGoIODd7EMikStntA0eRc3fQBcb8cw=; b=hAcyeXNZ0wrLPl TdJOPYnqhXz9dT+CXMnUC1mi/g2VF+LNJAZ/upsolx0rxUm27BQU4VUCNkLG+qblGP5hWBCOmCvzC 9KBNsJatSnMa0TP72OMMzaso/QA79u7brWPIhzzm7/i7nCCJ3mnHBvKkllCIsoyZ4rUUeFcPUmRwR 6VWk7UDMrU3SjWir9OntbCH/b5jjnQKqEmqOxe96Mh3WZzyfpyiVD9QUQUQDX/IzZjNfVrYKviixX VmGXciiqqfwZfScRH4mtCsRaWvNVbzRmMFNpy0AAPOMAjQ+lFnOkZ48DBqnRZ6FOpDqcTsM9U6Qkf wfoSM7JSKstmu95EkLYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzhRn-007Tfa-8o; Tue, 21 Dec 2021 15:53:03 +0000 Received: from fanzine2.igalia.com ([213.97.179.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzhRj-007Tes-Fw for linux-arm-kernel@lists.infradead.org; Tue, 21 Dec 2021 15:53:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2zhsc2cb4xEFs8Wda77ssM1+wxNVVNBSSIE/Y/Rns7k=; b=VsvmWt1fE/8xCg0V+cMQiHPuhg SC1HZ0BNcVJCz1KWYaYljlVDpYnCpB9nB+z+h7MrNFUy0R89INrSPgZpzsQi7tNvVS5LHdceaffj4 U2gl7K7c3scQbeRr3QD9sh0dTKjkRn8K8DJl+w2qBkqsBoAGZtkUw4W4KA0YzJ1BrhZbbSnPQ23Nd rMSPSTavx9sHghZl9P3fuvgJdtTNBuVEYSTXNRGB53CxSLbR3Xe2MPW0YqMdSwxHabi+XVA+xqV4M 0oz5x6SHPOCuPfK4zVwey/5rQbgGrVbuODwkK6w+4IVZuZG5XvlKw5mV/Ss95xjpi0fBxh+gIJYSY OP1uHsNA==; Received: from 200-153-146-242.dsl.telesp.net.br ([200.153.146.242] helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1mzhRc-0002vz-Eo; Tue, 21 Dec 2021 16:52:53 +0100 From: "Guilherme G. Piccoli" To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, u.kleine-koenig@pengutronix.de, gpiccoli@igalia.com, kernel@gpiccoli.net, robin.murphy@arm.com Subject: [PATCH V3] arm64: Unhash early pointer print plus improve comment Date: Tue, 21 Dec 2021 12:52:30 -0300 Message-Id: <20211221155230.1532850-1-gpiccoli@igalia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211221_075259_558639_4F4480B5 X-CRM114-Status: GOOD ( 15.11 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When facing a really early issue on DT parsing we have currently a message that shows both the physical and virtual address of the FDT. The printk pointer modifier for the virtual address shows a hashed address there unless the user provides "no_hash_pointers" parameter in the command-line. The situation in which this message shows-up is a bit more serious though: the boot process is broken, nothing can be done (even an oops is too much for this early stage) so we have this message as a last resort in order to help debug bootloader issues, for example. Hence, we hereby change that to "%px" in order to make debugging easy, there's not much information leak risk in such early boot failure. Also, we tried to improve a bit the commenting on that function, given that if kernel fails there, it just hangs forever in a cpu_relax() loop. The reason we cannot BUG/panic is that is too early to do so; thanks to Mark Brown for pointing that on IRC and thanks Robin Murphy for the good pointer hash discussion in the mailing-list. Cc: Mark Brown Cc: Robin Murphy Signed-off-by: Guilherme G. Piccoli Reviewed-by: Robin Murphy Acked-by: Uwe Kleine-König --- V3: * Improved commit message (thanks Robin!); * Fixed comment style. arch/arm64/kernel/setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index be5f85b0a24d..a80430550a73 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -189,11 +189,16 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) if (!dt_virt || !early_init_dt_scan(dt_virt)) { pr_crit("\n" - "Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n" + "Error: invalid device tree blob at physical address %pa (virtual address 0x%px)\n" "The dtb must be 8-byte aligned and must not exceed 2 MB in size\n" "\nPlease check your bootloader.", &dt_phys, dt_virt); + /* + * Note that in this _really_ early stage we cannot even BUG() + * or oops, so the least terrible thing to do is cpu_relax(), + * or else we could end-up printing non-initialized data, etc. + */ while (true) cpu_relax(); }