Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp442763pxu; Thu, 3 Dec 2020 04:23:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmi0vOTGE+30mP6tVZJ/73LhMmB1Uit4dapZy91EAk1qduCOEl3rHY9jKArD/j0gfNdxvW X-Received: by 2002:a05:6402:d08:: with SMTP id eb8mr2604268edb.271.1606998196899; Thu, 03 Dec 2020 04:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606998196; cv=none; d=google.com; s=arc-20160816; b=JvENO/QiU3cbMZJw1g53tI3iKyHrIDHz0cea3lxbpBgemO1waFQOmcpzu7afXn2UTM gtNAdo7//L6nOFxp26lRq8rRZO2xzGCzcgV0DpjQMXon+glKpdl0cqKLp1griZ+2YFFO xtD0hLbBXA0A/ekYsKqGZw3Lecu+Ae7D42/JJlcf2Jy+9T/m916tmCPnhaHWc3oPVpaZ 62lebPmrnb3binW9ixG3Wj+Vs+cad8jYQhB36lIY6lAU/xX0JvcapIHH0JxOHi9x9Yhr 1F4p8fyIJ4vr3FMuuT0DXtJCv7an/91Rfg/UrpMDRxGGXmNSB53R/W6Jj1+rQ2wDt5e5 dylw== 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 :message-id:date:subject:cc:to:from; bh=6t3yduLrh3d5EGD/p0497kOw3OwCDV+Et8iSzEnsmhM=; b=wj0V/l7NgH8Rc+iFggqDo+2OHwIYNYCkC5kjwmhDDCu88f9mc6VWeA5WLa4JL8G2/t kBEnh64UiuCpqWkEC7J1lghxlMfAXtc1vu3pNXOt7pvUwq6TJTl7eqTz/Y5MEXwvDcQk VG+1G5Cz5cAdQV9NnJqay/jw841ifjbZ79WtD9RJffuwFPGiwF8687jDAo3zdYFsFihn qiHd2CSCU16kod3QoDk9pgfRH4hXfF5qQlPH0KSwxhxmnBDwMzYybl83aXhbiNkBWZNz zD07myDkbI5O7i9sxxAAimztm3ef1KHKfWR3jXDq3nxLZP+XqAAr579T3QSJVQZFwA4C ERHw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si839288edu.534.2020.12.03.04.22.53; Thu, 03 Dec 2020 04:23:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730404AbgLCMUQ (ORCPT + 99 others); Thu, 3 Dec 2020 07:20:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730285AbgLCMUO (ORCPT ); Thu, 3 Dec 2020 07:20:14 -0500 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E859EC061A51 for ; Thu, 3 Dec 2020 04:19:33 -0800 (PST) Received: from ramsan.of.borg ([84.195.186.194]) by andre.telenet-ops.be with bizsmtp id zoKN2300V4C55Sk01oKNUN; Thu, 03 Dec 2020 13:19:29 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kknZy-007hFn-IO; Thu, 03 Dec 2020 13:19:22 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1kknZy-00C2t9-2B; Thu, 03 Dec 2020 13:19:22 +0100 From: Geert Uytterhoeven To: Russell King , Nicolas Pitre , Ard Biesheuvel , Marek Szyprowski , Dmitry Osipenko , Linus Walleij Cc: Arnd Bergmann , Eric Miao , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lukasz Stelmach , Stephen Boyd , Chris Brandt , linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v10 0/3] ARM: uncompress: Validate start of physical memory against passed DTB Date: Thu, 3 Dec 2020 13:19:13 +0100 Message-Id: <20201203121916.2870975-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Currently, the start address of physical memory is obtained by masking the program counter with a fixed mask of 0xf8000000. This mask value was chosen as a balance between the requirements of different platforms. However, this does require that the start address of physical memory is a multiple of 128 MiB, precluding booting Linux on platforms where this requirement is not fulfilled. Fix this limitation by validating the masked address against the memory information in the passed DTB, to support booting Linux on r7s9210/rza2mevb using the 64 MiB of SDRAM on the RZA2MEVB sub board, which is located at 0x0C000000 (CS3 space), i.e. not at a multiple of 128 MiB. Compared to v9[*], the major change is a step back, and only supporting this on modern systems that pass the DTB explicitly, with improved validation to avoid regressions. This has been regression-tested on a variety of boards using a passed or appended DTB. Thanks for your comments! [*] "[PATCH v9] ARM: boot: Validate start of physical memory against DTB" (https://lore.kernel.org/r/20200902153606.13652-1-geert+renesas@glider.be) Geert Uytterhoeven (3): ARM: uncompress: Add be32tocpu macro ARM: uncompress: Add OF_DT_MAGIC macro ARM: uncompress: Validate start of physical memory against passed DTB arch/arm/Kconfig | 7 +- arch/arm/boot/compressed/Makefile | 5 +- .../arm/boot/compressed/fdt_check_mem_start.c | 131 ++++++++++++++++++ arch/arm/boot/compressed/head.S | 70 +++++++--- 4 files changed, 187 insertions(+), 26 deletions(-) create mode 100644 arch/arm/boot/compressed/fdt_check_mem_start.c -- 2.25.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds