Date: Fri, 23 Feb 2001 08:58:49 -0600 From: Jonathan Lemon <jlemon@flugsvamp.com> To: Marcel Moolenaar <marcel@cup.hp.com> Cc: arch@FreeBSD.ORG Subject: Re: sysctl kern.fallback_elf_brand Message-ID: <20010223085849.I5714@prism.flugsvamp.com> In-Reply-To: <3A960EF8.75C3FC53@cup.hp.com> References: <3A960EF8.75C3FC53@cup.hp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 22, 2001 at 11:19:20PM -0800, Marcel Moolenaar wrote:
>
> I think we need to disable the fallback ELF branding when no ABI
> compatibility module is loaded. Otherwise we can set the fallback to the
> one ABI module, or when multiple are loaded, the first. In the latter
> case, the first may not be the preferred one, so we probably need to
> have a bit more tuning than simply selecting the first.
I like this; I think that we should just turn off the default elf
branding for now, since we've been branding our (FreeBSD) binaries
since the 3.x days. How about the following patch?
--
Jonathan
Index: kern/imgact_elf.c
===================================================================
RCS file: /ncvs/src/sys/kern/imgact_elf.c,v
retrieving revision 1.89
diff -u -r1.89 imgact_elf.c
--- kern/imgact_elf.c 2001/02/09 06:09:48 1.89
+++ kern/imgact_elf.c 2001/02/23 15:06:56
@@ -32,6 +32,7 @@
#include "opt_rlimit.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
#include <sys/imgact.h>
@@ -436,9 +437,12 @@
return error;
}
-static int fallback_elf_brand = ELFOSABI_FREEBSD;
+/*
+ * non static, as it can be overridden by start_init()
+ */
+int fallback_elf_brand = ELFOSABI_NONE;
SYSCTL_INT(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RW,
- &fallback_elf_brand, ELFOSABI_FREEBSD,
+ &fallback_elf_brand, ELFOSABI_NONE,
"ELF brand of last resort");
static int
@@ -607,10 +611,6 @@
}
}
}
-
- /* XXX - Assume FreeBSD after the branding method change. */
- if (brand_info == NULL)
- brand_info = &freebsd_brand_info;
if (brand_info == NULL) {
uprintf("ELF binary type \"%u\" not known.\n",
Index: kern/init_main.c
===================================================================
RCS file: /ncvs/src/sys/kern/init_main.c,v
retrieving revision 1.157
diff -u -r1.157 init_main.c
--- kern/init_main.c 2001/02/21 06:39:54 1.157
+++ kern/init_main.c 2001/02/22 21:54:37
@@ -93,6 +93,7 @@
int cmask = CMASK;
extern struct user *proc0paddr;
+extern int fallback_elf_brand;
struct vnode *rootvp;
int boothowto = 0; /* initialized so that it can be patched */
@@ -479,6 +480,8 @@
strncpy(init_path, var, sizeof init_path);
init_path[sizeof init_path - 1] = 0;
}
+ if ((var = getenv("kern.fallback_elf_brand")) != NULL)
+ fallback_elf_brand = strtol(var, NULL, 0);
for (path = init_path; *path != '\0'; path = next) {
while (*path == ':')
Index: sys/elf_common.h
===================================================================
RCS file: /ncvs/src/sys/sys/elf_common.h,v
retrieving revision 1.8
diff -u -r1.8 elf_common.h
--- sys/elf_common.h 2001/01/01 21:56:57 1.8
+++ sys/elf_common.h 2001/02/23 15:08:27
@@ -100,6 +100,10 @@
#define ELFOSABI_ARM 97 /* ARM */
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
+/* magic marker for fallback elf brand, not for e_ident[EI_OSABI] */
+#define ELFOSABI_NONE (-1) /* No OSABI defined */
+
+
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010223085849.I5714>
