summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux/linux_exec.c')
-rw-r--r--sys/compat/linux/linux_exec.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_exec.c b/sys/compat/linux/linux_exec.c
index 1611639b241..a5cb81d7c31 100644
--- a/sys/compat/linux/linux_exec.c
+++ b/sys/compat/linux/linux_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_exec.c,v 1.27 2007/10/30 12:09:22 gilles Exp $ */
+/* $OpenBSD: linux_exec.c,v 1.28 2008/06/12 04:32:59 miod Exp $ */
/* $NetBSD: linux_exec.c,v 1.13 1996/04/05 00:01:10 christos Exp $ */
/*-
@@ -483,9 +483,21 @@ linux_elf_probe(p, epp, itp, pos, os)
int error;
size_t len;
+ if (!(emul_linux_elf.e_flags & EMUL_ENABLED))
+ return (ENOEXEC);
+
+ /*
+ * Modern Linux binaries carry an identification note.
+ */
+ if (ELFNAME(os_pt_note)(p, epp, epp->ep_hdr, "GNU", 4, 0x10) == 0) {
+ goto recognized;
+ }
+
brand = elf32_check_brand(eh);
- if (brand && strcmp(brand, "Linux"))
+ if (brand == NULL || strcmp(brand, "Linux") != 0)
return (EINVAL);
+
+recognized:
if (itp) {
if ((error = emul_find(p, NULL, linux_emul_path, itp, &bp, 0)))
return (error);