summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2023-01-16 07:09:13 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2023-01-16 07:09:13 +0000
commite3cc3646043588ee92c0620ea65228694d04f9d9 (patch)
tree69c0307f5ca5f8c9259ce0193ac53f9966b1ca89 /sys/uvm
parent9d064db0a2a6e9cebcb374ca76fb50f4c069a39b (diff)
Currently we disable kbind(2) for static program from libc.a's
preinit hook. Delete that and instead have the kernel disable kbind at exec-time if the program doesn't have an ELF interpreter. For now, permit userland calls to disable it when already disabled so existing static programs continue to work. prompted by deraadt@ questioning about the call in libc.a ok deraadt@ miod@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_mmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index ef1ebce59ec..1ebed4cb1b6 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.176 2023/01/04 06:33:33 jsg Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.177 2023/01/16 07:09:11 guenther Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -1130,8 +1130,6 @@ uvm_mmapfile(vm_map_t map, vaddr_t *addr, vsize_t size, vm_prot_t prot,
return error;
}
-/* an address that can't be in userspace or kernelspace */
-#define BOGO_PC (u_long)-1
int
sys_kbind(struct proc *p, void *v, register_t *retval)
{
@@ -1171,9 +1169,12 @@ sys_kbind(struct proc *p, void *v, register_t *retval)
pc = PROC_PC(p);
mtx_enter(&pr->ps_mtx);
if (paramp == NULL) {
+ /* ld.so disables kbind() when lazy binding is disabled */
if (pr->ps_kbind_addr == 0)
pr->ps_kbind_addr = BOGO_PC;
- else
+ /* pre-7.3 static binaries disable kbind */
+ /* XXX delete check in 2026 */
+ else if (pr->ps_kbind_addr != BOGO_PC)
sigill = 1;
} else if (pr->ps_kbind_addr == 0) {
pr->ps_kbind_addr = pc;