Message ID | 20250904130459.848794-4-sjg@u-boot.org |
---|---|
State | New |
Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991126; bh=d1DWTtc4E1qPxeaBbbEBaqPATeb+27xMxhHUNxVyv9w=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DrfM4cAQbo0lS0ErOwz+Ytua2e+zTsTxwlAvSZ2YlplC+ifklrjjC8tnYW48WZWA/ UpTbWamKMF7PwgC522JRfVFjMno6WtgojpAcQqAzdl/s6Hbh3xzWxcvq5SBBXJeuJq swBr6vqJXm5NLvGVoRBdm2aC+9RlQoskSU7rmHojK+OGJVC7O3Nbus7qjQBoQ2zdBG 9kS6TdpJFpQDERh24VA28XW3XjXnUNZFD04SYYy4k3ZwU0W0oVj7T1elk7MMbxcog2 JJ0vgU51ZKpamxo1g0Th6VXTYE5IAyDnSvcm7eA+wajUmBq5cx/LaZOG7h8RO7C0qZ F0PL69zYiz8RQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1997B67959 for <u-boot-concept@u-boot.org>; Thu, 4 Sep 2025 07:05:26 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id NDCCs2KEa58y for <u-boot-concept@u-boot.org>; Thu, 4 Sep 2025 07:05:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991126; bh=d1DWTtc4E1qPxeaBbbEBaqPATeb+27xMxhHUNxVyv9w=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DrfM4cAQbo0lS0ErOwz+Ytua2e+zTsTxwlAvSZ2YlplC+ifklrjjC8tnYW48WZWA/ UpTbWamKMF7PwgC522JRfVFjMno6WtgojpAcQqAzdl/s6Hbh3xzWxcvq5SBBXJeuJq swBr6vqJXm5NLvGVoRBdm2aC+9RlQoskSU7rmHojK+OGJVC7O3Nbus7qjQBoQ2zdBG 9kS6TdpJFpQDERh24VA28XW3XjXnUNZFD04SYYy4k3ZwU0W0oVj7T1elk7MMbxcog2 JJ0vgU51ZKpamxo1g0Th6VXTYE5IAyDnSvcm7eA+wajUmBq5cx/LaZOG7h8RO7C0qZ F0PL69zYiz8RQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0387F678BF for <u-boot-concept@u-boot.org>; Thu, 4 Sep 2025 07:05:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991123; bh=AR4/n4Qyf83TBMhRba0ntLcU2GdM3RjxDWWIhwXRf/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pcr97fuVZP5iAjJzcKirbj7ERy4K4N++VGYlzxiZXOblzRnN2ElOaV4kAlejrFYOa Mm8E9DIsLw+xZtmKXuedZ6wsypncFvoOl6aTTrjD/VFDcVMps1wppy0Z1hqHpFABFf kWey8XLIANb7HU7idQcau/qZtY4t22QBGUdyT7qAeXiuOetvG7FBH1flcbZnnJo/uL yOErQRVHAsv9Ke4Ks2hOdYDtxv1TuKk3K4alV0RhNKsvX5pomrDg4mrqg42Dv+2uzp 4DYL035EC+gtTkfx2Adj3PG5fVHS5ScQLCSIr6tD1FxFuzbMi8TfP8VIBysLrOGHuA 0hdvFTuHGVMSA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BA3EC678BF; Thu, 4 Sep 2025 07:05:23 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id d_0bf2iVA46a; Thu, 4 Sep 2025 07:05:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991122; bh=IAHMfyEfuEic2Y8ihXLKTGdo+J/V0Zn2pBOMLWkK+kM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpPNURCBAZYSsYno+3jWpOp6EtOoFqloXMiJLUgi7syeWm3FcdewsfuVzGsoQ7Okv 1t+kFflHExrFODwLDmby7bkvL+BUYO+m4hbPoA+Nymi6ut6GFeYAoi9hXX9dgW6OLe L221QQHOgqWoKM3l/u1NPtPdvUdS3M1sDOQAkrePopwMA4ix+YTUDqawXXCOGf4wIm DUEa9bZH/m75LAP4+KUTkm+GBdw8ZSvlowzgaBUWwOFMaVzdMTK/KSsTMdiJQ57lMY gtaDSK6vyOTKkZox1udK+7/cDpY/N1BBBoE1gK6SMPzMrqQ3G5IyI05IKiATiUZ5nO 28VJB1u6l8Wog== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3A6FB678C8; Thu, 4 Sep 2025 07:05:22 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Thu, 4 Sep 2025 07:04:36 -0600 Message-ID: <20250904130459.848794-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904130459.848794-1-sjg@u-boot.org> References: <20250904130459.848794-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QPVR6FCMGSZEWSQVNIRYCAY52FXCVXCU X-Message-ID-Hash: QPVR6FCMGSZEWSQVNIRYCAY52FXCVXCU X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/18] sandbox: Avoid mon_len being larger than available RAM List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/QPVR6FCMGSZEWSQVNIRYCAY52FXCVXCU/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
Series |
ulib: Introduce building U-Boot as a shared library
|
|
Commit Message
Simon Glass
Sept. 4, 2025, 1:04 p.m. UTC
From: Simon Glass <sjg@chromium.org> With the shared library the size can be quite large. Normally sandbox pretends that its code is mapped into emulated RAM, even though it actually isn't. This is fine in most cases, but when mon_len exceeds the RAM size the reservation top starts off at a negative address (i.e. very near the top of the address space), which immediately segfaults. Add a special case for this, for sandbox only. We might consider dropping this mapping altogether, as is down with RISC-V, but that is left for further discussion. With this, the test app boots to a prompt. Signed-off-by: Simon Glass <sjg@chromium.org> --- common/board_f.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/board_f.c b/common/board_f.c index 3a4fb9a42ef..eac51d61fa1 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -460,7 +460,11 @@ static int reserve_uboot(void) * reserve memory for U-Boot code, data & bss * round down to next 4 kB limit */ - gd->relocaddr -= gd->mon_len; + if (IS_ENABLED(CONFIG_SANDBOX) && gd->mon_len > gd->relocaddr) + log_debug("Cannot reserve space for U-Boot\n"); + else + gd->relocaddr -= gd->mon_len; + gd->relocaddr &= ~(4096 - 1); #if defined(CONFIG_E500) || defined(CONFIG_MIPS) /* round down to next 64 kB limit so that IVPR stays aligned */