diff options
author | dchagin <dchagin@FreeBSD.org> | 2009-04-05 09:27:19 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2009-04-05 09:27:19 +0000 |
commit | 01bf63c9fb60c7104bfbbcfd5be8c1deab29ea6a (patch) | |
tree | d36c5668c15e84db66ecb8e052140097d1a8b901 | |
parent | 2a2dfa7d229606cbb1ff3302fab0681c9d4877a1 (diff) | |
download | FreeBSD-src-01bf63c9fb60c7104bfbbcfd5be8c1deab29ea6a.zip FreeBSD-src-01bf63c9fb60c7104bfbbcfd5be8c1deab29ea6a.tar.gz |
Fix KBI breakage by r190520 which affects older linux.ko binaries:
1) Move the new field (brand_note) to the end of the Brandinfo structure.
2) Add a new flag BI_BRAND_NOTE that indicates that the brand_note pointer
is valid.
3) Use the brand_note field if the flag BI_BRAND_NOTE is set and as old
modules won't have the flag set, so the new field brand_note would be
ignored.
Suggested by: jhb
Reviewed by: jhb
Approved by: kib (mentor)
MFC after: 6 days
-rw-r--r-- | sys/amd64/amd64/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysvec.c | 4 | ||||
-rw-r--r-- | sys/arm/arm/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/compat/ia32/ia32_sysvec.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 4 | ||||
-rw-r--r-- | sys/ia64/ia64/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/kern/imgact_elf.c | 2 | ||||
-rw-r--r-- | sys/mips/mips/elf64_machdep.c | 4 | ||||
-rw-r--r-- | sys/mips/mips/elf_machdep.c | 2 | ||||
-rw-r--r-- | sys/powerpc/powerpc/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/sparc64/sparc64/elf_machdep.c | 4 | ||||
-rw-r--r-- | sys/sys/imgact_elf.h | 3 |
13 files changed, 24 insertions, 23 deletions
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index 35de4e3..c5e19cf 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -85,7 +85,7 @@ static Elf64_Brandinfo freebsd_brand_info = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf64_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 925d2e1..a82c182 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -1072,7 +1072,7 @@ static Elf32_Brandinfo linux_brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux32_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1084,7 +1084,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux32_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; Elf32_Brandinfo *linux_brandlist[] = { diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index 7b848cc..174deeb 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -85,7 +85,7 @@ static Elf32_Brandinfo freebsd_brand_info = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf32_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index 2b7ecba..af8168e 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -149,7 +149,7 @@ static Elf32_Brandinfo ia32_brand_info = { .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -165,7 +165,7 @@ static Elf32_Brandinfo ia32_brand_oinfo = { .sysvec = &ia32_freebsd_sysvec, .interp_newpath = "/libexec/ld-elf32.so.1", .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index 467854b..9f5e3a4 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -85,7 +85,7 @@ static Elf32_Brandinfo freebsd_brand_info = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -101,7 +101,7 @@ static Elf32_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 26e58ec..707ffb3 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -1038,7 +1038,7 @@ static Elf32_Brandinfo linux_brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; static Elf32_Brandinfo linux_glibc2brand = { @@ -1050,7 +1050,7 @@ static Elf32_Brandinfo linux_glibc2brand = { .sysvec = &elf_linux_sysvec, .interp_newpath = NULL, .brand_note = &linux_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; Elf32_Brandinfo *linux_brandlist[] = { diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c index fd458e1..3d3d214 100644 --- a/sys/ia64/ia64/elf_machdep.c +++ b/sys/ia64/ia64/elf_machdep.c @@ -93,7 +93,7 @@ static Elf64_Brandinfo freebsd_brand_info = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info); @@ -107,7 +107,7 @@ static Elf64_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo); diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 81a79a3..e2c0a12 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -189,7 +189,7 @@ __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; if (bi != NULL && hdr->e_machine == bi->machine && - bi->brand_note != NULL) { + (bi->flags & BI_BRAND_NOTE) != 0) { ret = __elfN(check_note)(imgp, bi->brand_note, osrel); if (ret) return (bi); diff --git a/sys/mips/mips/elf64_machdep.c b/sys/mips/mips/elf64_machdep.c index dffa134..c10fb5f 100644 --- a/sys/mips/mips/elf64_machdep.c +++ b/sys/mips/mips/elf64_machdep.c @@ -89,7 +89,7 @@ static Elf64_Brandinfo freebsd_brand_gnutools_info64 = { .sysvec = &elf64_freebsd_sysvec, .interp_path = "/libexec/ld-elf.so.1", .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(gnu_mips_elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -105,7 +105,7 @@ static Elf64_Brandinfo freebsd_brand_info64 = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = 0 + .flags = BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index 8eade98..19cb1a1 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -87,7 +87,7 @@ static Elf32_Brandinfo freebsd_brand_info = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = 0 + .flags = BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_machdep.c index 55e1a74..4946b44 100644 --- a/sys/powerpc/powerpc/elf_machdep.c +++ b/sys/powerpc/powerpc/elf_machdep.c @@ -88,7 +88,7 @@ static Elf32_Brandinfo freebsd_brand_info = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_ANY, @@ -104,7 +104,7 @@ static Elf32_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_machdep.c index 906a9b8..b0a6998 100644 --- a/sys/sparc64/sparc64/elf_machdep.c +++ b/sys/sparc64/sparc64/elf_machdep.c @@ -100,7 +100,7 @@ static Elf64_Brandinfo freebsd_brand_info = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, @@ -116,7 +116,7 @@ static Elf64_Brandinfo freebsd_brand_oinfo = { .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_freebsd_brandnote, - .flags = BI_CAN_EXEC_DYN + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE }; SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index a5c8714..60979d9 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -69,9 +69,10 @@ typedef struct { const char *interp_path; struct sysentvec *sysvec; const char *interp_newpath; - Elf_Brandnote *brand_note; int flags; + Elf_Brandnote *brand_note; #define BI_CAN_EXEC_DYN 0x0001 +#define BI_BRAND_NOTE 0x0002 } __ElfN(Brandinfo); __ElfType(Auxargs); |