On Mon, Apr 14 2025 at 14:31, Frank Li wrote:
> Some MSI controller change address/data pair when irq_set_affinity().
> Current PCI endpoint can't support this type MSI controller. So add flag
> MSI_FLAG_MUTABLE in include/linux/msi.h and check it when allocate
> doorbell.
This changelog has no re
the future nolibc-test can use the harness for itself.
Not-Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
.../selftests/kselftest_harness/harness-selftest.c |2 +-
tools/testing/selftests/nolibc/Makefile| 15 +-
tools/testing/selftests/nolibc/harness-selftest.c
Nolibc doesn't provide all normal header files.
Don't try to include these non-existent header files, as the symbols are
available unconditionally anyways.
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
tools/testing/selftests/kselftest_harness.h | 7 +--
1 file
potential duplicate teardown invocations are harmless as the actual
handler will only ever be executed once since
commit fff37bd32c76 ("selftests/harness: Fix fixture teardown").
Additionally this removes a incompatibility with nolibc,
which does not support setjmp()/longjmp().
Signed-off-
To get rid of setjmp()/longjmp(), the variant and self need to be usable
from __bail().
Make them available from the test metadata.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/kselftest_harness.h | 4
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests
To get rid of setjmp()/longjmp(), the teardown logic needs to be usable
from __bail(). To access the atomic teardown conditional from there,
move it into the test metadata.
This also allows the removal of "setup_completed".
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
too
To get rid of setjmp()/longjmp(), the teardown logic needs to be usable
from __bail(). Introduce a new callback for it.
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
tools/testing/selftests/kselftest_harness.h | 19 +--
1 file changed, 13 insertions(+), 6 deletions
__sync_bool_compare_and_swap() is deprecated and requires libatomic on
GCC. Compiler toolchains don't necessarily have libatomic available, so
avoid this requirement by using atomics that don't need libatomic.
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
Acked
Make the kselftest harness compatible with nolibc which does not implement
signals by replacing the signal logic with pidfds.
The code also becomes simpler.
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
tools/testing/selftests/kselftest_harness.h | 72
This field is unused and has no meaning for tests without fixtures.
Don't set it for them.
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
tools/testing/selftests/kselftest_harness.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/kselftest_harness
The pointers to the wrappers are stored in function pointers,
preventing them from actually being inlined.
Remove the inline qualifier, aligning these wrappers with the other
functions defined through macros.
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
Acked-by: Shuah Khan
With -Wmissing-prototypes the compiler will warn about non-static
functions which don't have a prototype defined.
As they are not used from a different compilation unit they don't need to
be defined globally.
Avoid the issue by marking the functions static.
Signed-off-by: Thomas
ame) __TEST_IMPL(test_name, -1)
| ^~~
harness-selftest.c:15:1: note: in expansion of macro 'TEST'
15 | TEST(standalone_pass) {
| ^~~~
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
Acked-by: Shuah Khan
---
tools/testing
Add a selftest for the kselftest harness itself so any changes can be
validated.
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
Acked-by: Shuah Khan
---
MAINTAINERS| 1 +
tools/testing/selftests/Makefile | 1
the usage of problematic
libc features from the harness.
Based on nolibc/for-next.
The series is meant to be merged through the nolibc tree.
Signed-off-by: Thomas Weißschuh
---
Changes in v4:
- Drop patches for nolibc which where already applied
- Preserve signatures of test functions for tests
All comments in this file use C89 comment style.
Except for this one. Change it to get one step closer to C89
compatibility.
Signed-off-by: Thomas Weißschuh
Acked-by: Shuah Khan
---
tools/testing/selftests/kselftest_harness.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a
On Mon, May 05, 2025 at 02:58:06PM +0200, Jason A. Donenfeld wrote:
> Hi Thomas,
>
> On Mon, May 5, 2025 at 11:19 AM Thomas Weißschuh
> wrote:
> >
> > vgetrandom_put_state() and the variable ret in kselftest() are never used.
> >
> > Drop the dead code.
>
Hi Mark,
On Mon, May 05, 2025 at 07:50:31PM +0900, Mark Brown wrote:
> On Fri, Apr 11, 2025 at 11:00:36AM +0200, Thomas Weißschuh wrote:
> > Usage of longjmp() was added to ensure that teardown is always run in
> > commit 63e6b2a42342 ("selftests/harness: Run TEARDOWN
The TAP specification requires that the output begins with a header line.
If vgetrandom_init() fails and skips the test, that header line is missing.
Call vgetrandom_init() after ksft_print_header().
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
---
tools/testing/selftests
use an empty argument list.
Now that all selftests a free of this warning, enable it in the Makefile.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/Makefile| 2 +-
tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
2 files changed, 2 insertions(+), 2
vgetrandom_put_state() and the variable ret in kselftest() are never used.
Drop the dead code.
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 11 +--
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git
Protect against common programming errors through compiler warnings.
These warnings are also used for the kernel itself.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO
versions[7] = {
|^~~~
Avoid those warnings through attribute((unused)).
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
---
tools/testing/selftests/vDSO/vdso_config.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/vDSO/vds
The header is unused. Furthermore this is not a real UAPI header,
but only exists in tools/include/.
This prevents building the selftest against real UAPI headers.
Drop the include.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 -
1 file changed, 1
Nothing from err.h is used.
Drop the include.
Signed-off-by: Thomas Weißschuh
Reviewed-by: Muhammad Usama Anjum
---
tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
b/tools/testing
implemented on architecture
The SKIP line should start with "ok 1" as the plan only contains one test.
Fixes: 3b5992eaf730 ("selftests: vDSO: unconditionally build chacha test")
Reviewed-by: Muhammad Usama Anjum
Signed-off-by: Thomas Weißschuh
---
I'm not sure if thi
Fixes and cleanups for various issues in the vDSO selftests.
Signed-off-by: Thomas Weißschuh
---
Changes in v2:
- Refer to -Wstrict-prototypes over -Wold-style-prototypes
- Pick up Acks
- Enable fixed warnings in Makefile
- Link to v1:
https://lore.kernel.org/r/20250502-selftests-vdso-fixes-v1
versions[7] = {
|^~~~
Avoid those warnings through attribute((unused)).
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_config.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/vDSO/vdso_config.h
b/tools/testing/self
vgetrandom_put_state() and the variable ret in kselftest() are never used.
Drop the dead code.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 11 +--
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/tools/testing/selftests/vDSO
The TAP specification requires that the output begins with a header line.
If vgetrandom_init() fails and skips the test, that header line is missing.
Call vgetrandom_init() after ksft_print_header().
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 6
The header is unused. Furthermore this is not a real UAPI header,
but only exists in tools/include/.
This prevents building the selftest against real UAPI headers.
Drop the include.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_getrandom.c | 1 -
1 file changed, 1
an empty argument list.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_correctness.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c
b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index
implemented on architecture
The SKIP line should start with "ok 1" as the plan only contains one test.
Fixes: 3b5992eaf730 ("selftests: vDSO: unconditionally build chacha test")
Signed-off-by: Thomas Weißschuh
---
I'm not sure if this is not a general bug in ksft_exit_sk
Nothing from err.h is used.
Drop the include.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
b/tools/testing/selftests/vDSO
Fixes and cleanups for various issues in the vDSO selftests.
Signed-off-by: Thomas Weißschuh
---
Thomas Weißschuh (7):
selftests: vDSO: chacha: Correctly skip test if necessary
selftests: vDSO: clock_getres: Drop unused include of err.h
selftests: vDSO: vdso_test_correctness
These functions are never used outside their defining compilation unit and
can be made static.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/timens/clock_nanosleep.c | 2 +-
tools/testing/selftests/timens/timer.c | 2 +-
tools/testing/selftests/timens/timerfd.c
tclock_gettime() is a wrapper around clock_gettime().
The first parameter of clock_gettime() is of type "clockid_t",
not "clock_t".
Use the correct type instead.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/timens/timerfd.c | 2 +-
1 file changed, 1 inse
The TAP specification requires that the output begins with a header line.
These headers lines are missing in the timens tests.
Print such a line.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/timens/clock_nanosleep.c | 2 ++
tools/testing/selftests/timens/exec.c| 2
Fixes for various issues in the timens selftests.
Signed-off-by: Thomas Weißschuh
---
Thomas Weißschuh (3):
selftests/timens: Print TAP headers
selftests/timens: Make run_tests() functions static
selftests/timens: timerfd: Use correct clockid type in tclock_gettime()
tools
On 2025-04-29 12:52:56-0600, Shuah Khan wrote:
> On 4/24/25 14:06, Shuah Khan wrote:
> > On 4/22/25 02:51, Willy Tarreau wrote:
> > > Hi Thomas,
> > >
> > > On Tue, Apr 22, 2025 at 10:48:28AM +0200, Thomas Weißschuh wrote:
> > > > Hi,
> >
Newer architectures like riscv 32-bit are missing sys_wait4().
Make use of the fact that wait(&status) is defined to be equivalent to
waitpid(-1, status, 0) to implment it on all architectures.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/sys/wait.h
Newer architectures (like riscv32) do not implement sys_gettimeofday().
In those cases fall back to sys_clock_gettime().
While that does not support the timezone argument of sys_gettimeofday(),
specifying this argument invokes undefined behaviour, so it's safe to ignore.
Signed-off-by: T
enabled by default.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sched.h | 50 +
tools/testing/selftests/nolibc/Makefile
This is used in various selftests and will be handy when integrating
those with nolibc.
Only the standard POSIX modes are supported.
No extensions nor the (noop) "b" from ISO C are accepted.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/noli
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/time.h | 7 +++
tools/testing/selftests/nolibc/nolibc-test.c | 12
2 files changed, 19
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sys/timerfd.h
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/time.h | 86
tools/include/nolibc/types.h | 1 +
tools/testing
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sys/random.h
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/time.h | 92
tools/include/nolibc/types.h | 2 +
tools/testing
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/math.h | 31
tools/include
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/unistd.h| 28
tools/testing/selftests/nolibc/nolibc-test.c | 2 ++
2 files
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/sys/mman.h | 19 +++
tools/testing/selftests/nolibc/nolibc-test.c | 14 +++---
2 files
Add fstat(), fstatat() and lstat(). All of them use the existing implementation
based on statx().
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/sys/stat.h | 25 +++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/tools
The %m format can be used to format the current errno.
It is non-standard but supported by other commonly used libcs like glibc and
musl, so applications do rely on them.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/stdio.h | 7
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/string.h| 20
tools/testing/selftests/nolibc/nolibc-test.c | 3 +++
2 files changed, 23
A few functions used by different selftests.
Adding them now avoids later conflicts between different selftest serieses.
Also add full support for nolibc-test.c on riscv32.
All unsupported syscalls have been replaced.
Signed-off-by: Thomas Weißschuh
---
Changes in v2:
- Rebase onto latest
On Sat, Apr 26, 2025 at 12:45:20PM +0200, Willy Tarreau wrote:
> On Wed, Apr 23, 2025 at 05:01:41PM +0200, Thomas Weißschuh wrote:
> > This is used in various selftests and will be handy when integrating
> > those with nolibc.
> >
> > Signed-off-by: Thomas Weißschuh
On Sat, Apr 26, 2025 at 12:31:58PM +0200, Willy Tarreau wrote:
> Hi Thomas,
>
> On Wed, Apr 23, 2025 at 05:01:35PM +0200, Thomas Weißschuh wrote:
> > --- /dev/null
> > +++ b/tools/include/nolibc/sys/random.h
> > @@ -0,0 +1,32 @@
> > +/* SPDX-Li
t; while the include
guards prevent any duplicate definitions.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/ctype.h | 6 +++---
tools/include/nolibc/dirent.h | 6 +++---
tools/include/nolibc/elf.h | 6 +++---
tools/include/nolibc/errno.h | 6 +++---
tools/in
olibc-misc-v1-0-a925bf402...@linutronix.de/
Signed-off-by: Thomas Weißschuh
---
Thomas Weißschuh (3):
tools/nolibc: add target to check header usability
tools/nolibc: include nolibc.h early from all header files
selftests/nolibc: always run nolibc header check
tools/include/
ned-off-by: Thomas Weißschuh
---
tools/include/nolibc/Makefile | 9 +
1 file changed, 9 insertions(+)
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index
e05862cd08051685112f067d6eb45716613dd43c..41ef18872a7e9435a5efec9c0b32b9e29fcd4ce8
100644
--- a/tools/incl
Prevent regressions of issues validates by the header check by always
running it together with the nolibc selftests.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/nolibc/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/nolibc
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sys/timerfd.h | 87
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/time.h | 92
tools/include/nolibc/types.h | 2 +
tools/testing/selftests/nolibc/nolibc
The %m format can be used to format the current errno.
It is non-standard but supported by other commonly used libcs like glibc and
musl, so applications do rely on them.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/stdio.h | 7 +++
tools/testing/selftests
Newer architectures like riscv 32-bit are missing sys_wait4().
Make use of the fact that wait(&status) is defined to be equivalent to
waitpid(-1, status, 0) to implment it on all architectures.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/sys/wait.h | 12 ++--
1 file cha
Newer architectures (like riscv32) do not implement sys_gettimeofday().
In those cases fall back to sys_clock_gettime().
While that does not support the timezone argument of sys_gettimeofday(),
specifying this argument invokes undefined behaviour, so it's safe to ignore.
Signed-off-by: T
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/time.h | 86
tools/include/nolibc/types.h | 1 +
tools/testing/selftests/nolibc/nolibc
A few functions used by different selftests.
Adding them now avoids later conflicts between different selftest serieses.
Also add full support for nolibc-test.c on riscv32.
All unsupported syscalls have been replaced.
Signed-off-by: Thomas Weißschuh
---
Thomas Weißschuh (15):
tools/nolibc
This is used in various selftests and will be handy when integrating
those with nolibc.
Only the standard POSIX modes are supported.
No extensions nor the (noop) "b" from ISO C are accepted.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/stdio.h
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/time.h | 7 +++
tools/testing/selftests/nolibc/nolibc-test.c | 1 +
2 files changed, 8 insertions(+)
diff --git a/tools/include
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/unistd.h| 28
tools/testing/selftests/nolibc/nolibc-test.c | 2 ++
2 files changed, 30 insertions
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/math.h | 31
tools/include/nolibc/nolibc.h
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sys/random.h| 32
Add fstat(), fstatat() and lstat(). All of them use the existing implementation
based on statx().
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/sys/stat.h | 25 +++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/tools/include/nolibc/sys/stat.h b
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/string.h| 20
tools/testing/selftests/nolibc/nolibc-test.c | 3 +++
2 files changed, 23 insertions(+)
diff
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/Makefile| 1 +
tools/include/nolibc/nolibc.h| 1 +
tools/include/nolibc/sched.h | 50
This is used in various selftests and will be handy when integrating
those with nolibc.
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/sys/mman.h | 19 +++
tools/testing/selftests/nolibc/nolibc-test.c | 14 +++---
2 files changed, 30 insertions
Hi,
On Fri, Apr 11, 2025 at 11:00:24AM +0200, Thomas Weißschuh wrote:
> Nolibc is useful for selftests as the test programs can be very small,
> and compiled with just a kernel crosscompiler, without userspace support.
> Currently nolibc is only usable with kselftest.h, not the more
>
Both constructors and main() may be executed with different function
signatures than they are actually using.
This is intentional but trips up UBSAN.
Disable the function sanitizer of UBSAN in _start_c().
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/crt.h | 5 +
1 file changed
Provide a convenience macro around __attribute__((aligned)).
Signed-off-by: Thomas Weißschuh
---
Willy, I used the name __nolibc_align*ed* because it matches what the
underlying attribute and the kernel macros are using.
---
tools/include/nolibc/compiler.h | 3 +++
1 file changed, 3 insertions
UBSAN detects undefined behaviour at runtime.
To avoid introduction of new UB, enable UBSAN for nolibc-test.
By signalling detected errors through traps no runtime dependency
is necessary.
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/testing/selftests/nolibc/Makefile | 3
In twos complement the most negative number can not be negated.
Fixes: b1c21e7d99cd ("tools/nolibc/stdlib: add i64toa() and u64toa()")
Fixes: 66c397c4d2e1 ("tools/nolibc/stdlib: replace the ltoa() function with
more efficient ones")
Signed-off-by: Thomas Weißschuh
---
smash_stack() intentionally crashes.
Prevent UBSAN from tripping over it.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/nolibc/nolibc-test.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c
b/tools/testing/selftests/nolibc/nolibc
As byte buffer is overlaid with a 'struct dirent64'.
it has to satisfy the structs alignment requirements.
Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access")
Signed-off-by: Thomas Weißschuh
Acked-by: Willy Tarreau
---
tools/include/nolibc/dirent.h | 3 ++
Fix some issues uncovered by UBSAN and enable UBSAN for nolibc-test to
avoid regressions.
Signed-off-by: Thomas Weißschuh
---
Changes in v2:
- Introduce and use __nolibc_aligned_as()
- Reduce size of fixes to i{64,}toa_r()
- Link to v1:
https://lore.kernel.org/r/20250416-nolibc-ubsan-v1-0
Certain compiler features are signaled via the __has_feature()
preprocessor builtin.
Add a nolibc wrapper for it, similar to __nolibc_has_attribute().
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/compiler.h | 6 ++
1 file changed, 6 insertions(+)
diff --git a/tools/include
On 2025-04-19 11:40:08+0200, Willy Tarreau wrote:
> On Wed, Apr 16, 2025 at 08:40:19PM +0200, Thomas Weißschuh wrote:
> > In twos complement the most negative number can not be negated.
>
> well, if we're picky, that's not really an int overflow since it's only
&g
On 2025-04-19 11:11:40+0200, Willy Tarreau wrote:
> On Wed, Apr 16, 2025 at 08:40:18PM +0200, Thomas Weißschuh wrote:
> > As byte buffer is overlaid with a 'struct dirent64'.
> > it has to satisfy the structs alignment requirements.
> >
> > Fixes: 665fa8d
On 2025-04-19 11:06:31+0200, Willy Tarreau wrote:
> On Wed, Apr 16, 2025 at 08:40:17PM +0200, Thomas Weißschuh wrote:
> > Both constructors and main() may be executed with different function
> > signatures than they are actually using.
> > This is intentional but trips up UB
Hi Paul,
On 2025-04-18 10:32:27-0700, Paul E. McKenney wrote:
> On Wed, Apr 16, 2025 at 08:40:15PM +0200, Thomas Weißschuh wrote:
> > Fix some issues uncovered by UBSAN and enable UBSAN for nolibc-test to
> > avoid regressions.
> >
> > Signed-off-by: Thomas Weißsc
On Fri, Apr 18 2025 at 08:37, Thomas Gleixner wrote:
> On Thu, Apr 17 2025 at 17:46, John Stultz wrote:
>> Instead it seems like we should just do:
>> tk->coarse_nsec = tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift;
>
> You end up with the same probl
On Thu, Apr 17 2025 at 17:46, John Stultz wrote:
> On Sat, Apr 5, 2025 at 2:40 PM Thomas Gleixner wrote:
>> @@ -1831,6 +1847,8 @@ void timekeeping_resume(void)
>> /* Re-base the last cycle value */
>> tks->tkr_mono.cycle_last = cycle_now;
>>
On Wed, Apr 16 2025 at 22:29, John Stultz wrote:
> Looking over the patch, it seems ok to me, but in a test run with it,
> I've seen an error with CLOCK_REALTIME_COARSE during the
> clocksource-switch test (as well as some seemingly unrelated test
> errors, which I need to investigate) so I'm look
As byte buffer is overlaid with a 'struct dirent64'.
it has to satisfy the structs alignment requirements.
Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access")
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/dirent.h | 1 +
1 file changed, 1 insert
smash_stack() intentionally crashes.
Prevent UBSAN from tripping over it.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/nolibc/nolibc-test.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c
b/tools/testing/selftests/nolibc/nolibc
UBSAN detects undefined behaviour at runtime.
To avoid introduction of new UB, enable UBSAN for nolibc-test.
By signalling detected errors through traps no runtime dependency
is necessary.
Signed-off-by: Thomas Weißschuh
---
tools/testing/selftests/nolibc/Makefile | 3 ++-
1 file changed, 2
Certain compiler features are signaled via the __has_feature()
preprocessor builtin.
Add a nolibc wrapper for it, similar to __nolibc_has_attribute().
Signed-off-by: Thomas Weißschuh
---
tools/include/nolibc/compiler.h | 6 ++
1 file changed, 6 insertions(+)
diff --git a/tools/include
Fix some issues uncovered by UBSAN and enable UBSAN for nolibc-test to
avoid regressions.
Signed-off-by: Thomas Weißschuh
---
Thomas Weißschuh (6):
tools/nolibc: add __nolibc_has_feature()
tools/nolibc: disable function sanitizer for _start_c()
tools/nolibc: properly align
In twos complement the most negative number can not be negated.
Fixes: b1c21e7d99cd ("tools/nolibc/stdlib: add i64toa() and u64toa()")
Fixes: 66c397c4d2e1 ("tools/nolibc/stdlib: replace the ltoa() function with
more efficient ones")
Signed-off-by: Thomas Weißschuh
---
1 - 100 of 11341 matches
Mail list logo