summaryrefslogtreecommitdiffstats
path: root/sys/kern/exec_elf.c
diff options
context:
space:
mode:
authordrahn <drahn@openbsd.org>2005-11-11 16:41:24 +0000
committerdrahn <drahn@openbsd.org>2005-11-11 16:41:24 +0000
commite09ff6070a466f69256f21ed933e7c7214fd21da (patch)
tree7a24563d5a069ca152ca0688dacf31945b22f2e5 /sys/kern/exec_elf.c
parentSimplify a computation in a can't happen diagnostic message. (diff)
downloadwireguard-openbsd-e09ff6070a466f69256f21ed933e7c7214fd21da.tar.xz
wireguard-openbsd-e09ff6070a466f69256f21ed933e7c7214fd21da.zip
Allow binaries to run if all sections are marked writable
(some unusual linux binaries), ok deraadt.
Diffstat (limited to 'sys/kern/exec_elf.c')
-rw-r--r--sys/kern/exec_elf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 281b1dc61c5..5304023bf5f 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.49 2003/11/03 19:58:22 tedu Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.50 2005/11/11 16:41:24 drahn Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -710,6 +710,13 @@ native:
}
/*
+ * Strangely some linux programs may have all load sections marked
+ * writeable, in this case, textsize is not -1, but rather 0;
+ */
+ if (epp->ep_tsize == ELFDEFNNAME(NO_ADDR))
+ epp->ep_tsize = 0;
+
+ /*
* Check if we found a dynamically linked binary and arrange to load
* it's interpreter when the exec file is released.
*/