UBSAN test failures
There's two batches of failures when building server-21.1-branch
at commit 15e24097 with -fsanitize=undefined
. The errors look the same on master at 0c1a93d3 though.
The first are function pointer mismatches vs prototypes (https://maskray.me/blog/2022-12-18-control-flow-integrity#fsanitizefunction, needs Clang 17):
==================================== 3/6 =====================================
test: xserver / sync
start time: 06:03:51
duration: 0.20s
result: exit status 1
command: MALLOC_PERTURB_=21 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 /home/sam/git/xserver/build/test/simple-xinit test/sync/sync -- hw/vfb/Xvfb
----------------------------------- stderr -----------------------------------
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
../dix/devices.c:1466:5: runtime error: call to function NoopDDA through pointer to incorrect function type 'void (*)(struct _DeviceIntRec *, PtrCtrl *)'
/home/sam/git/xserver/build/../dix/dixutils.c:360:1: note: NoopDDA defined here
#0 0x55d549f30405 in InitPtrFeedbackClassDeviceStruct /home/sam/git/xserver/build/../dix/devices.c:1466:5
#1 0x55d549f2ab04 in CorePointerProc /home/sam/git/xserver/build/../dix/devices.c:670:14
#2 0x55d549f2a494 in ActivateDevice /home/sam/git/xserver/build/../dix/devices.c:573:11
#3 0x55d549f2b6d8 in InitCoreDevices /home/sam/git/xserver/build/../dix/devices.c:718:14
#4 0x55d549f7b654 in dix_main /home/sam/git/xserver/build/../dix/main.c:245:9
#5 0x7f37c6e6024d (/usr/lib64/libc.so.6+0x2424d)
#6 0x7f37c6e60308 in __libc_start_main (/usr/lib64/libc.so.6+0x24308)
#7 0x55d549d8a6c4 in _start (/home/sam/git/xserver/build/hw/vfb/Xvfb+0x6da6c4)
==================================== 4/6 =====================================
test: xserver / request-length
start time: 06:03:51
duration: 0.22s
result: exit status 1
command: MALLOC_PERTURB_=221 ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 /home/sam/git/xserver/build/test/simple-xinit test/bigreq/request-length -- hw/vfb/Xvfb
----------------------------------- stderr -----------------------------------
../dix/devices.c:1466:5: runtime error: call to function NoopDDA through pointer to incorrect function type 'void (*)(struct _DeviceIntRec *, PtrCtrl *)'
/home/sam/git/xserver/build/../dix/dixutils.c:360:1: note: NoopDDA defined here
#0 0x56108d132405 in InitPtrFeedbackClassDeviceStruct /home/sam/git/xserver/build/../dix/devices.c:1466:5
#1 0x56108d12cb04 in CorePointerProc /home/sam/git/xserver/build/../dix/devices.c:670:14
#2 0x56108d12c494 in ActivateDevice /home/sam/git/xserver/build/../dix/devices.c:573:11
#3 0x56108d12d6d8 in InitCoreDevices /home/sam/git/xserver/build/../dix/devices.c:718:14
#4 0x56108d17d654 in dix_main /home/sam/git/xserver/build/../dix/main.c:245:9
#5 0x7f605b64a24d (/usr/lib64/libc.so.6+0x2424d)
#6 0x7f605b64a308 in __libc_start_main (/usr/lib64/libc.so.6+0x24308)
#7 0x56108cf8c6c4 in _start (/home/sam/git/xserver/build/hw/vfb/Xvfb+0x6da6c4)
==================================== 5/6 =====================================
test: xserver / damage-primitives
start time: 06:03:51
duration: 0.21s
result: exit status 1
command: ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 MALLOC_PERTURB_=248 /home/sam/git/xserver/build/test/simple-xinit test/damage/damage-primitives -- hw/vfb/Xvfb
----------------------------------- stderr -----------------------------------
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
../dix/devices.c:1466:5: runtime error: call to function NoopDDA through pointer to incorrect function type 'void (*)(struct _DeviceIntRec *, PtrCtrl *)'
/home/sam/git/xserver/build/../dix/dixutils.c:360:1: note: NoopDDA defined here
#0 0x55f792018405 in InitPtrFeedbackClassDeviceStruct /home/sam/git/xserver/build/../dix/devices.c:1466:5
#1 0x55f792012b04 in CorePointerProc /home/sam/git/xserver/build/../dix/devices.c:670:14
#2 0x55f792012494 in ActivateDevice /home/sam/git/xserver/build/../dix/devices.c:573:11
#3 0x55f7920136d8 in InitCoreDevices /home/sam/git/xserver/build/../dix/devices.c:718:14
#4 0x55f792063654 in dix_main /home/sam/git/xserver/build/../dix/main.c:245:9
#5 0x7f81c605524d (/usr/lib64/libc.so.6+0x2424d)
#6 0x7f81c6055308 in __libc_start_main (/usr/lib64/libc.so.6+0x24308)
#7 0x55f791e726c4 in _start (/home/sam/git/xserver/build/hw/vfb/Xvfb+0x6da6c4)
The second is more straightforward and seems to be also the cause of a test failure (in the same test) when compiling with -O3
:
==================================== 6/6 =====================================
test: xserver / unit
start time: 06:03:51
duration: 0.24s
result: exit status 1
command: ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 MALLOC_PERTURB_=150 /home/sam/git/xserver/build/test/tests
[...]
(EE) -1073741824
../test/signal-logging.c:318:15: runtime error: left shift of 1073741824 by 1 places cannot be represented in type 'int'
#0 0x558f4c209c90 in logging_format /home/sam/git/xserver/build/../test/signal-logging.c:318:15
#1 0x558f4c208e57 in signal_logging_test /home/sam/git/xserver/build/../test/signal-logging.c:406:5
#2 0x558f4c20c94b in run_test_in_child /home/sam/git/xserver/build/../test/tests-common.c:31:14
#3 0x558f4c20ca1a in main /home/sam/git/xserver/build/../test/tests.c:15:5
#4 0x7f9b4e56c24d (/usr/lib64/libc.so.6+0x2424d)
#5 0x7f9b4e56c308 in __libc_start_main (/usr/lib64/libc.so.6+0x24308)
#6 0x558f4c1bc6c4 in _start (/home/sam/git/xserver/build/test/tests+0x78a6c4)