From a57c02a4ea48bdb3ffc8cdba2569d240275b1bc3 Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Wed, 3 May 2023 00:04:51 +0200 Subject: [PATCH] package/busybox: disable sha1/sha256 hwaccel with x86 Buxybox's init segfault when built with x86 musl toolchain due to recent changes about sha1 and sha156 hwaccel support in Busybox 1.36.0. From Alpinelinux [1]: "main/busybox: disable sha hwaccel the flag check for this seems incorrect- it triggers sha_ni use when the instructions aren't available, but avx512vl/bw is - Elly on irc causes failures in github actions, which have avx512 but no sha_no" The flag check was supposed to be fixed upstream by commit [2]. But init still crash with the latest 1_36_stable (with backported patch) and master branch... The same workaround has been applied to openembedded-core [3], which states that they also have the issue with glibc. Disable hardware sha acceleration on x86 (not x86_64), to avoid the issue. Checked that qemu_x86_64_defconfig with musl for x86_64 for core2 boot as expected with sha hwaccel enabled. Fixes: https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276721 [1] https://git.alpinelinux.org/aports/commit/main/busybox?id=ae2cfdf6f6da3dc46ee09d8ceafa26921f6e058e [2] https://git.busybox.net/busybox/commit/?id=bd76b75f72f717150b909e8c64edfda725cabe11 [3] https://github.com/openembedded/openembedded-core/commit/22f639d61127f4b82a79008c5305e44e090a3680 Signed-off-by: Romain Naour Signed-off-by: Yann E. MORIN --- package/busybox/busybox.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 1633ca525d..fd4f3c17c5 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -276,6 +276,15 @@ define BUSYBOX_INSTALL_INDIVIDUAL_BINARIES endef endif +# Disable SHA1 and SHA256 HWACCEL to avoid segfault in init +# with some x86 toolchains (mostly musl?). +ifeq ($(BR2_i386),y) +define BUSYBOX_MUSL_DISABLE_SHA_HWACCEL + $(call KCONFIG_DISABLE_OPT,CONFIG_SHA1_HWACCEL) + $(call KCONFIG_DISABLE_OPT,CONFIG_SHA256_HWACCEL) +endef +endif + # Only install our logging scripts if no other package does it. ifeq ($(BR2_PACKAGE_SYSKLOGD)$(BR2_PACKAGE_RSYSLOG)$(BR2_PACKAGE_SYSLOG_NG),) define BUSYBOX_INSTALL_LOGGING_SCRIPT @@ -364,6 +373,7 @@ endef BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_INSTALL_ADD_TO_SHELLS define BUSYBOX_KCONFIG_FIXUP_CMDS + $(BUSYBOX_MUSL_DISABLE_SHA_HWACCEL) $(BUSYBOX_SET_MMU) $(BUSYBOX_PREFER_STATIC) $(BUSYBOX_SET_MDEV)