From: Paul Floyd Date: Fri, 28 Oct 2022 14:52:50 +0000 (+0200) Subject: FreeBSD: remove dependency on elf header and make VKI_ copies of AT defines X-Git-Tag: VALGRIND_3_21_0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ff2185f4590b7850de138270b8a0dfdc3ae6c6b;p=thirdparty%2Fvalgrind.git FreeBSD: remove dependency on elf header and make VKI_ copies of AT defines Also prepare NEWS and configure.ac for 3.21.0 --- diff --git a/NEWS b/NEWS index 029161cc67..614ce44a36 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,32 @@ +Release 3.21.0 (?? Apr 2023) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This release supports X86/Linux, AMD64/Linux, ARM32/Linux, ARM64/Linux, +PPC32/Linux, PPC64BE/Linux, PPC64LE/Linux, S390X/Linux, MIPS32/Linux, +MIPS64/Linux, ARM/Android, ARM64/Android, MIPS32/Android, X86/Android, +X86/Solaris, AMD64/Solaris, AMD64/MacOSX 10.12, X86/FreeBSD and +AMD64/FreeBSD. There is also preliminary support for X86/macOS 10.13, +AMD64/macOS 10.13 and nanoMIPS/Linux. + +* ==================== CORE CHANGES =================== + + +* ==================== FIXED BUGS ==================== + +The following bugs have been fixed or resolved. Note that "n-i-bz" +stands for "not in bugzilla" -- that is, a bug that was reported to us +but never got a bugzilla entry. We encourage you to file bugs in +bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather +than mailing the developers (or mailing lists) directly -- bugs that +are not entered into bugzilla tend to get forgotten about or ignored. + + +To see details of a given bug, visit + https://bugs.kde.org/show_bug.cgi?id=XXXXXX +where XXXXXX is the bug number as listed above. + +(3.21.0.RC1: ?? Apr 2023) + Release 3.20.0 (24 Oct 2022) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/configure.ac b/configure.ac index 4a3f3db22d..41047dc2c6 100755 --- a/configure.ac +++ b/configure.ac @@ -15,10 +15,10 @@ # Also set the (expected/last) release date here. # Do not forget to rerun ./autogen.sh m4_define([v_major_ver], [3]) -m4_define([v_minor_ver], [20]) +m4_define([v_minor_ver], [21]) m4_define([v_micro_ver], [0]) -m4_define([v_suffix_ver], []) -m4_define([v_rel_date], ["24 Oct 2022"]) +m4_define([v_suffix_ver], [GIT]) +m4_define([v_rel_date], ["?? Apr 2023"]) m4_define([v_version], m4_if(v_suffix_ver, [], [v_major_ver.v_minor_ver.v_micro_ver], diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index 8188e60d90..ece565e66d 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -52,12 +52,6 @@ #include "pub_core_pathscan.h" #include "pub_core_initimg.h" /* self */ -/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */ -/* This is for ELF types etc, and also the AT_ constants. */ -#include -/* --- !!! --- EXTERNAL HEADERS end --- !!! --- */ - - /*====================================================================*/ /*=== Loading the client ===*/ /*====================================================================*/ @@ -439,30 +433,30 @@ Addr setup_client_stack( void* init_sp, /* now, how big is the auxv? */ auxsize = sizeof(*auxv); /* there's always at least one entry: AT_NULL */ - for (cauxv = orig_auxv; cauxv->a_type != AT_NULL; cauxv++) { + for (cauxv = orig_auxv; cauxv->a_type != VKI_AT_NULL; cauxv++) { auxsize += sizeof(*cauxv); switch(cauxv->a_type) { - case AT_EXECPATH: + case VKI_AT_EXECPATH: stringsize += VG_(strlen)(cauxv->u.a_ptr) + 1; break; - case AT_CANARYLEN: + case VKI_AT_CANARYLEN: canarylen = cauxv->u.a_val; /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += canarylen; break; - case AT_PAGESIZESLEN: + case VKI_AT_PAGESIZESLEN: pagesizeslen = cauxv->u.a_val; /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += pagesizeslen; break; #if 0 - case AT_TIMEKEEP: + case VKI_AT_TIMEKEEP: /*VG_ROUNDUP(stringsize, sizeof(Word));*/ stringsize += sizeof(struct vki_vdso_timehands); break; #endif #if (FREEBSD_VERS >= FREEBSD_13_0) - case AT_PS_STRINGS: + case VKI_AT_PS_STRINGS: stringsize += sizeof(struct vki_ps_strings); break; #endif @@ -622,7 +616,7 @@ Addr setup_client_stack( void* init_sp, *client_auxv = (UInt *)auxv; VG_(client_auxv) = (UWord *)*client_auxv; - for (; orig_auxv->a_type != AT_NULL; auxv++, orig_auxv++) { + for (; orig_auxv->a_type != VKI_AT_NULL; auxv++, orig_auxv++) { /* copy the entry... */ *auxv = *orig_auxv; @@ -637,49 +631,49 @@ Addr setup_client_stack( void* init_sp, */ switch(auxv->a_type) { - case AT_IGNORE: - case AT_PHENT: - case AT_PAGESZ: - case AT_FLAGS: - case AT_NOTELF: - case AT_UID: - case AT_EUID: - case AT_GID: - case AT_EGID: - case AT_STACKPROT: - case AT_NCPUS: - case AT_OSRELDATE: - case AT_PAGESIZESLEN: - case AT_CANARYLEN: + case VKI_AT_IGNORE: + case VKI_AT_PHENT: + case VKI_AT_PAGESZ: + case VKI_AT_FLAGS: + case VKI_AT_NOTELF: + case VKI_AT_UID: + case VKI_AT_EUID: + case VKI_AT_GID: + case VKI_AT_EGID: + case VKI_AT_STACKPROT: + case VKI_AT_NCPUS: + case VKI_AT_OSRELDATE: + case VKI_AT_PAGESIZESLEN: + case VKI_AT_CANARYLEN: #if (FREEBSD_VERS >= FREEBSD_11) // FreeBSD 11+ also have HWCAP and HWCAP2 - case AT_EHDRFLAGS: + case VKI_AT_EHDRFLAGS: #endif /* All these are pointerless, so we don't need to do anything about them. */ break; - case AT_EXECPATH: + case VKI_AT_EXECPATH: auxv->u.a_ptr = copy_str(&strtab, orig_auxv->u.a_ptr); break; - case AT_CANARY: + case VKI_AT_CANARY: if (canarylen >= 1) auxv->u.a_ptr = copy_bytes(&strtab, orig_auxv->u.a_ptr, canarylen); else - auxv->a_type = AT_IGNORE; + auxv->a_type = VKI_AT_IGNORE; break; - case AT_PAGESIZES: + case VKI_AT_PAGESIZES: if (pagesizeslen >= 1) auxv->u.a_ptr = copy_bytes(&strtab, orig_auxv->u.a_ptr, pagesizeslen); else - auxv->a_type = AT_IGNORE; + auxv->a_type = VKI_AT_IGNORE; break; #if 0 /* * @todo PJF this crashes intermittently */ - case AT_TIMEKEEP: + case VKI_AT_TIMEKEEP: auxv->u.a_ptr = copy_bytes(&strtab, orig_auxv->u.a_ptr, sizeof(struct vki_vdso_timehands)); break; #endif @@ -688,18 +682,18 @@ Addr setup_client_stack( void* init_sp, /* @todo PJF BSDFLAGS causes serveral testcases to crash. Not sure why, it seems to be used for sigfastblock */ // case AT_BSDFLAGS: - case AT_ARGC: - case AT_ENVC: + case VKI_AT_ARGC: + case VKI_AT_ENVC: break; - case AT_PS_STRINGS: + case VKI_AT_PS_STRINGS: auxv->u.a_ptr = copy_bytes(&strtab, orig_auxv->u.a_ptr, sizeof(struct vki_ps_strings)); ((struct vki_ps_strings*)auxv->u.a_ptr)->ps_envstr = (char**)VG_(client_envp); ((struct vki_ps_strings*)auxv->u.a_ptr)->ps_argvstr = (char**)client_argv; break; - case AT_ARGV: + case VKI_AT_ARGV: auxv->u.a_val = client_argv; break; - case AT_ENVV: + case VKI_AT_ENVV: auxv->u.a_val = (Word)VG_(client_envp); break; #endif @@ -714,33 +708,33 @@ Addr setup_client_stack( void* init_sp, #endif #if (FREEBSD_VERS >= FREEBSD_14) - case AT_USRSTACKBASE: + case VKI_AT_USRSTACKBASE: auxv->u.a_val = VG_(get_usrstack)(); break; - case AT_USRSTACKLIM: + case VKI_AT_USRSTACKLIM: auxv->u.a_val = clstack_max_size; break; #endif - case AT_PHDR: + case VKI_AT_PHDR: if (info->phdr == 0) - auxv->a_type = AT_IGNORE; + auxv->a_type = VKI_AT_IGNORE; else auxv->u.a_val = info->phdr; break; - case AT_PHNUM: + case VKI_AT_PHNUM: if (info->phdr == 0) - auxv->a_type = AT_IGNORE; + auxv->a_type = VKI_AT_IGNORE; else auxv->u.a_val = info->phnum; break; - case AT_BASE: + case VKI_AT_BASE: auxv->u.a_val = info->interp_offset; break; - case AT_ENTRY: + case VKI_AT_ENTRY: auxv->u.a_val = info->entry; break; @@ -749,12 +743,12 @@ Addr setup_client_stack( void* init_sp, VG_(debugLog)(2, "initimg", "stomping auxv entry %llu\n", (ULong)auxv->a_type); - auxv->a_type = AT_IGNORE; + auxv->a_type = VKI_AT_IGNORE; break; } } *auxv = *orig_auxv; - vg_assert(auxv->a_type == AT_NULL); + vg_assert(auxv->a_type == VKI_AT_NULL); vg_assert((strtab-stringbase) == stringsize); diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index c7481f31c7..7f32c9cf86 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2479,7 +2479,48 @@ struct vki_ps_strings { //---------------------------------------------------------------------- #define VKI_AT_NULL 0 +#define VKI_AT_IGNORE 1 +#define VKI_AT_EXECFD 2 +#define VKI_AT_PHDR 3 +#define VKI_AT_PHENT 4 +#define VKI_AT_PHNUM 5 +#define VKI_AT_PAGESZ 6 +#define VKI_AT_BASE 7 +#define VKI_AT_FLAGS 8 +#define VKI_AT_ENTRY 9 +#define VKI_AT_NOTELF 10 +#define VKI_AT_UID 11 +#define VKI_AT_EUID 12 +#define VKI_AT_GID 13 +#define VKI_AT_EGID 14 +#define VKI_AT_EXECPATH 15 +#define VKI_AT_CANARY 16 +#define VKI_AT_CANARYLEN 17 +#define VKI_AT_OSRELDATE 18 +#define VKI_AT_NCPUS 19 +#define VKI_AT_PAGESIZES 20 +#define VKI_AT_PAGESIZESLEN 21 +#define VKI_AT_TIMEKEEP 22 +#define VKI_AT_STACKPROT 23 +#define VKI_AT_EHDRFLAGS 24 +#define VKI_AT_HWCAP 25 +#define VKI_AT_HWCAP2 26 +/* added in FreeBSD 13 */ +#define VKI_AT_BSDFLAGS 27 +#define VKI_AT_ARGC 28 +#define VKI_AT_ARGV 29 +#define VKI_AT_ENVC 30 +#define VKI_AT_ENVV 31 #define VKI_AT_PS_STRINGS 32 +/* added in FreeBSD 13.1 */ +#define VKI_AT_FXRNG 33 +#define VKI_AT_KPRELOAD 34 +/* added in FreeBSD 14 */ +#define VKI_AT_USRSTACKBASE 35 +#define VKI_T_USRSTACKLIM 36 + +/* AT_COUNT depends on the FreeBSD version, not currently used */ + #define VKI_NT_FREEBSD_ABI_TAG 1 #define VKI_NT_FREEBSD_FEATURE_CTL 4