From: deraadt Date: Fri, 19 Jan 2024 14:16:41 +0000 (+0000) Subject: Stop initializing pinsyscall(SYS_execve in dynamic binaries that contain X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a09d28f1ea0e610cdfe26793c3fba26fd0f1a272;p=openbsd Stop initializing pinsyscall(SYS_execve in dynamic binaries that contain a reference reaching the execve(2) stub. The new pinsyscalls(2) that applies to all system calls has made this redundant. --- diff --git a/libexec/ld.so/Makefile b/libexec/ld.so/Makefile index 4cc2979f8e0..44ab6b41f03 100644 --- a/libexec/ld.so/Makefile +++ b/libexec/ld.so/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.86 2023/12/20 14:54:29 deraadt Exp $ +# $OpenBSD: Makefile,v 1.87 2024/01/19 14:16:41 deraadt Exp $ SUBDIR=ldconfig ldd MAN= ld.so.1 @@ -28,7 +28,7 @@ SRCS+= dl_uname.c dl_dirname.c strlcat.c strlen.c trace.c SRCS+= malloc.c reallocarray.c tib.c ffs.c syscall=close exit fstat getdents getentropy getthrid issetugid kbind \ - mimmutable mmap mprotect munmap msyscall open pledge pinsyscall \ + mimmutable mmap mprotect munmap msyscall open pledge \ pinsyscalls read __realpath sendsyslog __set_tcb sysctl thrkill \ utrace write diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 61330536f9d..7a9d57ed007 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.221 2024/01/17 13:00:05 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.222 2024/01/19 14:16:41 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -317,7 +317,7 @@ _dl_setup_env(const char *argv0, char **envp) int _dl_load_dep_libs(elf_object_t *object, int flags, int booting) { - elf_object_t *dynobj, *obj; + elf_object_t *dynobj; Elf_Dyn *dynp; unsigned int loop; int libcount; @@ -439,25 +439,6 @@ _dl_load_dep_libs(elf_object_t *object, int flags, int booting) } _dl_cache_grpsym_list_setup(object); - - /* - * XXX pinsyscall(SYS_execve,...) can be removed once pinsyscalls() - * is fully operational - */ - for (obj = _dl_objects; booting && obj != NULL; obj = obj->next) { - struct sym_res sr; - - if (!obj->islibc) - continue; - sr = _dl_find_symbol("execve", - SYM_SEARCH_SELF|SYM_PLT|SYM_WARNNOTFOUND, NULL, obj); - if (sr.sym) - _dl_pinsyscall(SYS_execve, - (void *)sr.obj->obj_base + sr.sym->st_value, - sr.sym->st_size); - _dl_memset(&sr, 0, sizeof sr); - break; - } return(0); } diff --git a/libexec/ld.so/syscall.h b/libexec/ld.so/syscall.h index b1f198e9281..59a8789151c 100644 --- a/libexec/ld.so/syscall.h +++ b/libexec/ld.so/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.6 2023/12/20 14:54:29 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.7 2024/01/19 14:16:42 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -51,7 +51,6 @@ void *_dl_mmap(void *, size_t, int, int, int, off_t); int _dl_mprotect(const void *, size_t, int); void *_dl_mquery(void *, size_t, int, int, int, off_t); int _dl_msyscall(void *addr, size_t len); -int _dl_pinsyscall(int, void *addr, size_t len); int _dl_pinsyscalls(void *base, size_t len, u_int *pin, int pinlen); int _dl_munmap(const void *, size_t); int _dl_mimmutable(const void *, size_t);