On 2025-07-15 08:28:09+0200, Willy Tarreau wrote:
Hi,
On Mon, Jul 14, 2025 at 07:21:38AM +0200, Thomas Weißschuh wrote:
Hi Richard,
On 2025-07-13 16:21:58-0600, Richard Henderson wrote:
On 7/13/25 14:08, Thomas Weißschuh wrote:
+++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -709,6 +709,10 @@ int run_startup(int min, int max) /* checking NULL for argv/argv0, environ and _auxv is not enough, let's compare with sbrk(0) or &end */ extern char end; char *brk = sbrk(0) != (void *)-1 ? sbrk(0) : &end; +#if defined(__alpha__)
- /* the ordering above does not work on an alpha kernel */
- brk = NULL;
+#endif
The syscall api is different for brk on alpha. A change to sys_brk or brk in include/nolibc/sys.h is required.
You are referring to osf_brk, right? I think that should work as-is with the current wrappers.
I finally managed to reinstall my DS10 to build and test this and FWIW the test passes:
Thanks for getting real hardware involved!
$ ./nolibc-test Running test 'startup' 0 argc = 1 [OK] 1 argv_addr = <0x11fc7b428> [OK] 2 argv_environ = <0x11fc7b428> [OK] 3 argv_total = 1 [OK] 4 argv0_addr = <0x11fc7b665> [OK] 5 argv0_str = <./nolibc-test> [OK] 6 argv0_len = 13 [OK] 7 environ_addr = <0x11fc7b438> [OK] 8 environ_envp = <0x11fc7b438> [OK] 9 environ_auxv = <0x11fc7b438> [OK] 10 environ_total = 175 [OK] 11 environ_HOME = <0x11fc7b6f4> [OK] 12 auxv_addr = <0x11fc7b4e8> [OK] 13 auxv_AT_UID = 509 [OK] 14 constructor = 3 [OK] 15 linkage_errno = <0x1200200f8> [OK] 16 linkage_constr = 3 [OK] Errors during this test: 0 Running test 'syscall' 0 access = 0 [OK] 1 access_bad = -1 EPERM [OK] 2 clock_getres = 0 [OK] 3 clock_gettime = 0 [OK] 4 clock_settime = -1 EINVAL [OK] 5 getpid = 9201 [OK] 6 getppid = 419 [OK] 7 gettid = 9201 [OK] 8 getpgid_self = 9201 [OK] 9 getpgid_bad = -1 ESRCH [OK] 10 kill_0 = 0 [OK] 11 kill_CONT = 0 [OK] 12 kill_BADPID = -1 ESRCH [OK] 13 sbrk_0 = <0x120024000> [OK] 14 sbrk = 0 [OK] 15 brk = 0 [OK] (...) Total number of errors: 0 Exiting with status 0
The result is exactly the same if I comment that line that resets brk, as brk was apparently already NULL:
13 sbrk_0 = <0x120024000> [OK] 14 sbrk = 0 [OK] 15 brk = 0 [OK]
brk shouldn't be NULL I think. It looks instead like it's 0x120024000. And it looks weird because the raw numbers look similar to my machine.
1 argv_addr = <0x11fc7b428> [OK]
13 sbrk_0 = <0x120024000> [OK]
argv is not greater than brk.
Could you double-check your test modification? How does it behave in QEMU for you? Also could you provide your kernel config?
On alpha, mm->brk and mm->arg_start are ordered differently from other architectures. Personally I think the nolibc tests are a bit bogus here.
I seem to remember that these are among the older minimal consistency tests and that it could be time to revisit this :-/
I do like them in general to be fair.