summaryrefslogtreecommitdiffstats
path: root/sys/kern/exec_elf.c
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2002-09-18 22:07:50 +0000
committerdrahn <drahn@openbsd.org>2002-09-18 22:07:50 +0000
commita7bc362b48c84069e372aa57e78c46afcd11ec11 (patch)
treed6c54576ae9c53bf7efffb9af1d6f6c7d69e5519 /sys/kern/exec_elf.c
parentWe can jump to the fail: label before shellargp is initialized. (diff)
downloadwireguard-openbsd-a7bc362b48c84069e372aa57e78c46afcd11ec11.tar.xz
wireguard-openbsd-a7bc362b48c84069e372aa57e78c46afcd11ec11.zip
Mark ELF ld.so as VTEXT to prevent the file from being overwritten.
ok deraadt@ art@
Diffstat (limited to 'sys/kern/exec_elf.c')
-rw-r--r--sys/kern/exec_elf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 078963448ce..68077f357ca 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.39 2002/08/22 22:04:42 art Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.40 2002/09/18 22:07:50 drahn Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -410,6 +410,8 @@ ELFNAME(load_file)(struct proc *p, char *path, struct exec_package *epp,
}
}
+ vn_marktext(nd.ni_vp);
+
bad1:
VOP_CLOSE(nd.ni_vp, FREAD, p->p_ucred, p);
bad: