From 15fded6337a6d29a92d295a2764241b3e331aae0 Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 15 Aug 2023 06:23:31 +0000 Subject: [PATCH] Skip the _dl_msyscall() invocation if tracing library loading. Problem noted by gnezdo@ ok millert@ --- libexec/ld.so/library.c | 4 ++-- libexec/ld.so/library_mquery.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index 8e2f44c1995..34bf47ce977 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.91 2023/07/12 19:49:06 jasper Exp $ */ +/* $OpenBSD: library.c,v 1.92 2023/08/15 06:23:31 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -345,7 +345,7 @@ _dl_tryload_shlib(const char *libname, int type, int flags, int nodelete) _dl_set_tls(object, ptls, libaddr, libname); /* Request permission for system calls in libc.so's text segment */ - if (soname != NULL && + if (soname != NULL && !_dl_traceld && _dl_strncmp(soname, "libc.so.", 8) == 0) { if (_dl_msyscall(exec_start, exec_size) == -1) _dl_printf("msyscall %lx %lx error\n", diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index 57775382ba9..5f7aeb2cf82 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.71 2023/07/12 19:49:06 jasper Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.72 2023/08/15 06:23:31 guenther Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -354,7 +354,7 @@ retry: libname); /* Request permission for system calls in libc.so's text segment */ - if (soname != NULL && + if (soname != NULL && !_dl_traceld && _dl_strncmp(soname, "libc.so.", 8) == 0) { if (_dl_msyscall(exec_start, exec_size) == -1) _dl_printf("msyscall %lx %lx error\n", -- 2.20.1