Create a generalized exec hook that different architectures can hook
into if they need to, but default to no action. Differential Review: https://reviews.freebsd.org/D2718
This commit is contained in:
parent
9df1d85ebb
commit
8fd53f4577
@ -80,4 +80,6 @@ extern void *__tls_get_addr(tls_index *ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -79,4 +79,6 @@ void *__tls_get_addr(tls_index *ti) __exported;
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,41 @@ __FBSDID("$FreeBSD$");
|
||||
#include "rtld.h"
|
||||
#include "paths.h"
|
||||
|
||||
void
|
||||
arm_abi_variant_hook(Elf_Auxinfo **aux_info)
|
||||
{
|
||||
Elf_Word ehdr;
|
||||
|
||||
/*
|
||||
* If we're running an old kernel that doesn't provide any data fail
|
||||
* safe by doing nothing.
|
||||
*/
|
||||
if (aux_info[AT_EHDRFLAGS] == NULL)
|
||||
return;
|
||||
ehdr = aux_info[AT_EHDRFLAGS]->a_un.a_val;
|
||||
|
||||
/*
|
||||
* Hard float ABI binaries are the default, and use the default paths
|
||||
* and such.
|
||||
*/
|
||||
if ((ehdr & EF_ARM_VFP_FLOAT) != 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* This is a soft float ABI binary. We need to use the soft float
|
||||
* settings. For the moment, the standard library path includes the hard
|
||||
* float paths as well. When upgrading, we need to execute the wrong
|
||||
* kind of binary until we've installed the new binaries. We could go
|
||||
* off whether or not /libsoft exists, but the simplicity of having it
|
||||
* in the path wins.
|
||||
*/
|
||||
ld_elf_hints_default = _PATH_SOFT_ELF_HINTS;
|
||||
ld_path_libmap_conf = _PATH_SOFT_LIBMAP_CONF;
|
||||
ld_path_rtld = _PATH_SOFT_RTLD;
|
||||
ld_standard_library_path = SOFT_STANDARD_LIBRARY_PATH;
|
||||
ld_env_prefix = LD_SOFT_;
|
||||
}
|
||||
|
||||
void
|
||||
init_pltgot(Obj_Entry *obj)
|
||||
{
|
||||
|
@ -75,4 +75,9 @@ extern void *__tls_get_addr(tls_index *ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
extern void arm_abi_variant_hook(Elf_Auxinfo **);
|
||||
|
||||
#define md_abi_variant_hook(x) arm_abi_variant_hook(x)
|
||||
#define RTLD_VARIANT_ENV_NAMES
|
||||
|
||||
#endif
|
||||
|
@ -80,4 +80,6 @@ void *__tls_get_addr(tls_index *ti) __exported;
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -75,4 +75,6 @@ extern void *__tls_get_addr(tls_index *ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,6 @@
|
||||
/*-
|
||||
* Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra.
|
||||
* Copyright 2003 Alexander Kabaev <kan@FreeBSD.ORG>.
|
||||
* Copyright 2009-2012 Konstantin Belousov <kib@FreeBSD.ORG>.
|
||||
* Copyright 2012 John Marino <draco@marino.st>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -61,7 +59,13 @@
|
||||
#define LD_ "LD_"
|
||||
#endif
|
||||
|
||||
extern char *ld_path_elf_hints;
|
||||
#define _PATH_SOFT_ELF_HINTS "/var/run/ld-elf-soft.so.hints"
|
||||
#define _PATH_SOFT_LIBMAP_CONF "/etc/libmap-soft.conf"
|
||||
#define _PATH_SOFT_RTLD "/libexec/ld-elf.so.1"
|
||||
#define SOFT_STANDARD_LIBRARY_PATH "/libsoft:/usr/libsoft:/lib:/usr/lib"
|
||||
#define LD_SOFT_ "LD_SOFT_"
|
||||
|
||||
extern char *ld_elf_hints_default;
|
||||
extern char *ld_path_libmap_conf;
|
||||
extern char *ld_path_rtld;
|
||||
extern char *ld_standard_library_path;
|
||||
|
@ -90,4 +90,6 @@ extern void *__tls_get_addr(tls_index* ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -82,4 +82,6 @@ extern void *__tls_get_addr(tls_index* ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
|
||||
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
@ -419,6 +419,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||
|
||||
trust = !issetugid();
|
||||
|
||||
md_abi_variant_hook(aux_info);
|
||||
|
||||
ld_bind_now = getenv(_LD("BIND_NOW"));
|
||||
/*
|
||||
* If the process is tainted, then we un-set the dangerous environment
|
||||
|
@ -71,4 +71,6 @@ extern void *__tls_get_addr(tls_index *ti);
|
||||
#define RTLD_DEFAULT_STACK_PF_EXEC 0
|
||||
#define RTLD_DEFAULT_STACK_EXEC 0
|
||||
|
||||
#define md_abi_variant_hook(x)
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user