Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp209282pxu; Thu, 7 Jan 2021 02:50:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDGQXWRfDP44Btl+TX6CzSGOCU0oy8s3cHqN8gKXe4rdDUU53Ql4N+n+hpyol0/1g1nApb X-Received: by 2002:a17:906:3a55:: with SMTP id a21mr5996802ejf.516.1610016628171; Thu, 07 Jan 2021 02:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610016628; cv=none; d=google.com; s=arc-20160816; b=H4nVvpa27q52LJAwjs3tbvd2mZL4jftwIGJ/XO0E4teW1gfDJsU/IeKUSUeQmdQ16y rrqkFZ+8Y61ks+T8M4dBY5GfmXvbPguQzGGeR9cpXQPLEIz/PvoI7uufmw9eqA9rF9Uu T2dIvGyotw8BA8nr8iX05ai+7NfYSoQuyIEoDk/V4Gy4bKU/iOq8uYmYWQbYfENFZyWg hrCdIjDgpXDSeMo5hG9iz0dRRudVbOQT4dEONFPTPcCc9NuX0dVesBIzGi0qr86ZNqbu 9ALuPN3RJSAwIXwZgj9dO0lc4urknTogE6OHEmbWc2c0rqLKU266GM81neL5u1BIRnai Dacw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=YlI/dvDuqK2iZQq6ulxYP2CcumyyIAj1ehw9bOUkprE=; b=usgRQDIUJxnyQoi6xQA71JjgBnz7CHOuencgvHMCUJeXkpsaO6wtwLOLbRLVE/4lSQ zDf83FW4hwLOoVjN81b/DRyyrLD1T4U51DkNEfqJ0m0i6gFjjPpsWxiSfmKjlfUv2Fhj a1J1h7lVhJLlrXGC/7Dh+09e468T+gCyV6vXmLvAnid2/v6Zq1AQZPjizVCK6N+1Cyhz +HokR21Lmet1hByBa4YysFYtgPVJ74Ly8IOPjda/PjzvO/SG40ru6xkCOlA4g9yqnr0n BaDVZptleH9M9D5dv6dr2DaR2Kk70YMaxqJFkInI37kqeqyU/Ce55DtZs+XLMV45kVyZ 63Ag== 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 u30si2109636edb.89.2021.01.07.02.50.05; Thu, 07 Jan 2021 02:50:28 -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 S1727787AbhAGKss (ORCPT + 99 others); Thu, 7 Jan 2021 05:48:48 -0500 Received: from mail-oi1-f169.google.com ([209.85.167.169]:38252 "EHLO mail-oi1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbhAGKsr (ORCPT ); Thu, 7 Jan 2021 05:48:47 -0500 Received: by mail-oi1-f169.google.com with SMTP id x13so6918400oic.5; Thu, 07 Jan 2021 02:48:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YlI/dvDuqK2iZQq6ulxYP2CcumyyIAj1ehw9bOUkprE=; b=ojSQ9ztTRWok5+KGbIhaszxTcUltocOFXHWbh6/I+dLRGchYaPf8cbjkVhXZfE6Viv bXVzrkIhPtSKE1SYOhVWZXtaeB6HO9kyJxrSxXTaKocS6aeSWgR5Y3UGfg2fB5nr70OY I73vsfOvRJUSyozESeximKGP2t1NvHkviJOkPOKNGB4HPSOcSoYLGYKduZ3tvxru6NPQ fv+TQQCC3dqLyDwqNh/SLDpZLvIeVvP7C1lrRa/KY16nV+0VBmVFJ5aCONEWt/qhAHij gfYAzSQ0hGwygB7rtlSCRJA+Kt8+VvxFhsMPjvrVr4v9C+TCmDg+mfKLO66gi7dd5PMY eAZg== X-Gm-Message-State: AOAM5326ySUShVImFKfLgc2Vzv1xqW12lLdx6S51spSUSrqgse1siccC k+Br/nNqRJzwSkMbQYe2KDkz2ygk9iVNz4OCF4ZJuAJI X-Received: by 2002:aca:3cc5:: with SMTP id j188mr968500oia.54.1610016486872; Thu, 07 Jan 2021 02:48:06 -0800 (PST) MIME-Version: 1.0 References: <20210104130111.1269694-1-geert+renesas@glider.be> <092e7ed2-da95-fa4a-9949-1a23388a7b67@samsung.com> In-Reply-To: <092e7ed2-da95-fa4a-9949-1a23388a7b67@samsung.com> From: Geert Uytterhoeven Date: Thu, 7 Jan 2021 11:47:56 +0100 Message-ID: Subject: Re: [PATCH v12] ARM: uncompress: Validate start of physical memory against passed DTB To: Marek Szyprowski Cc: Russell King , Ard Biesheuvel , Nicolas Pitre , Dmitry Osipenko , Linus Walleij , Arnd Bergmann , Eric Miao , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Lukasz Stelmach , Stephen Boyd , Chris Brandt , Linux ARM , Linux-Renesas , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, On Thu, Jan 7, 2021 at 11:36 AM Marek Szyprowski wrote: > On 04.01.2021 14:01, Geert Uytterhoeven wrote: > > 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. Only use the start address > > from DTB when masking would yield an out-of-range address, prefer the > > traditional method in all other cases. Note that this applies only to the > > explicitly passed DTB on modern systems, and not to a DTB appended to > > the kernel, or to ATAGS. The appended DTB may need to be augmented by > > information from ATAGS, which may need to rely on knowledge of the start > > address of physical memory itself. > > > > This allows to boot 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. > > > > Suggested-by: Nicolas Pitre > > Suggested-by: Ard Biesheuvel > > Signed-off-by: Geert Uytterhoeven > > Reviewed-by: Ard Biesheuvel > > Acked-by: Nicolas Pitre > > I've checked all of my arm 32bit test systems and they still boot fine > with this patch. Feel free to add my: > > Tested-by: Marek Szyprowski > > although I didn't test exactly the new features added by it. Thank you, regression-testing is very valuable! 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