diff --git a/Makefile.uk.musl.env b/Makefile.uk.musl.env index c404da17975ce23865f9ceae27fc8c299d3fe137..b62acaba3151525442fea8e1e8463c734c6ef483 100644 --- a/Makefile.uk.musl.env +++ b/Makefile.uk.musl.env @@ -18,6 +18,10 @@ LIBMUSL_ENV_HDRS-y += $(LIBMUSL)/src/include/unistd.h LIBMUSL_ENV_SRCS-y += $(LIBMUSL)/src/env/__init_tls.c LIBMUSL_ENV_SRCS-y += $(LIBMUSL)/src/env/__libc_start_main.c LIBMUSL_ENV_SRCS-y += $(LIBMUSL)/src/env/__reset_tls.c +ifeq ($(CONFIG_LIBUKSP),y) +LIBMUSL_ENV_SRCS-y += $(LIBMUSL)/src/env/__stack_chk_fail_uksp.c +else LIBMUSL_ENV_SRCS-y += $(LIBMUSL)/src/env/__stack_chk_fail.c +endif $(eval $(call _libmusl_import_lib,env,$(LIBMUSL_ENV_HDRS-y),$(LIBMUSL_ENV_SRCS-y))) diff --git a/patches/00022-lib-musl-provide-uksp-adapted-SSP-function.patch b/patches/00022-lib-musl-provide-uksp-adapted-SSP-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb26d4a5ac610806e0d64e1b829e3765eabc1022 --- /dev/null +++ b/patches/00022-lib-musl-provide-uksp-adapted-SSP-function.patch @@ -0,0 +1,32 @@ +From 2ca374937b2defce82c61115816c2c39223d8769 Mon Sep 17 00:00:00 2001 +From: wangguokun +Date: Fri, 29 Nov 2024 10:48:04 +0800 +Subject: [PATCH] lib/musl: provide uksp adapted SSP function + +Signed-off-by: wangguokun +--- + src/env/__stack_chk_fail_uksp.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + create mode 100644 src/env/__stack_chk_fail_uksp.c + +diff --git a/src/env/__stack_chk_fail_uksp.c b/src/env/__stack_chk_fail_uksp.c +new file mode 100644 +index 00000000..0b3d0224 +--- /dev/null ++++ b/src/env/__stack_chk_fail_uksp.c +@@ -0,0 +1,12 @@ ++#include ++#include ++#include "pthread_impl.h" ++ ++extern uintptr_t __stack_chk_guard; ++ ++void __init_ssp(void *entropy) ++{ ++ __pthread_self()->canary = __stack_chk_guard; ++} ++ ++extern void __stack_chk_fail(void); +-- +2.34.1 +