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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31AF1EB64D7 for ; Fri, 30 Jun 2023 14:23:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E353486819; Fri, 30 Jun 2023 16:23:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CgbX5dW/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B1CA8681C; Fri, 30 Jun 2023 16:23:51 +0200 (CEST) Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D240A86817 for ; Fri, 30 Jun 2023 16:23:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=festevam@gmail.com Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1b07c02599cso425924fac.1 for ; Fri, 30 Jun 2023 07:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688135027; x=1690727027; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+fRut6o93BwjFpBxJy255jIumr7WP2Te3Bb/jSNr2k8=; b=CgbX5dW/nrzU9HIqdm27dHSjqZU9qvCOIrsss25Yip/QRruZi4mj1kqQKyJI7Kdxdi C80W+o+2cgL/6+7G6QZsxqwvIzQB/ri/69KSG6kFj8c0AdzUdY4WSXj3Lrptpn1qjDM9 c9cFd+V1hYW9O9XaTmHbsOj1/C7Tw0wE34wEl1C1XjyrpidgXyWFHAc8eUnhxWl9Y7Jl XIkXuw5GjLCkfmeJtKvhaZjSOVrGljX5tept0pXaei04jRenTMK6eS+WtBijut55zY9n F5FBKfUCQwNxZy9o1ic0eMxhglC8XZPzg3KF3kWegJ9COhhbrd4qyNe63KADjbAcHvva Habg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688135027; x=1690727027; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+fRut6o93BwjFpBxJy255jIumr7WP2Te3Bb/jSNr2k8=; b=TcHCovcUCu+FLRyd37eo4vVhPj+dXBb2mfyHQIHTljrKWDavsf413UNDf3YNk7/miP kTEHrK5tSLBJxmhXyZ4S9ce2OoaB0J3KdZQprV67JmNeEADwO0T1kzXGcS/NiePL2LkA evQQgA5lyy6jv1ztv6uvlQMnn9LkE6YCNiQr1G3bQDck3I5JPuPTsVRp0YcG6mqwL50H 1htgP+Q9HYKC0DLztLKD1Zq41ETeo2ZpO8bjPxstkpQ2bHu024W+6WCtYnMiq0z9st73 cptZKEpPuCPCK2QwjdFW39Y0KB/F3DuelFJ+amkHKpJULrA0nZQhvcmZ1xj9CgwYykad DZfw== X-Gm-Message-State: ABy/qLZUqMQss1n6waj0BVQYdlsNMpl4oiHBihClWGdvtUFcZ7HvwXKD w6qSuveuYADZojn5A46cujQ= X-Google-Smtp-Source: APBJJlF+lAv0+lvVOepozGa/1u4mzWGFVm9BPkY6mivTt+6udvK9BOVkBqJsynkrWxqDBpR4HIL8tA== X-Received: by 2002:a05:6871:688:b0:1b0:43d6:46ba with SMTP id l8-20020a056871068800b001b043d646bamr3108137oao.2.1688135027346; Fri, 30 Jun 2023 07:23:47 -0700 (PDT) Received: from fabio-Precision-3551.. ([2804:14c:485:4b61:1d49:455f:34ea:42c]) by smtp.gmail.com with ESMTPSA id cv13-20020a056870c68d00b001aaa093932bsm8895351oab.11.2023.06.30.07.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 07:23:46 -0700 (PDT) From: Fabio Estevam To: trini@konsulko.com Cc: marex@denx.de, u-boot@lists.denx.de, francesco.dolcini@toradex.com, Fabio Estevam Subject: [PATCH] spl: spl_legacy: Fix spl_end address Date: Fri, 30 Jun 2023 11:23:11 -0300 Message-Id: <20230630142311.435336-1-festevam@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Fabio Estevam Currently, spl_end points to the __bss_end address, which is an external RAM address instead of the end of the SPL text section in the internal RAM. This causes boot failures on imx6-colibri, for example: ``` Trying to boot from MMC1 SPL: Image overlaps SPL resetting ... ``` Fix this problem by assigning spl_end to the _image_binary_end, as this symbol properly represents the end of the SPL text section. From u-boot-spl.map: .end *(.__end) 0x00000000009121a4 _image_binary_end = . Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks") Reported-by: Francesco Dolcini Signed-off-by: Fabio Estevam --- Tom, As 2023.07 is coming in a few days, maybe it is safer to revert 77aed22b48ab in master and then squash 77aed22b48ab + this fix to next. 77aed22b48ab has been applied to 2023.07-rc5, which is too late in the cycle. common/spl/spl_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index d34bc5492e8d..095443c63d8d 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -19,7 +19,7 @@ static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size) { uintptr_t spl_start = (uintptr_t)_start; - uintptr_t spl_end = (uintptr_t)__bss_end; + uintptr_t spl_end = (uintptr_t)_image_binary_end; uintptr_t end = start + size; if ((start >= spl_start && start < spl_end) || -- 2.34.1