imgact: Mark brandinfo and note structures as const
No functional change intended. Reviewed by: olce, kib, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53062 (cherry picked from commit 80336636b6b9f7a3bdad007c400e85eae017d2a2) imgact: Mark brandinfo and note structures as const No functional change intended. Reviewed by: kib MFC after: 10 days MFC with: 80336636b6b9f7a3bdad007c400e85eae017d2a2 Differential Revision: https://reviews.freebsd.org/D53173 (cherry picked from commit 301e6c47127d358073a35c1ecd7b8cf014d0bb92)
This commit is contained in:
parent
871a335f3e
commit
b8fb76b78e
17 changed files with 87 additions and 96 deletions
|
|
@ -179,7 +179,7 @@ freebsd_brand_info_la57_img_compat(const struct image_params *imgp,
|
|||
return (!prefer_uva_la48);
|
||||
}
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info_la48 = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info_la48 = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -190,7 +190,7 @@ static Elf64_Brandinfo freebsd_brand_info_la48 = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE,
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info_la57 = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info_la57 = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -216,7 +216,7 @@ sysinit_register_elf64_brand_entries(void *arg __unused)
|
|||
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
sysinit_register_elf64_brand_entries, NULL);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_oinfo = {
|
||||
static const Elf64_Brandinfo freebsd_brand_oinfo = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -226,11 +226,10 @@ static Elf64_Brandinfo freebsd_brand_oinfo = {
|
|||
.brand_note = &elf64_freebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_oinfo);
|
||||
|
||||
static Elf64_Brandinfo kfreebsd_brand_info = {
|
||||
static const Elf64_Brandinfo kfreebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -240,8 +239,7 @@ static Elf64_Brandinfo kfreebsd_brand_info = {
|
|||
.brand_note = &elf64_kfreebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY
|
||||
};
|
||||
|
||||
SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t)elf64_insert_brand_entry, &kfreebsd_brand_info);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -857,7 +857,7 @@ linux_vdso_reloc(char *mapping, Elf_Addr offset)
|
|||
}
|
||||
}
|
||||
|
||||
static Elf_Brandnote linux64_brandnote = {
|
||||
static const Elf_Brandnote linux64_brandnote = {
|
||||
.hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.hdr.n_descsz = 16,
|
||||
.hdr.n_type = 1,
|
||||
|
|
@ -866,7 +866,7 @@ static Elf_Brandnote linux64_brandnote = {
|
|||
.trans_osrel = linux_trans_osrel
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo linux_glibc2brand = {
|
||||
static const Elf64_Brandinfo linux_glibc2brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -877,7 +877,7 @@ static Elf64_Brandinfo linux_glibc2brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo linux_glibc2brandshort = {
|
||||
static const Elf64_Brandinfo linux_glibc2brandshort = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -888,7 +888,7 @@ static Elf64_Brandinfo linux_glibc2brandshort = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo linux_muslbrand = {
|
||||
static const Elf64_Brandinfo linux_muslbrand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_X86_64,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -900,7 +900,7 @@ static Elf64_Brandinfo linux_muslbrand = {
|
|||
LINUX_BI_FUTEX_REQUEUE
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo *linux_brandlist[] = {
|
||||
static const Elf64_Brandinfo *linux_brandlist[] = {
|
||||
&linux_glibc2brand,
|
||||
&linux_glibc2brandshort,
|
||||
&linux_muslbrand,
|
||||
|
|
@ -910,7 +910,7 @@ static Elf64_Brandinfo *linux_brandlist[] = {
|
|||
static int
|
||||
linux64_elf_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
Elf64_Brandinfo **brandinfo;
|
||||
const Elf64_Brandinfo **brandinfo;
|
||||
int error;
|
||||
struct linux_ioctl_handler **lihp;
|
||||
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ linux_vdso_reloc(char *mapping, Elf_Addr offset)
|
|||
}
|
||||
}
|
||||
|
||||
static Elf_Brandnote linux32_brandnote = {
|
||||
static const Elf_Brandnote linux32_brandnote = {
|
||||
.hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.hdr.n_descsz = 16, /* XXX at least 16 */
|
||||
.hdr.n_type = 1,
|
||||
|
|
@ -963,7 +963,7 @@ static Elf_Brandnote linux32_brandnote = {
|
|||
.trans_osrel = linux_trans_osrel
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_brand = {
|
||||
static const Elf32_Brandinfo linux_brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -974,7 +974,7 @@ static Elf32_Brandinfo linux_brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_glibc2brand = {
|
||||
static const Elf32_Brandinfo linux_glibc2brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -985,7 +985,7 @@ static Elf32_Brandinfo linux_glibc2brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_muslbrand = {
|
||||
static const Elf32_Brandinfo linux_muslbrand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -997,7 +997,7 @@ static Elf32_Brandinfo linux_muslbrand = {
|
|||
LINUX_BI_FUTEX_REQUEUE
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo *linux_brandlist[] = {
|
||||
static const Elf32_Brandinfo *linux_brandlist[] = {
|
||||
&linux_brand,
|
||||
&linux_glibc2brand,
|
||||
&linux_muslbrand,
|
||||
|
|
@ -1007,7 +1007,7 @@ static Elf32_Brandinfo *linux_brandlist[] = {
|
|||
static int
|
||||
linux_elf_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
Elf32_Brandinfo **brandinfo;
|
||||
const Elf32_Brandinfo **brandinfo;
|
||||
int error;
|
||||
struct linux_ioctl_handler **lihp;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_info = {
|
||||
static const Elf32_Brandinfo freebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_ARM,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -118,7 +118,7 @@ static Elf32_Brandinfo freebsd_brand_info = {
|
|||
.header_supported= elf32_arm_abi_supported,
|
||||
};
|
||||
|
||||
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
C_SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&freebsd_brand_info);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_AARCH64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -131,8 +131,7 @@ static Elf64_Brandinfo freebsd_brand_info = {
|
|||
.brand_note = &elf64_freebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
C_SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
(sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
|
||||
|
||||
static bool
|
||||
|
|
@ -336,7 +335,7 @@ elf_cpu_parse_dynamic(caddr_t loadbase __unused, Elf_Dyn *dynamic __unused)
|
|||
return (0);
|
||||
}
|
||||
|
||||
static Elf_Note gnu_property_note = {
|
||||
static const Elf_Note gnu_property_note = {
|
||||
.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.n_descsz = 16,
|
||||
.n_type = NT_GNU_PROPERTY_TYPE_0,
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ linux_vdso_reloc(char *mapping, Elf_Addr offset)
|
|||
}
|
||||
}
|
||||
|
||||
static Elf_Brandnote linux64_brandnote = {
|
||||
static const Elf_Brandnote linux64_brandnote = {
|
||||
.hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.hdr.n_descsz = 16,
|
||||
.hdr.n_type = 1,
|
||||
|
|
@ -593,7 +593,7 @@ static Elf_Brandnote linux64_brandnote = {
|
|||
.trans_osrel = linux_trans_osrel
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo linux_glibc2brand = {
|
||||
static const Elf64_Brandinfo linux_glibc2brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_AARCH64,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -604,7 +604,7 @@ static Elf64_Brandinfo linux_glibc2brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
Elf64_Brandinfo *linux_brandlist[] = {
|
||||
const Elf64_Brandinfo *linux_brandlist[] = {
|
||||
&linux_glibc2brand,
|
||||
NULL
|
||||
};
|
||||
|
|
@ -612,8 +612,8 @@ Elf64_Brandinfo *linux_brandlist[] = {
|
|||
static int
|
||||
linux64_elf_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
Elf64_Brandinfo **brandinfo;
|
||||
struct linux_ioctl_handler**lihp;
|
||||
const Elf64_Brandinfo **brandinfo;
|
||||
struct linux_ioctl_handler **lihp;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ struct sysentvec ia32_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
|
||||
|
||||
static Elf32_Brandinfo ia32_brand_info = {
|
||||
static const Elf32_Brandinfo ia32_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -155,12 +155,10 @@ static Elf32_Brandinfo ia32_brand_info = {
|
|||
.brand_note = &elf32_freebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
C_SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_MIDDLE,
|
||||
(sysinit_cfunc_t)elf32_insert_brand_entry, &ia32_brand_info);
|
||||
|
||||
SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_MIDDLE,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&ia32_brand_info);
|
||||
|
||||
static Elf32_Brandinfo ia32_brand_oinfo = {
|
||||
static const Elf32_Brandinfo ia32_brand_oinfo = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -170,12 +168,10 @@ static Elf32_Brandinfo ia32_brand_oinfo = {
|
|||
.brand_note = &elf32_freebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
C_SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t)elf32_insert_brand_entry, &ia32_brand_oinfo);
|
||||
|
||||
SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&ia32_brand_oinfo);
|
||||
|
||||
static Elf32_Brandinfo kia32_brand_info = {
|
||||
static const Elf32_Brandinfo kia32_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -184,10 +180,8 @@ static Elf32_Brandinfo kia32_brand_info = {
|
|||
.brand_note = &elf32_kfreebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY
|
||||
};
|
||||
|
||||
SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&kia32_brand_info);
|
||||
C_SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t)elf32_insert_brand_entry, &kia32_brand_info);
|
||||
|
||||
void
|
||||
elf32_dump_thread(struct thread *td, void *dst, size_t *off)
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ linux_futex(struct thread *td, struct linux_futex_args *args)
|
|||
* set LINUX_BI_FUTEX_REQUEUE bit of Brandinfo flags.
|
||||
*/
|
||||
p = td->td_proc;
|
||||
Elf_Brandinfo *bi = p->p_elf_brandinfo;
|
||||
const Elf_Brandinfo *bi = p->p_elf_brandinfo;
|
||||
if (bi == NULL || ((bi->flags & LINUX_BI_FUTEX_REQUEUE)) == 0)
|
||||
return (EINVAL);
|
||||
args->val3_compare = false;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_info = {
|
||||
static const Elf32_Brandinfo freebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -103,11 +103,11 @@ static Elf32_Brandinfo freebsd_brand_info = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
C_SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&freebsd_brand_info);
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_oinfo = {
|
||||
static const Elf32_Brandinfo freebsd_brand_oinfo = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -118,11 +118,11 @@ static Elf32_Brandinfo freebsd_brand_oinfo = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&freebsd_brand_oinfo);
|
||||
|
||||
static Elf32_Brandinfo kfreebsd_brand_info = {
|
||||
static const Elf32_Brandinfo kfreebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -133,7 +133,7 @@ static Elf32_Brandinfo kfreebsd_brand_info = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY
|
||||
};
|
||||
|
||||
SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&kfreebsd_brand_info);
|
||||
|
||||
|
|
|
|||
|
|
@ -796,7 +796,7 @@ linux_vdso_reloc(char *mapping, Elf_Addr offset)
|
|||
}
|
||||
}
|
||||
|
||||
static Elf_Brandnote linux_brandnote = {
|
||||
static const Elf_Brandnote linux_brandnote = {
|
||||
.hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.hdr.n_descsz = 16, /* XXX at least 16 */
|
||||
.hdr.n_type = 1,
|
||||
|
|
@ -805,7 +805,7 @@ static Elf_Brandnote linux_brandnote = {
|
|||
.trans_osrel = linux_trans_osrel
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_brand = {
|
||||
static const Elf32_Brandinfo linux_brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -816,7 +816,7 @@ static Elf32_Brandinfo linux_brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_glibc2brand = {
|
||||
static const Elf32_Brandinfo linux_glibc2brand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -827,7 +827,7 @@ static Elf32_Brandinfo linux_glibc2brand = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo linux_muslbrand = {
|
||||
static const Elf32_Brandinfo linux_muslbrand = {
|
||||
.brand = ELFOSABI_LINUX,
|
||||
.machine = EM_386,
|
||||
.compat_3_brand = "Linux",
|
||||
|
|
@ -839,7 +839,7 @@ static Elf32_Brandinfo linux_muslbrand = {
|
|||
LINUX_BI_FUTEX_REQUEUE
|
||||
};
|
||||
|
||||
Elf32_Brandinfo *linux_brandlist[] = {
|
||||
const Elf32_Brandinfo *linux_brandlist[] = {
|
||||
&linux_brand,
|
||||
&linux_glibc2brand,
|
||||
&linux_muslbrand,
|
||||
|
|
@ -849,7 +849,7 @@ Elf32_Brandinfo *linux_brandlist[] = {
|
|||
static int
|
||||
linux_elf_modevent(module_t mod, int type, void *data)
|
||||
{
|
||||
Elf32_Brandinfo **brandinfo;
|
||||
const Elf32_Brandinfo **brandinfo;
|
||||
int error;
|
||||
struct linux_ioctl_handler **lihp;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
#define ELF_ABI_ID __CONCAT(elf, __ELF_WORD_SIZE)
|
||||
|
||||
static int __elfN(check_header)(const Elf_Ehdr *hdr);
|
||||
static Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
|
||||
static const Elf_Brandinfo *__elfN(get_brandinfo)(struct image_params *imgp,
|
||||
const char *interp, int32_t *osrel, uint32_t *fctl0);
|
||||
static int __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
|
||||
u_long *entry);
|
||||
|
|
@ -104,7 +104,7 @@ static bool __elfN(freebsd_trans_osrel)(const Elf_Note *note,
|
|||
int32_t *osrel);
|
||||
static bool kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
|
||||
static bool __elfN(check_note)(struct image_params *imgp,
|
||||
Elf_Brandnote *checknote, int32_t *osrel, bool *has_fctl0,
|
||||
const Elf_Brandnote *checknote, int32_t *osrel, bool *has_fctl0,
|
||||
uint32_t *fctl0);
|
||||
static vm_prot_t __elfN(trans_prot)(Elf_Word);
|
||||
static Elf_Word __elfN(untrans_prot)(vm_prot_t);
|
||||
|
|
@ -227,11 +227,11 @@ SYSCTL_BOOL(ELF_NODE_OID, OID_AUTO, allow_wx,
|
|||
CTLFLAG_RWTUN, &__elfN(allow_wx), 0,
|
||||
"Allow pages to be mapped simultaneously writable and executable");
|
||||
|
||||
static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
|
||||
static const Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
|
||||
|
||||
#define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a))
|
||||
|
||||
Elf_Brandnote __elfN(freebsd_brandnote) = {
|
||||
const Elf_Brandnote __elfN(freebsd_brandnote) = {
|
||||
.hdr.n_namesz = sizeof(FREEBSD_ABI_VENDOR),
|
||||
.hdr.n_descsz = sizeof(int32_t),
|
||||
.hdr.n_type = NT_FREEBSD_ABI_TAG,
|
||||
|
|
@ -254,7 +254,7 @@ __elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel)
|
|||
|
||||
static int GNU_KFREEBSD_ABI_DESC = 3;
|
||||
|
||||
Elf_Brandnote __elfN(kfreebsd_brandnote) = {
|
||||
const Elf_Brandnote __elfN(kfreebsd_brandnote) = {
|
||||
.hdr.n_namesz = sizeof(GNU_ABI_VENDOR),
|
||||
.hdr.n_descsz = 16, /* XXX at least 16 */
|
||||
.hdr.n_type = 1,
|
||||
|
|
@ -286,7 +286,7 @@ kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel)
|
|||
}
|
||||
|
||||
int
|
||||
__elfN(insert_brand_entry)(Elf_Brandinfo *entry)
|
||||
__elfN(insert_brand_entry)(const Elf_Brandinfo *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ __elfN(insert_brand_entry)(Elf_Brandinfo *entry)
|
|||
}
|
||||
|
||||
int
|
||||
__elfN(remove_brand_entry)(Elf_Brandinfo *entry)
|
||||
__elfN(remove_brand_entry)(const Elf_Brandinfo *entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ __elfN(remove_brand_entry)(Elf_Brandinfo *entry)
|
|||
}
|
||||
|
||||
bool
|
||||
__elfN(brand_inuse)(Elf_Brandinfo *entry)
|
||||
__elfN(brand_inuse)(const Elf_Brandinfo *entry)
|
||||
{
|
||||
struct proc *p;
|
||||
bool rval = false;
|
||||
|
|
@ -338,12 +338,12 @@ __elfN(brand_inuse)(Elf_Brandinfo *entry)
|
|||
return (rval);
|
||||
}
|
||||
|
||||
static Elf_Brandinfo *
|
||||
static const Elf_Brandinfo *
|
||||
__elfN(get_brandinfo)(struct image_params *imgp, const char *interp,
|
||||
int32_t *osrel, uint32_t *fctl0)
|
||||
{
|
||||
const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
|
||||
Elf_Brandinfo *bi, *bi_m;
|
||||
const Elf_Brandinfo *bi, *bi_m;
|
||||
bool ret, has_fctl0;
|
||||
int i, interp_name_len;
|
||||
|
||||
|
|
@ -492,7 +492,7 @@ __elfN(phdr_in_zero_page)(const Elf_Ehdr *hdr)
|
|||
static int
|
||||
__elfN(check_header)(const Elf_Ehdr *hdr)
|
||||
{
|
||||
Elf_Brandinfo *bi;
|
||||
const Elf_Brandinfo *bi;
|
||||
int i;
|
||||
|
||||
if (!IS_ELF(*hdr) ||
|
||||
|
|
@ -1109,7 +1109,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
|||
struct vmspace *vmspace;
|
||||
vm_map_t map;
|
||||
char *interp;
|
||||
Elf_Brandinfo *brand_info;
|
||||
const Elf_Brandinfo *brand_info;
|
||||
struct sysentvec *sv;
|
||||
u_long addr, baddr, entry, proghdr;
|
||||
u_long maxalign, maxsalign, mapsz, maxv, maxv1, anon_loc;
|
||||
|
|
@ -1925,7 +1925,7 @@ __elfN(puthdr)(struct thread *td, void *hdr, size_t hdrsize, int numsegs,
|
|||
Elf_Phdr *phdr;
|
||||
Elf_Shdr *shdr;
|
||||
struct phdr_closure phc;
|
||||
Elf_Brandinfo *bi;
|
||||
const Elf_Brandinfo *bi;
|
||||
|
||||
ehdr = (Elf_Ehdr *)hdr;
|
||||
bi = td->td_proc->p_elf_brandinfo;
|
||||
|
|
@ -2861,7 +2861,7 @@ ret:
|
|||
}
|
||||
|
||||
struct brandnote_cb_arg {
|
||||
Elf_Brandnote *brandnote;
|
||||
const Elf_Brandnote *brandnote;
|
||||
int32_t *osrel;
|
||||
};
|
||||
|
||||
|
|
@ -2883,7 +2883,7 @@ brandnote_cb(const Elf_Note *note, void *arg0, bool *res)
|
|||
return (true);
|
||||
}
|
||||
|
||||
static Elf_Note fctl_note = {
|
||||
static const Elf_Note fctl_note = {
|
||||
.n_namesz = sizeof(FREEBSD_ABI_VENDOR),
|
||||
.n_descsz = sizeof(uint32_t),
|
||||
.n_type = NT_FREEBSD_FEATURE_CTL,
|
||||
|
|
@ -2918,7 +2918,7 @@ note_fctl_cb(const Elf_Note *note, void *arg0, bool *res)
|
|||
* as for headers.
|
||||
*/
|
||||
static bool
|
||||
__elfN(check_note)(struct image_params *imgp, Elf_Brandnote *brandnote,
|
||||
__elfN(check_note)(struct image_params *imgp, const Elf_Brandnote *brandnote,
|
||||
int32_t *osrel, bool *has_fctl0, uint32_t *fctl0)
|
||||
{
|
||||
const Elf_Phdr *phdr;
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p,
|
|||
#endif
|
||||
int error, i, orig_osrel;
|
||||
uint32_t orig_fctl0;
|
||||
Elf_Brandinfo *orig_brandinfo;
|
||||
const Elf_Brandinfo *orig_brandinfo;
|
||||
size_t freepath_size;
|
||||
static const char fexecv_proc_title[] = "(fexecv)";
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_info = {
|
||||
static const Elf32_Brandinfo freebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_PPC,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -158,11 +158,11 @@ static Elf32_Brandinfo freebsd_brand_info = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
C_SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&freebsd_brand_info);
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_oinfo = {
|
||||
static const Elf32_Brandinfo freebsd_brand_oinfo = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_PPC,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -173,7 +173,7 @@ static Elf32_Brandinfo freebsd_brand_oinfo = {
|
|||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
|
||||
SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf32_insert_brand_entry,
|
||||
&freebsd_brand_oinfo);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ static bool ppc64_elfv1_header_match(const struct image_params *params,
|
|||
static bool ppc64_elfv2_header_match(const struct image_params *params,
|
||||
const int32_t *, const uint32_t *);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info_elfv1 = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info_elfv1 = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_PPC64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -166,11 +166,11 @@ static Elf64_Brandinfo freebsd_brand_info_elfv1 = {
|
|||
.header_supported = &ppc64_elfv1_header_match
|
||||
};
|
||||
|
||||
SYSINIT(elf64v1, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(elf64v1, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf64_insert_brand_entry,
|
||||
&freebsd_brand_info_elfv1);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info_elfv2 = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info_elfv2 = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_PPC64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -182,11 +182,11 @@ static Elf64_Brandinfo freebsd_brand_info_elfv2 = {
|
|||
.header_supported = &ppc64_elfv2_header_match
|
||||
};
|
||||
|
||||
SYSINIT(elf64v2, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(elf64v2, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf64_insert_brand_entry,
|
||||
&freebsd_brand_info_elfv2);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_oinfo = {
|
||||
static const Elf64_Brandinfo freebsd_brand_oinfo = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_PPC64,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -198,7 +198,7 @@ static Elf64_Brandinfo freebsd_brand_oinfo = {
|
|||
.header_supported = &ppc64_elfv1_header_match
|
||||
};
|
||||
|
||||
SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
C_SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY,
|
||||
(sysinit_cfunc_t) elf64_insert_brand_entry,
|
||||
&freebsd_brand_oinfo);
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
|||
};
|
||||
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info = {
|
||||
static const Elf64_Brandinfo freebsd_brand_info = {
|
||||
.brand = ELFOSABI_FREEBSD,
|
||||
.machine = EM_RISCV,
|
||||
.compat_3_brand = "FreeBSD",
|
||||
|
|
@ -110,7 +110,7 @@ static Elf64_Brandinfo freebsd_brand_info = {
|
|||
.brand_note = &elf64_freebsd_brandnote,
|
||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
|
||||
};
|
||||
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
C_SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
|
||||
(sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ typedef struct {
|
|||
struct sysentvec *sysvec;
|
||||
const char *interp_newpath;
|
||||
int flags;
|
||||
Elf_Brandnote *brand_note;
|
||||
bool (*header_supported)(const struct image_params *,
|
||||
const Elf_Brandnote *brand_note;
|
||||
bool (*const header_supported)(const struct image_params *,
|
||||
const int32_t *, const uint32_t *);
|
||||
/* High 8 bits of flags is private to the ABI */
|
||||
#define BI_CAN_EXEC_DYN 0x0001
|
||||
|
|
@ -111,9 +111,9 @@ struct sseg_closure {
|
|||
size_t size; /* Total size of all writable segments. */
|
||||
};
|
||||
|
||||
bool __elfN(brand_inuse)(Elf_Brandinfo *entry);
|
||||
int __elfN(insert_brand_entry)(Elf_Brandinfo *entry);
|
||||
int __elfN(remove_brand_entry)(Elf_Brandinfo *entry);
|
||||
bool __elfN(brand_inuse)(const Elf_Brandinfo *entry);
|
||||
int __elfN(insert_brand_entry)(const Elf_Brandinfo *entry);
|
||||
int __elfN(remove_brand_entry)(const Elf_Brandinfo *entry);
|
||||
int __elfN(freebsd_fixup)(uintptr_t *, struct image_params *);
|
||||
int __elfN(coredump)(struct thread *, struct coredump_writer *, off_t, int);
|
||||
size_t __elfN(populate_note)(int, void *, void *, size_t, void **);
|
||||
|
|
@ -132,8 +132,8 @@ bool __elfN(parse_notes)(const struct image_params *, const Elf_Note *,
|
|||
void __elfN(dump_thread)(struct thread *, void *, size_t *);
|
||||
|
||||
extern int __elfN(fallback_brand);
|
||||
extern Elf_Brandnote __elfN(freebsd_brandnote);
|
||||
extern Elf_Brandnote __elfN(kfreebsd_brandnote);
|
||||
extern const Elf_Brandnote __elfN(freebsd_brandnote);
|
||||
extern const Elf_Brandnote __elfN(kfreebsd_brandnote);
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_SYS_IMGACT_ELF_H_ */
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ struct proc {
|
|||
reaper which spawned
|
||||
our subtree. */
|
||||
uint64_t p_elf_flags; /* (x) ELF flags */
|
||||
void *p_elf_brandinfo; /* (x) Elf_Brandinfo, NULL for
|
||||
const void *p_elf_brandinfo; /* (x) Elf_Brandinfo, NULL for
|
||||
non ELF binaries. */
|
||||
sbintime_t p_umtx_min_timeout;
|
||||
/* End area that is copied on creation. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue