From: deraadt Date: Fri, 29 Mar 2024 06:47:05 +0000 (+0000) Subject: Remove the at-syscall-time check for msyscall(2)'s behaviour. msyscall(2) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=861ef8390b8a203a888a41824d402fed95b8a243;p=openbsd Remove the at-syscall-time check for msyscall(2)'s behaviour. msyscall(2) was a big coding effort to ensure that system calls could only be performed from static-binary/ld.so/libc.so/sigtramp regions of memory, by caching a uvm entry with a serial number; new mmap/mprotect calls would increment the map serial, and the entry would need to be looked up again. So the cost was O(1) in the usual case, but O(log n) with some locking if a map change required a new lookup. In the new world order, such regions are immutable so they cannot be changed/split by mmap/mprotect; also we know the precise entry locations of the syscalls due to system call pinning (ELF OPENBSD_SYSCALL and pinsyscalls(2)), and this is all done as O(1) without any locking. All the other parts of the subsystem will be ripped out but please run a kernel with this before I make changes to ld.so.. ok kettenis --- diff --git a/sys/sys/syscall_mi.h b/sys/sys/syscall_mi.h index e200876ef7d..8ed88774d8a 100644 --- a/sys/sys/syscall_mi.h +++ b/sys/sys/syscall_mi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall_mi.h,v 1.31 2024/01/22 04:38:32 deraadt Exp $ */ +/* $OpenBSD: syscall_mi.h,v 1.32 2024/03/29 06:47:05 deraadt Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -162,12 +162,6 @@ mi_syscall(struct proc *p, register_t code, const struct sysent *callp, uvm_map_inentry_sp, p->p_vmspace->vm_map.sserial)) return (EPERM); - /* PC must be in un-writeable permitted text (sigtramp, libc, ld.so) */ - if (!uvm_map_inentry(p, &p->p_pcinentry, PROC_PC(p), - "[%s]%d/%d pc=%lx inside %lx-%lx: bogus syscall\n", - uvm_map_inentry_pc, p->p_vmspace->vm_map.wserial)) - return (EPERM); - if ((error = pin_check(p, code))) return (error);