Add AT_BSDFLAGS auxv entry.
The intent is to provide bsd-specific flags relevant to interpreter and C runtime. I did not want to reuse AT_FLAGS which is common ELF auxv entry. Use bsdflags to report kernel support for sigfastblock(2). This allows rtld and libthr to safely infer the syscall presence without SIGSYS. The tunable kern.elf{32,64}.sigfastblock blocks reporting. Tested by: pho Disscussed with: cem, emaste, jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D12773
This commit is contained in:
parent
f88c67a625
commit
944cf37bb5
@ -183,6 +183,11 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, stack_gap, CTLFLAG_RW,
|
||||
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
|
||||
": maximum percentage of main stack to waste on a random gap");
|
||||
|
||||
static int __elfN(sigfastblock) = 1;
|
||||
SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, sigfastblock,
|
||||
CTLFLAG_RWTUN, &__elfN(sigfastblock), 0,
|
||||
"enable sigfastblock for new processes");
|
||||
|
||||
static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
|
||||
|
||||
#define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a))
|
||||
@ -1366,6 +1371,8 @@ __elfN(freebsd_copyout_auxargs)(struct image_params *imgp, uintptr_t base)
|
||||
AUXARGS_ENTRY(pos, AT_HWCAP, *imgp->sysent->sv_hwcap);
|
||||
if (imgp->sysent->sv_hwcap2 != NULL)
|
||||
AUXARGS_ENTRY(pos, AT_HWCAP2, *imgp->sysent->sv_hwcap2);
|
||||
AUXARGS_ENTRY(pos, AT_BSDFLAGS, __elfN(sigfastblock) ?
|
||||
ELF_BSDF_SIGFASTBLK : 0);
|
||||
AUXARGS_ENTRY(pos, AT_NULL, 0);
|
||||
|
||||
free(imgp->auxargs, M_TEMP);
|
||||
|
@ -954,8 +954,9 @@ typedef struct {
|
||||
#define AT_EHDRFLAGS 24 /* e_flags field from elf hdr */
|
||||
#define AT_HWCAP 25 /* CPU feature flags. */
|
||||
#define AT_HWCAP2 26 /* CPU feature flags 2. */
|
||||
#define AT_BSDFLAGS 27 /* ELF BSD Flags. */
|
||||
|
||||
#define AT_COUNT 27 /* Count of defined aux entry types. */
|
||||
#define AT_COUNT 28 /* Count of defined aux entry types. */
|
||||
|
||||
/*
|
||||
* Relocation types.
|
||||
@ -1456,5 +1457,6 @@ typedef struct {
|
||||
#define R_X86_64_TLSDESC 36
|
||||
#define R_X86_64_IRELATIVE 37
|
||||
|
||||
#define ELF_BSDF_SIGFASTBLK 0x0001 /* Kernel supports fast sigblock */
|
||||
|
||||
#endif /* !_SYS_ELF_COMMON_H_ */
|
||||
|
@ -196,6 +196,12 @@ procstat_auxv(struct procstat *procstat, struct kinfo_proc *kipp)
|
||||
xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_HWCAP2/%#lx}\n",
|
||||
prefix, "AT_HWCAP2", (u_long)auxv[i].a_un.a_val);
|
||||
break;
|
||||
#endif
|
||||
#ifdef AT_BSDFLAGS
|
||||
case AT_BSDFLAGS:
|
||||
xo_emit("{dw:/%s}{Lw:/%-16s/%s}{:AT_BSDFLAGS/%#lx}\n",
|
||||
prefix, "AT_BSDFLAGS", (u_long)auxv[i].a_un.a_val);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
xo_emit("{dw:/%s}{Lw:/%16ld/%ld}{:UNKNOWN/%#lx}\n",
|
||||
|
Loading…
Reference in New Issue
Block a user