Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp277595lqs; Thu, 13 Jun 2024 09:43:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdlyWJaYPjRuPxmDjYzD8fz2mLfjGD7iWZ++C6vnv6G87OiASeFXgT86BsBfs2vFbSkFI1lfoGjnCOofGphA5fEyBdDXjdv3b7e4bNUg== X-Google-Smtp-Source: AGHT+IGVqmIQddpqN0qjfnz74NI8mjaafbtiRF1A6x0dS71EEnyWpkSabrGBVDbXK00fm9FS6t/p X-Received: by 2002:a50:9557:0:b0:57c:6afc:d2a9 with SMTP id 4fb4d7f45d1cf-57cbd8f2a3emr227555a12.26.1718297006933; Thu, 13 Jun 2024 09:43:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718297006; cv=pass; d=google.com; s=arc-20160816; b=tPhkqIf1CgL7M45x1EmzdnrR+hY7CM42M3PnJ2yeGIRu+EfcItD2Lc0RMRN5b9JFJB LX1tvgk+iw+5lp6Jlc24rVYybBc27D0X5bYYl1eytjRiULsxIM0prjF037JF+kluaVIO KpT1Sc7VQMm1tVuAnVe08olmXOw8cmKDMMIGWyKEIWLPkALjDWl4YRT2+dRoGaylnLbM LT1cU/7tMEYv3c/ga8x9MtB2PXa2W1u87eemC3+KzknPA2L5/6FUAYo5Oz+7w5SgnIXJ V4JWDdJw2Hi5AgeZZjo6Dw1E3ygJ7pKiADehkoESO9loM9VEAhFZoybCz/sTgkgH7jKJ m0Zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=a7eDnx/cZDpbixJmVjvIErbIrnZeY3Xb1qwzBjK+wtI=; fh=OpLp6UvusTyjcl0YaJuYDR98Q0mWEIE5HjT4Dqa9gdM=; b=cB/5j8kUHZ8HO7ekzDc0aJBxqE7d8cl8TqJfWgNEFK14pHlcX2Z6BrAr3B2AmZKjTJ tc+Hwaw2hboJQi7XOwmHOsNAlvLilahA02rK6eVAsNbshGdr14FZTmh+C/DCwMztRjri kGPgJUUV6iVegXnS5xsviwGC91ncpRy17n6draYmYpDA0irmJIIzwDK29YDLL09RtD8y 1tiHRKVCf84fZ4lmsLJmDpdU1Z9PeXYZLAbmvaBooVmvZwK0eAJ6IIhzOk5hdp3ecaIP KyGxPr8+B2h5gkFoZaQc3WO+r0nkdcyj3Ogtm3078grU7aQHhy0slyYTSoqlq35ylNzC 7cXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213666-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb745d9bbsi859391a12.498.2024.06.13.09.43.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 09:43:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213666-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B9AA1F21385 for ; Thu, 13 Jun 2024 16:43:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A3C8149C4A; Thu, 13 Jun 2024 16:43:00 +0000 (UTC) Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 104AD130A46 for ; Thu, 13 Jun 2024 16:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296979; cv=none; b=lIPkvs/T6jPDDRybLfyS2omHoglKdSZiiMPHVCCixy88HjZg65bRJKyxirDwHEXB8/HQArpjjnWV/XtTjGSXh2cYtuyU5OJ67tgm77JNpFyTnalJrgCIoIUmvyDP/ZCqbPQ1ZMuF/EKcOYVYqAgwWlmAwId6NKrSi6J3IMGuoUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718296979; c=relaxed/simple; bh=fdR+HOux0l7slfjVf480YuwNVlVxXAAoX1BpgPIeqh8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rfWaJTPnhxofIfFmacRm1YKKlMkmtYbwiTXsMlgOsVEwlR27KCi8Z0KJcjHvm52x20jUA8FSlwgepLjHtBfHBMymNqeRHLGDXslUXfPPlSexEFJnhV3v5sztWXZvRlN8QTDBrsIT0h6U9M7HIykkJHMbPPOgCbBZUy2T009uh1s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-62a0849f8e5so13246687b3.2 for ; Thu, 13 Jun 2024 09:42:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718296974; x=1718901774; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a7eDnx/cZDpbixJmVjvIErbIrnZeY3Xb1qwzBjK+wtI=; b=jibTxUWf9gbjyEtOvOGQ2G7tvh35gugK4sT+D4Lh2o+q+4fFBftJaH0iNUbGda9Nye W9nJT9JCUL1DfPunMb5L+2th1Xx1bW6hLn0S03T7EJKHY5LrTftK/IfSnBiPU7u6+2Wv aYFqk+H1IMP1MGaC/IwCx1Yw9+98URrDt2geQljPBz8ITFV7I3qFHHtSMmRTZMIZTM6T b+S4h/Y930OcpXX5gtKU/qwKAkweSJnJboTlShtKcAEN8gziv+FOpVXsNFBGiUyc3BUg F7BXRKt56pmEA7MqQZ2gM++6kBja/mUv6vIeF53nVEOkraMSILOizuqFMdlHAc0xM76Q K9xQ== X-Forwarded-Encrypted: i=1; AJvYcCXe+oHKjf7QsqAUMc5K7no8izGvvkDo/EjMoRulTMeSyjYcHpGd+6PrqeYI6G+SEBB4JdtNZ9hz44onZQ8yad0mIwo4LQEUgvQXndWL X-Gm-Message-State: AOJu0Yys7r/+R7rnAF3ZwkBJdRzMJ8o5tFustiBWpWoXm1iRBdw/Tbq2 YRxBndeZJT6pifWWhDSpKNaxhez/8lCF4sqKV6jvJABcIXMqQYML8EGrt2X4 X-Received: by 2002:a25:2686:0:b0:dfa:94c4:72db with SMTP id 3f1490d57ef6-dff150de489mr59974276.0.1718296973510; Thu, 13 Jun 2024 09:42:53 -0700 (PDT) Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com. [209.85.128.178]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-dff0475defasm245359276.8.2024.06.13.09.42.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jun 2024 09:42:53 -0700 (PDT) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-63097363e63so14014207b3.3 for ; Thu, 13 Jun 2024 09:42:53 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUnz0tX3ADtleY3gpD6G0tuZbFHI3vwpLQSiJOIBnbEMQkS8lPH9c2OnbY+eRzTZq3TpjTWv7zxifNkQtaAvbSlo8l0rl1cpUUKD7+1 X-Received: by 2002:a0d:f447:0:b0:61a:e2e4:454d with SMTP id 00721157ae682-62fbc5dacc4mr50619227b3.45.1718296971533; Thu, 13 Jun 2024 09:42:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240121203009.9257-1-ansuelsmth@gmail.com> <20240121203009.9257-2-ansuelsmth@gmail.com> In-Reply-To: <20240121203009.9257-2-ansuelsmth@gmail.com> From: Geert Uytterhoeven Date: Thu, 13 Jun 2024 18:42:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] ARM: decompressor: support memory start validation for appended DTB To: Christian Marangi Cc: Russell King , Arnd Bergmann , Andrew Morton , Geert Uytterhoeven , Linus Walleij , "Kirill A. Shutemov" , Thomas Gleixner , Jonathan Corbet , Marc Zyngier , "Mike Rapoport (IBM)" , Eric DeVolder , Nathan Chancellor , Kees Cook , "Russell King (Oracle)" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Konrad Dybcio , John Crispin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jan 21, 2024 at 9:30=E2=80=AFPM Christian Marangi wrote: > There is currently a problem with a very specific sets of kernel config > and AUTO_ZRELADDR. > > For the most common case AUTO_ZRELADDR check the PC register and > calculate the start of the physical memory. Then fdt_check_mem_start is > called to make sure the detected value makes sense by comparing it with > what is present in DTB in the memory nodes and if additional fixup are > required with the use of linux,usable-memory-range in the chosen node to > hardcode usable memory range in case some reserved space needs to be > addressed. With the help of this function the right address is > calculated and the kernel correctly decompress and loads. > > Things starts to become problematic when in the mix, > CONFIG_ARM_APPENDED_DTB is used. This is a particular kernel config is > used when legacy systems doesn't support passing a DTB directly and a > DTB is appended at the end of the image. > > In such case, fdt_check_mem_start is skipped in AUTO_ZRELADDR iteration > as the appended DTB can be augumented later with ATAGS passed from the > bootloader (if CONFIG_ARM_ATAG_DTB_COMPAT is enabled). > > The main problem and what this patch address is the fact that > fdt_check_mem_start is never called later when the appended DTB is > augumented, hence any fixup and validation is not done making AUTO_ZRELAD= DR > detection inconsistent and most of the time wrong. > > Add support in head.S for this by checking if AUTO_ZRELADDR is enabled > and calling fdt_check_mem_start with the appended DTB and the augumented > values permitting legacy device to provide info in DTB instead of > disabling AUTO_ZRELADDR and hardcoding the physical address offsets. > > Signed-off-by: Christian Marangi > Reviewed-by: Geert Uytterhoeven > Reviewed-by: Linus Walleij I have been including this series in my local tree for a few months, and so far no regressions on any of the Renesas ARM32 platforms I regularly test on. Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds