summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2005-11-11 16:41:25 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2005-11-11 16:41:25 +0000
commit6485f21df442288ecd8d53e52d1c81c426b4e076 (patch)
tree9af4568c03da22cbce6504491e59a37c97c94014
parentf270d9b59bd21e7089f8e6844a38271c6f4cdcac (diff)
Allow binaries to run if all sections are marked writable
(some unusual linux binaries), ok deraadt.
-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.
*/