The ubsan triggers on elf/tst-tls-allocation-failure-static-patched:
UBSAN: Undefined behaviour in ../sysdeps/unix/sysv/linux/dl-early_allocate.c:58:16 pointer index expression with base 0x0000555578792000 overflowed to 0x8000555578792cc0
The function is called with a size larger than PTRDIFF_MAX, and
the addition than overflow. Fix it by limiting the size up to
PTRDIFF_MAX, like all other malloc functions.
{
void *result;
+ if (__glibc_unlikely (size > PTRDIFF_MAX))
+ return NULL;
+
if (__curbrk != NULL)
/* If the break has been initialized, brk must have run before,
so just call it once more. */