From: deraadt Date: Sun, 15 Sep 2024 23:13:19 +0000 (+0000) Subject: Invalid pintables in ELF binaries can crash the kernel. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ebd6ceecbc40bf8f1e51766240a021a55ffdbe01;p=openbsd Invalid pintables in ELF binaries can crash the kernel. Fix from yufeng.gao@uq.edu.au --- diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index a9fb9211bdc..871b5bfdce5 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.190 2024/08/21 03:16:25 deraadt Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.191 2024/09/15 23:13:19 deraadt Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -311,8 +311,10 @@ elf_read_pintable(struct proc *p, struct vnode *vp, Elf_Phdr *pp, for (i = 0; i < nsyscalls; i++) { if (syscalls[i].sysno <= 0 || syscalls[i].sysno >= SYS_MAXSYSCALL || - syscalls[i].offset > len) + syscalls[i].offset > len) { + npins = 0; goto bad; + } npins = MAX(npins, syscalls[i].sysno); } if (is_ldso)