* [PATCH v3] mkimage: fix segfault on MacOS arm64
@ 2022-01-24 23:29 Sergey V. Lobanov
2022-01-31 15:22 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Sergey V. Lobanov @ 2022-01-24 23:29 UTC (permalink / raw)
To: u-boot; +Cc: jrtc27, Sergey V. Lobanov
mkimage segfaults due to the ASLR mechanism on MacOS arm64
It is required to use _dyld_get_image_vmaddr_slide()
to prevent segfault on MacOS arm64
This patch is based on the discussion
https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0
Thanks to Jessica Clarke, Ronny Kotzschmar and ptpt52 github user
Reviewed-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
---
Changes since version 2:
- Rebased on current master
- Added Reviewed-by tag
- Fixed typos and grammatical errors
tools/imagetool.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/imagetool.h b/tools/imagetool.h
index b7ac3a23d0..45eaada4b5 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -272,11 +272,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 <mach-o/getsect.h>
+#include <mach-o/dyld.h>
#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); \
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] mkimage: fix segfault on MacOS arm64
2022-01-24 23:29 [PATCH v3] mkimage: fix segfault on MacOS arm64 Sergey V. Lobanov
@ 2022-01-31 15:22 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2022-01-31 15:22 UTC (permalink / raw)
To: Sergey V. Lobanov; +Cc: u-boot, jrtc27
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
On Tue, Jan 25, 2022 at 02:29:44AM +0300, Sergey V. Lobanov wrote:
> mkimage segfaults due to the ASLR mechanism on MacOS arm64
>
> It is required to use _dyld_get_image_vmaddr_slide()
> to prevent segfault on MacOS arm64
>
> This patch is based on the discussion
> https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0
>
> Thanks to Jessica Clarke, Ronny Kotzschmar and ptpt52 github user
>
> Reviewed-by: Jessica Clarke <jrtc27@jrtc27.com>
> Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-31 15:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 23:29 [PATCH v3] mkimage: fix segfault on MacOS arm64 Sergey V. Lobanov
2022-01-31 15:22 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.