mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
linux_kselftest-fixes-6.10
This kselftest fixes update for Linux 6.10 consists of fixes to clang build failures to timerns, vDSO tests and fixes to vDSO makefile. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmaMaSgACgkQCwJExA0N Qxz+xw/8DG3OciD30wrXyPbH7Lw35AJXH3IsIjirQET6hoE+saxYOWbVN9POqqVy VTh21ZwJpuSrh8gIYHUEZPLezTwIYWN7aZm2Zps7VttlfXjNvbWiLBB4ptAL/XWu SogHFeE1u1KHk8JZY3v3j//hQxL0FqnUbqRjv5nnOUS1krgL4shP6JsdUU65Bs9x TLSCJrJSCSpG/u7KAXSHlYy0kn9fnL+F2LUqTFf+kzOOdLZ+XaxHS/02GsZYgcVI SUvL6x4NEqVMyxcnvL4QBs91SD1/q80vf7g0+gKHkcuHKluto/Zmnwhw40oN92lr T6muSS2jW+OemZzglJdD4aIbCEisVtwPsPkdtux9JZV9VAH2lyYz0+G0J2fX7r11 LOcd4Y7HhoYA5UL6s6puE8xQEZOUrBNMY4exfeOkW/UaJhscewtyTMQsNRs8qW+4 lEoHFJSsVQtfuZSxUaiXm49loVxu8JueynG6dafRue8tf9mCWpOzl01fVpkoLL/1 5lMOau3DZallsiHKU0COg6eJhAi6QQjC2nYNMJHwO3DFCKpwneMYbbU9xqS5MZ5Y wVijpgyFdIMk5qxHDdVEmevFNyYG3xGYKq/sReDuwb4qJkdx7rDS5mMTkVxyHdCe ezHxw6tuiLohHXDHVCR/KxQwjiHkXZF2uudzTFDt6Lxeu68PAFk= =c2zt -----END PGP SIGNATURE----- Merge tag 'linux_kselftest-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull kselftest fixes from Shuah Khan "Fixes to clang build failures to timerns, vDSO tests and fixes to vDSO makefile" * tag 'linux_kselftest-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/vDSO: remove duplicate compiler invocations from Makefile selftests/vDSO: remove partially duplicated "all:" target in Makefile selftests/vDSO: fix clang build errors and warnings selftest/timerns: fix clang build failures for abs() calls
This commit is contained in:
commit
920bc844ba
|
|
@ -30,7 +30,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
_gettime(CLOCK_MONOTONIC, &tst, i);
|
||||
if (abs(tst.tv_sec - now.tv_sec) > 5)
|
||||
if (labs(tst.tv_sec - now.tv_sec) > 5)
|
||||
return pr_fail("%ld %ld\n", now.tv_sec, tst.tv_sec);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
_gettime(CLOCK_MONOTONIC, &tst, i);
|
||||
if (abs(tst.tv_sec - now.tv_sec) > 5)
|
||||
if (labs(tst.tv_sec - now.tv_sec) > 5)
|
||||
return pr_fail("%ld %ld\n",
|
||||
now.tv_sec, tst.tv_sec);
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
|||
/* Check that a child process is in the new timens. */
|
||||
for (i = 0; i < 2; i++) {
|
||||
_gettime(CLOCK_MONOTONIC, &tst, i);
|
||||
if (abs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
|
||||
if (labs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
|
||||
return pr_fail("%ld %ld\n",
|
||||
now.tv_sec + OFFSET, tst.tv_sec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ int run_test(int clockid, struct timespec now)
|
|||
return pr_perror("timerfd_gettime");
|
||||
|
||||
elapsed = new_value.it_value.tv_sec;
|
||||
if (abs(elapsed - 3600) > 60) {
|
||||
if (llabs(elapsed - 3600) > 60) {
|
||||
ksft_test_result_fail("clockid: %d elapsed: %lld\n",
|
||||
clockid, elapsed);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ int run_test(int clockid, struct timespec now)
|
|||
return pr_perror("timerfd_gettime(%d)", clockid);
|
||||
|
||||
elapsed = new_value.it_value.tv_sec;
|
||||
if (abs(elapsed - 3600) > 60) {
|
||||
if (llabs(elapsed - 3600) > 60) {
|
||||
ksft_test_result_fail("clockid: %d elapsed: %lld\n",
|
||||
clockid, elapsed);
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static void *tcheck(void *_args)
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
_gettime(CLOCK_MONOTONIC, &tst, i);
|
||||
if (abs(tst.tv_sec - now->tv_sec) > 5) {
|
||||
if (labs(tst.tv_sec - now->tv_sec) > 5) {
|
||||
pr_fail("%s: in-thread: unexpected value: %ld (%ld)\n",
|
||||
args->tst_name, tst.tv_sec, now->tv_sec);
|
||||
return (void *)1UL;
|
||||
|
|
@ -64,7 +64,7 @@ static int check(char *tst_name, struct timespec *now)
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
_gettime(CLOCK_MONOTONIC, &tst, i);
|
||||
if (abs(tst.tv_sec - now->tv_sec) > 5)
|
||||
if (labs(tst.tv_sec - now->tv_sec) > 5)
|
||||
return pr_fail("%s: unexpected value: %ld (%ld)\n",
|
||||
tst_name, tst.tv_sec, now->tv_sec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,30 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
include ../lib.mk
|
||||
|
||||
uname_M := $(shell uname -m 2>/dev/null || echo not)
|
||||
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
|
||||
|
||||
TEST_GEN_PROGS := $(OUTPUT)/vdso_test_gettimeofday $(OUTPUT)/vdso_test_getcpu
|
||||
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_abi
|
||||
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_clock_getres
|
||||
TEST_GEN_PROGS := vdso_test_gettimeofday
|
||||
TEST_GEN_PROGS += vdso_test_getcpu
|
||||
TEST_GEN_PROGS += vdso_test_abi
|
||||
TEST_GEN_PROGS += vdso_test_clock_getres
|
||||
ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
|
||||
TEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
|
||||
TEST_GEN_PROGS += vdso_standalone_test_x86
|
||||
endif
|
||||
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_correctness
|
||||
TEST_GEN_PROGS += vdso_test_correctness
|
||||
|
||||
CFLAGS := -std=gnu99
|
||||
CFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
|
||||
LDFLAGS_vdso_test_correctness := -ldl
|
||||
|
||||
ifeq ($(CONFIG_X86_32),y)
|
||||
LDLIBS += -lgcc_s
|
||||
endif
|
||||
|
||||
all: $(TEST_GEN_PROGS)
|
||||
include ../lib.mk
|
||||
$(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
|
||||
$(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
|
||||
$(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
|
||||
$(OUTPUT)/vdso_test_clock_getres: vdso_test_clock_getres.c
|
||||
|
||||
$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
|
||||
$(CC) $(CFLAGS) $(CFLAGS_vdso_standalone_test_x86) \
|
||||
vdso_standalone_test_x86.c parse_vdso.c \
|
||||
-o $@
|
||||
$(OUTPUT)/vdso_standalone_test_x86: CFLAGS +=-nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
|
||||
|
||||
$(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c
|
||||
$(CC) $(CFLAGS) \
|
||||
vdso_test_correctness.c \
|
||||
-o $@ \
|
||||
$(LDFLAGS_vdso_test_correctness)
|
||||
$(OUTPUT)/vdso_test_correctness: LDFLAGS += -ldl
|
||||
|
|
|
|||
|
|
@ -55,14 +55,20 @@ static struct vdso_info
|
|||
ELF(Verdef) *verdef;
|
||||
} vdso_info;
|
||||
|
||||
/* Straight from the ELF specification. */
|
||||
static unsigned long elf_hash(const unsigned char *name)
|
||||
/*
|
||||
* Straight from the ELF specification...and then tweaked slightly, in order to
|
||||
* avoid a few clang warnings.
|
||||
*/
|
||||
static unsigned long elf_hash(const char *name)
|
||||
{
|
||||
unsigned long h = 0, g;
|
||||
while (*name)
|
||||
const unsigned char *uch_name = (const unsigned char *)name;
|
||||
|
||||
while (*uch_name)
|
||||
{
|
||||
h = (h << 4) + *name++;
|
||||
if (g = h & 0xf0000000)
|
||||
h = (h << 4) + *uch_name++;
|
||||
g = h & 0xf0000000;
|
||||
if (g)
|
||||
h ^= g >> 24;
|
||||
h &= ~g;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "parse_vdso.h"
|
||||
|
||||
/* We need a libc functions... */
|
||||
/* We need some libc functions... */
|
||||
int strcmp(const char *a, const char *b)
|
||||
{
|
||||
/* This implementation is buggy: it never returns -1. */
|
||||
|
|
@ -34,6 +34,20 @@ int strcmp(const char *a, const char *b)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The clang build needs this, although gcc does not.
|
||||
* Stolen from lib/string.c.
|
||||
*/
|
||||
void *memcpy(void *dest, const void *src, size_t count)
|
||||
{
|
||||
char *tmp = dest;
|
||||
const char *s = src;
|
||||
|
||||
while (count--)
|
||||
*tmp++ = *s++;
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* ...and two syscalls. This is x86-specific. */
|
||||
static inline long x86_syscall3(long nr, long a0, long a1, long a2)
|
||||
{
|
||||
|
|
@ -70,7 +84,7 @@ void to_base10(char *lastdig, time_t n)
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((externally_visible)) void c_main(void **stack)
|
||||
void c_main(void **stack)
|
||||
{
|
||||
/* Parse the stack */
|
||||
long argc = (long)*stack;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user