The latest GNUstep Base release reliably fails to build (testsuite
failure) on Debian's s390x buildds:

https://buildd.debian.org/status/fetch.php?pkg=gnustep-base&arch=s390x&ver=1.31.0-2&stamp=1739962963&raw=0

I was able to reproduce this with latest git (commit 519c4da, no
Debian patches) in a QEMU-enabled chroot.  Unfortunately GDB cannot be
used in an emulated environment, I have to use a multiarch-capable GDB
with the remote connection facility (gdbstub) -- but I don't know how
to convert a chroot to a QEMU image in order to pass the necessary
options.

Here's the valgrind output:

# LD_LIBRARY_PATH=Source/obj:$LD_LIBRARY_PATH valgrind 
Tests/base/Functions/obj/NSByteSwapping
==1739610== Memcheck, a memory error detector
==1739610== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==1739610== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==1739610== Command: Tests/base/Functions/obj/NSByteSwapping
==1739610== 
Configuration contains unknown keys - ("GNUSTEP_FILESYSTEM_LAYOUT")
Add them in the comma separated list GNUSTEP_EXTRA=... if required.
Passed test:     (2025-02-20 10:59:06.862 +0000) NSByteSwapping.m:14 ... 
NSSwapShort works
Passed test:     (2025-02-20 10:59:30.338 +0000) NSByteSwapping.m:22 ... 
NSSwapLongLong works
Passed test:     (2025-02-20 10:59:30.412 +0000) NSByteSwapping.m:28 ... 
NSSwapLongLong works
Passed test:     (2025-02-20 10:59:30.459 +0000) NSByteSwapping.m:32 ... 
NSSwapBigFloatToHost works
Passed test:     (2025-02-20 10:59:30.513 +0000) NSByteSwapping.m:38 ... 
NSSwapLittleFloatToHost works
Passed test:     (2025-02-20 10:59:30.556 +0000) NSByteSwapping.m:44 ... 
NSSwapBigDoubleToHost works
Passed test:     (2025-02-20 10:59:30.610 +0000) NSByteSwapping.m:50 ... 
NSSwapLittleDoubleToHost wworks
==1739610== Invalid read of size 8
==1739610==    at 0x4C05F1E: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1359)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  Address 0x8819a30 is 64 bytes inside a block of size 96 free'd
==1739610==    at 0x483C70E: free (in 
/usr/libexec/valgrind/vgpreload_memcheck-s390x-linux.so)
==1739610==    by 0x4C0609F: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1368)
==1739610==    by 0x4A85957: _i_NSAutoreleasePool__emptyPool 
(NSAutoreleasePool.m:550)
==1739610==    by 0x4A85C31: _i_NSAutoreleasePool__dealloc 
(NSAutoreleasePool.m:596)
==1739610==    by 0x4B40AAF: _i_NSNotificationCenter__removeObserver_ 
(NSNotificationCenter.m:1117)
==1739610==    by 0x4C05F17: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1358)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  Block was alloc'd at
==1739610==    at 0x4839426: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-s390x-linux.so)
==1739610==    by 0x4C2144D: default_malloc (NSZone.m:164)
==1739610==    by 0x4B54797: NSAllocateObject (NSObject.m:813)
==1739610==    by 0x4C08A5D: _c_NSUserDefaults__standardUserDefaults 
(NSUserDefaults.m:1008)
==1739610==    by 0x4BDA14B: _c_NSTimeZone__systemTimeZone (NSTimeZone.m:1432)
==1739610==    by 0x4BD6597: _c_NSTimeZone__defaultTimeZone (NSTimeZone.m:1316)
==1739610==    by 0x4BD587D: _i_NSLocalTimeZone__secondsFromGMTForDate_ 
(NSTimeZone.m:619)
==1739610==    by 0x4A9B85B: offset (NSCalendarDate.m:116)
==1739610==    by 0x4A9B85B: 
_i_NSCalendarDate__descriptionWithCalendarFormat_locale_ (NSCalendarDate.m:2450)
==1739610==    by 0x109595: pass (Testing.h:164)
==1739610==    by 0x1097D5: main (NSByteSwapping.m:14)
==1739610== 
==1739610== Invalid read of size 8
==1739610==    at 0x4F24DA4: objc_msg_lookup (in 
/usr/lib/s390x-linux-gnu/libobjc.so.4.0.0)
==1739610==    by 0x4C05F2D: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1359)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  Address 0x8868fd8 is 8 bytes inside a block of size 24 free'd
==1739610==    at 0x483C70E: free (in 
/usr/libexec/valgrind/vgpreload_memcheck-s390x-linux.so)
==1739610==    by 0x4C05F3D: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1359)
==1739610==    by 0x4A85957: _i_NSAutoreleasePool__emptyPool 
(NSAutoreleasePool.m:550)
==1739610==    by 0x4A85C31: _i_NSAutoreleasePool__dealloc 
(NSAutoreleasePool.m:596)
==1739610==    by 0x4B40AAF: _i_NSNotificationCenter__removeObserver_ 
(NSNotificationCenter.m:1117)
==1739610==    by 0x4C05F17: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1358)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  Block was alloc'd at
==1739610==    at 0x4839426: malloc (in 
/usr/libexec/valgrind/vgpreload_memcheck-s390x-linux.so)
==1739610==    by 0x4C2144D: default_malloc (NSZone.m:164)
==1739610==    by 0x4B54797: NSAllocateObject (NSObject.m:813)
==1739610==    by 0x4B51ADB: _c_NSObject__new (NSObject.m:1269)
==1739610==    by 0x4C09EE3: _i_NSUserDefaults__synchronize 
(NSUserDefaults.m:1997)
==1739610==    by 0x4C08D19: _c_NSUserDefaults__standardUserDefaults 
(NSUserDefaults.m:1073)
==1739610==    by 0x4BDA14B: _c_NSTimeZone__systemTimeZone (NSTimeZone.m:1432)
==1739610==    by 0x4BD6597: _c_NSTimeZone__defaultTimeZone (NSTimeZone.m:1316)
==1739610==    by 0x4BD587D: _i_NSLocalTimeZone__secondsFromGMTForDate_ 
(NSTimeZone.m:619)
==1739610==    by 0x4A9B85B: offset (NSCalendarDate.m:116)
==1739610==    by 0x4A9B85B: 
_i_NSCalendarDate__descriptionWithCalendarFormat_locale_ (NSCalendarDate.m:2450)
==1739610==    by 0x109595: pass (Testing.h:164)
==1739610==    by 0x1097D5: main (NSByteSwapping.m:14)
==1739610== 
==1739610== Invalid read of size 8
==1739610==    at 0x4F24DAE: objc_msg_lookup (in 
/usr/lib/s390x-linux-gnu/libobjc.so.4.0.0)
==1739610==    by 0x4C05F2D: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1359)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  Address 0xdeadfb0e is not stack'd, malloc'd or (recently) free'd
==1739610== 
==1739610== 
==1739610== Process terminating with default action of signal 11 (SIGSEGV)
==1739610==  Access not within mapped region at address 0xDEADF000
==1739610==    at 0x4F24DAE: objc_msg_lookup (in 
/usr/lib/s390x-linux-gnu/libobjc.so.4.0.0)
==1739610==    by 0x4C05F2D: _i_NSUserDefaults__dealloc (NSUserDefaults.m:1359)
==1739610==    by 0x4C012F5: _c_NSUserDefaults__atExit (NSUserDefaults.m:664)
==1739610==    by 0x4C7D4EB: handleExit (NSObject+GNUstepBase.m:212)
==1739610==    by 0x4F930E1: __cxa_finalize (cxa_finalize.c:97)
==1739610==    by 0x4A0E7C5: ??? (in 
/root/libs-base/Source/obj/libgnustep-base.so.1.31.0)
==1739610==  If you believe this happened as a result of a stack
==1739610==  overflow in your program's main thread (unlikely but
==1739610==  possible), you can try to increase the size of the
==1739610==  main thread stack using the --main-stacksize= flag.
==1739610==  The main thread stack size used in this run was 8388608.
==1739610== 
==1739610== HEAP SUMMARY:
==1739610==     in use at exit: 1,277,171 bytes in 13,114 blocks
==1739610==   total heap usage: 23,487 allocs, 10,373 frees, 3,984,911 bytes 
allocated
==1739610== 
==1739610== LEAK SUMMARY:
==1739610==    definitely lost: 3,069 bytes in 184 blocks
==1739610==    indirectly lost: 6,608 bytes in 413 blocks
==1739610==      possibly lost: 199,514 bytes in 426 blocks
==1739610==    still reachable: 1,067,980 bytes in 12,091 blocks
==1739610==         suppressed: 0 bytes in 0 blocks
==1739610== Rerun with --leak-check=full to see details of leaked memory
==1739610== 
==1739610== For lists of detected and suppressed errors, rerun with: -s
==1739610== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
# 

As I didn't find this very useful I ran a bisect session which
identified the first bad commit as bdf4403.

It looks like weak references do not work at all on this platform;
from the build log above:

| Failed test:     (2025-02-19 10:58:37.951 +0000)   runtime.m:325 ... object 
is stored as weak reference
| Failed test:     (2025-02-19 10:58:37.951 +0000)   runtime.m:328 ... 
objc_loadWeakRetained() returns original retained
| *** -[NSObject release]: message sent to deallocated instance 
0x2aa0467d8b8/usr/bin/gnustep-tests: line 492:  5322 Aborted                 
timeout $GSTESTTIMEOUT $RUN_CMD

We need an urgent solution for this problem as it's blocking the
GNUstep library transition and we don't have much time until the
deadline.  Perhaps the weakref implementation needs a specific tweak
for s390x or as a last resort it could be made a no-op.

If you have no clue, I can ask for help on [email protected] which
Debian's s390x porters should read.


Reply via email to