Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes related to D runtime support #37

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.uk.musl.linux
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ LIBMUSL_LINUX_HDRS-y += $(LIBMUSL)/include/sys/wait.h
LIBMUSL_LINUX_HDRS-y += $(LIBMUSL)/include/sys/xattr.h
LIBMUSL_LINUX_HDRS-y += $(LIBMUSL)/include/time.h
LIBMUSL_LINUX_HDRS-y += $(LIBMUSL)/include/unistd.h
LIBMUSL_LINUX_HDRS-y += $(LIBMUSL)/include/ucontext.h

LIBMUSL_LINUX_SRCS-y += $(LIBMUSL)/src/linux/adjtime.c
LIBMUSL_LINUX_SRCS-y += $(LIBMUSL)/src/linux/adjtimex.c
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 806eb5a52058fe1ac1dbd85bc418d11b2e622d48 Mon Sep 17 00:00:00 2001
From: Stefan Jumarea <[email protected]>
Date: Sat, 4 Mar 2023 11:39:51 +0200
Subject: [PATCH] [PATCH]: Check if libc.auxv is NULL before derefering it

Signed-off-by: Stefan Jumarea <[email protected]>
---
src/ldso/dl_iterate_phdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ldso/dl_iterate_phdr.c b/src/ldso/dl_iterate_phdr.c
index 9546dd3..c869812 100644
--- a/src/ldso/dl_iterate_phdr.c
+++ b/src/ldso/dl_iterate_phdr.c
@@ -16,7 +16,7 @@ static int static_dl_iterate_phdr(int(*callback)(struct dl_phdr_info *info, size
struct dl_phdr_info info;
size_t i, aux[AUX_CNT] = {0};

- for (i=0; libc.auxv[i]; i+=2)
+ for (i=0; libc.auxv && libc.auxv[i]; i+=2)
if (libc.auxv[i]<AUX_CNT) aux[libc.auxv[i]] = libc.auxv[i+1];

for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
--
2.25.1