From mboxrd@z Thu Jan 1 00:00:00 1970 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 6A6A6C433F5 for ; Mon, 24 Jan 2022 23:40:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D918B82A65; Tue, 25 Jan 2022 00:40:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jrtc27.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=jrtc27.com header.i=@jrtc27.com header.b="ci9V1Pnj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E55283035; Tue, 25 Jan 2022 00:00:12 +0100 (CET) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 7576C81DD6 for ; Tue, 25 Jan 2022 00:00:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jrtc27.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jrtc27@jrtc27.com Received: by mail-wr1-x42b.google.com with SMTP id c23so746107wrb.5 for ; Mon, 24 Jan 2022 15:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pJ1+x6DOAjys2iZgMjPIlSRV2XWUhSPtgcVEsKQq+aI=; b=ci9V1PnjFPNlBHjLkH3yWvjkXF7/3QnBdoRiZsl0eFx9BjOkmB7VVCB54TkMZ06dnQ Ldi1Jw/c3With+yJ+5V2BpiRUAWk2xPyDBnbN2YqIL1lEhSHauLJqdK/LYMuqRQwNquk fcpJrbWR/YYwRMWF0moba3/gjO5jsH99WTB5Szh8aAFWUZu0hjY1Kj1pmMWKbHKLxnG9 hLsJIIArTEtXYYiAilyqgFe+Jv2PHljchDPvOhF0R07t3meQ/n0TIaOcg0dNHiWStS3A S5iwmK7CM1CJjWdqQlXJUODuG3+KEVCu2x6j4YP4rroSIa1w0vJB2YTv5/cJDcVG4c5Y C+wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pJ1+x6DOAjys2iZgMjPIlSRV2XWUhSPtgcVEsKQq+aI=; b=13aVylDtorcjtij49uD3GbhYBppwlA3qLJ2LBOPNQnZm2TvBbohvY530Lo3pLfyoW5 +HpWTej1jYoVxl0S4OSSUZzKJaagcmQh0A1U3ce38kMC1XWyx1BNbGVg69inGhNbmKBW zeqx5R65MMtxarz2YCVq/dJP9YbjlQvMkSY7pW253Zr5EcSaOEAP1eThZxyRgLFp6EvQ 8pTIeJA7Z8JGlOtMH6UAPpC0HyFSa5lbeDpz4pne6E0BiyDFkzzPs7k5/Z7q6pzR0Axg qb7+hDzy2h+7Q8iEhLaP8XG8CPdg1M8BfUb6E8gLEb6eG0bfyeJoR0VQl9NFmCNqEzm8 XGrg== X-Gm-Message-State: AOAM530VwMIU3zFh2VF75vdxx20oNuZxu+PGqbiI2OtcTp2c4pR7cof+ SfYwZBTXyRg04KQ3xpUul9l+lOXCvbnpEYue X-Google-Smtp-Source: ABdhPJzNhmDmpqVOfl2PQtRF+27z4RXCLNB4blP/5C3CcZjdZ3jt9dWkKP69KZWkgp0OYXVGNPgV0g== X-Received: by 2002:a05:6000:10d2:: with SMTP id b18mr15459508wrx.593.1643065206913; Mon, 24 Jan 2022 15:00:06 -0800 (PST) Received: from Jessicas-MacBook-Pro.localdomain (global-5-142.nat-2.net.cam.ac.uk. [131.111.5.142]) by smtp.gmail.com with ESMTPSA id h1sm14908780wrq.82.2022.01.24.15.00.06 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jan 2022 15:00:06 -0800 (PST) Received: by Jessicas-MacBook-Pro.localdomain (Postfix, from userid 501) id 0BFC3C8C935; Mon, 24 Jan 2022 23:00:05 +0000 (GMT) Date: Mon, 24 Jan 2022 23:00:05 +0000 From: Jessica Clarke To: "Sergey V. Lobanov" Cc: u-boot@lists.denx.de Subject: Re: [PATCH V2] mkimage: fix segfault on MacOS arm64 Message-ID: References: <20220116230713.20175-1-sergey@lobanov.in> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220116230713.20175-1-sergey@lobanov.in> X-Mailman-Approved-At: Tue, 25 Jan 2022 00:40:27 +0100 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.5 at phobos.denx.de X-Virus-Status: Clean On Mon, Jan 17, 2022 at 02:07:13AM +0300, Sergey V. Lobanov wrote: > mkimage segfaults due ASLR mechasim on MacOS arm64 > > It is required to use _dyld_get_image_vmaddr_slide() > to prevent segfault on MacOS arm64 > > This patch ased on the discussion > https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0 > > Thanks to Ronny Kotzschmar and ptpt52 github user > > Signed-off-by: Sergey V. Lobanov > --- > tools/imagetool.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/imagetool.h b/tools/imagetool.h > index e229a34ffc..a0985d93d2 100644 > --- a/tools/imagetool.h > +++ b/tools/imagetool.h > @@ -271,11 +271,13 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams); > * b) we need a API call to get the respective section symbols */ > #if defined(__MACH__) > #include > +#include > > #define INIT_SECTION(name) do { \ > unsigned long name ## _len; \ > char *__cat(pstart_, name) = getsectdata("__DATA", \ > #name, &__cat(name, _len)); \ > + __cat(pstart_, name) += _dyld_get_image_vmaddr_slide(0);\ > char *__cat(pstop_, name) = __cat(pstart_, name) + \ > __cat(name, _len); \ > __cat(__start_, name) = (void *)__cat(pstart_, name); \ This now seems sensible to me, thanks for fixing my mess. Reviewed-by: Jessica Clarke (though you may want to clean up your commit message; "ased" is missing the leading b and you're still missing the verb "is", plus "mechasim" should be "mechanism" and it should be "due to the", not just "due") Jess