selftests: vDSO: s390 fixes
Subsystems (3)
Heiko Carstens
maintainercover selftests: vDSO: s390 fixes
Two s390 fixes to make vdso selftests running on s390.
Jason, given that you carry already a lot of changes for vdso selftests I guess these should be routed via the random tree.
Patches apply on top of current random.git master branch.
Thanks,
Heiko
Heiko Carstens (1):
selftests: vDSO: fix vdso_config for s390
Jens Remus (1):
selftests: vDSO: fix ELF hash table entry size for s390x
tools/testing/selftests/vDSO/parse_vdso.c | 14 ++++++++++---- tools/testing/selftests/vDSO/vdso_config.h | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-)
Signature · 1 line
2.43.0
Heiko Carstens
maintainerPATCH 2/2 selftests: vDSO: fix vdso_config for s390
Running vdso_test_correctness on s390x (aka s390 64 bit) emits a warning:
Warning: failed to find clock_gettime64 in vDSO
This is caused by the "#elif defined (__s390__)" check in vdso_config.h which the defines VDSO_32BIT.
If __s390x__ is defined also __s390__ is defined. Therefore the correct check must make sure that only __s390__ is defined.
Therefore add the missing !defined(__s390x__). Also use common __s390x__ define instead of __s390X__.
--- tools/testing/selftests/vDSO/vdso_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/vDSO/vdso_config.h +2 -2
@@ -25,11 +25,11 @@#define VDSO_VERSION 1#define VDSO_NAMES 0#define VDSO_32BIT 1 -#elif defined (__s390__) +#elif defined (__s390__) && !defined(__s390x__)#define VDSO_VERSION 2#define VDSO_NAMES 0#define VDSO_32BIT 1 -#elif defined (__s390X__) +#elif defined (__s390x__)#define VDSO_VERSION 2#define VDSO_NAMES 0#elif defined(__mips__)
Signature · 1 line
2.43.0
Heiko Carstens
maintainerPATCH 1/2 selftests: vDSO: fix ELF hash table entry size for s390x
In reply to Heiko CarstensFrom: Jens Remus <[email protected]>
The vDSO self tests fail on s390x for a vDSO linked with the GNU linker ld as follows:
# ./vdso_test_gettimeofday Floating point exception (core dumped)
On s390x the ELF hash table entries are 64 bits instead of 32 bits in size (see Glibc sysdeps/unix/sysv/linux/s390/bits/elfclass.h).
--- tools/testing/selftests/vDSO/parse_vdso.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tools/testing/selftests/vDSO/parse_vdso.c +10 -4
@@ -36,6 +36,12 @@#define ELF_BITS_XFORM (bits, x) ELF_BITS_XFORM2(bits, x)#define ELF (x) ELF_BITS_XFORM(ELF_BITS, x) +#ifdef __s390x__ +#define ELF_HASH_ENTRY ELF(Xword) +#else +#define ELF_HASH_ENTRY ELF(Word) +#endif + static struct vdso_info { bool valid;
@@ -47,8 +53,8 @@ static struct vdso_info/* Symbol table */ ELF (Sym) *symtab;const char *symstrings; -ELF (Word) *bucket, *chain; -ELF (Word) nbucket, nchain; +ELF_HASH_ENTRY *bucket, *chain; +ELF_HASH_ENTRY nbucket, nchain;/* Version table */ ELF (Versym) *versym;
@@ -115,7 +121,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base)/* * Fish out the useful bits of the dynamic table. */ -ELF (Word) *hash =0 ; +ELF_HASH_ENTRY *hash =0 ; vdso_info.symstrings =0 ; vdso_info.symtab =0 ; vdso_info.versym =0 ;
@@ -133,7 +139,7 @@ void vdso_init_from_sysinfo_ehdr(uintptr_t base) + vdso_info.load_offset);break ;case DT_HASH : - hash = (ELF (Word) *) + hash = (ELF_HASH_ENTRY *) ((uintptr_t )dyn[i].d_un.d_ptr + vdso_info.load_offset);break ;
Signature · 1 line
2.43.0
Quoted 6 lines · Heiko Carstens
Two s390 fixes to make vdso selftests running on s390.
Jason, given that you carry already a lot of changes for vdso selftests I guess these should be routed via the random tree.
Patches apply on top of current random.git master branch.
Sure, I'll apply these. Thanks for the patches. (And I'm looking forward to seeing what might have motivated you to notice these bugs :-).)
Jason
Re: [PATCH 2/2] selftests: vDSO: fix vdso_config for s390
In reply to Heiko CarstensQuoted 7 lines · Heiko Carstens
Running
vdso_test_correctnesson s390x (aka s390 64 bit) emits a warning:Warning: failed to find
clock_gettime64in vDSOThis is caused by the "#elif defined (
__s390__)" check invdso_config.hwhich the definesVDSO_32BIT.
Quoted 7 lines
If
__s390x__is defined also__s390__is defined. Therefore the correct check must make sure that only__s390__is defined.Therefore add the missing !defined(__s390x__). Also use common
__s390x__define instead of__s390X__.Signed-off-by Heiko Carstens <[email protected]>
I'll add to it: