| Age | Commit message (Collapse) | Author | Files | Lines |
|
UBSAN: Undefined behaviour in ../sysdeps/posix/sprofil.c:272:16 variable length array bound evaluates to non-positive value 0
Move the VLA to after the porfile stop condition (where size might
be zero).
|
|
UBSAN: Undefined behaviour in tst-sprofil.c:140:6 unsigned integer overflow: 2432902008176640000 + 7812407968270641256 cannot be represened in type 'long int'
Use unsigned types for the fibonacci.
|
|
Building with ubsan on 32 bit architecture, tst-ffs shows:
ffsll(0x4000000000000000) as expected 63
UBSAN: Undefined behaviour in ffsll.c:37:34 negation of 9223372036854775808 cannot be represented in type 'long long int'
Since the idea is to isolate the least significant bit, use unsigned
types.
|
|
UBSAN: Undefined behaviour in test-strrchr.c:100:35 unsigned integer overflow: 1804289383 * 846930886 cannot be represened in type 'long int'
Use int64_t operations instead.
|
|
Building with ubsan on 32 bit architecture without 64 bit time_t
as default, it shows:
UBSAN: Undefined behaviour in ../sysdeps/unix/sysv/linux/msgctl.c:180:45 left shift of 3935167480 by 32 cannot be represented in type 'long long int'
Add a new macro, IPC_HILO, to handle this transparently by using
unsigned shifts.
|
|
The test explicit uses UB (sprintf (NULL, ...) to triggers a SIGSEGV
from libc and check with the pthread cleanup are correctly called.
With ubsan enable, it triggers:
UBSAN: Undefined behaviour in Xprintf_buffer_write.c:39:7 null pointer passed as argument 1, nonnull attribute declared at unknown:0:0
Which is a memcpy call with NULL argument.
|
|
|
|
On powercp64le with --enable-ubsan the build fails with:
In file included from ../include/bits/stdio2.h:1,
from ../libio/stdio.h:967,
from ../include/stdio.h:14,
from ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:21,
from ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ieee128.c:1:
In function ‘vfprintf’,
inlined from ‘do_test_call_varg’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:56:3:
../libio/bits/stdio2.h:166:10: error: null format string [-Werror=format-overflow=]
166 | return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘vsnprintf’,
inlined from ‘do_test_call_varg’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:68:3:
../libio/bits/stdio2.h:100:10: error: null format string [-Werror=format-truncation=]
100 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101 | __glibc_objsize (__s), __fmt, __ap);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘fprintf’,
inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:104:3:
../libio/bits/stdio2.h:111:10: error: null format string [-Werror=format-overflow=]
111 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
In function ‘printf’,
inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:108:3:
../libio/bits/stdio2.h:118:10: error: null format string [-Werror=format-overflow=]
118 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘snprintf’,
inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:112:3:
../libio/bits/stdio2.h:68:10: error: null format string [-Werror=format-truncation=]
68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
|
|
On powercp64le with --enable-ubsan the build fails with:
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c: In function ‘do_test_call_varg’:
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:60:3: error: null format string [-Werror=format-overflow=]
60 | __vfprintf_chk (stream, 1, format, args);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:66:3: error: null format string [-Werror=format-overflow=]
66 | __vprintf_chk (1, format, args);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:72:3: error: null format string [-Werror=format-truncation=]
72 | __vsnprintf_chk (string, 79, 1, 127, format, args);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c: In function ‘do_test_call_rarg.constprop’:
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:111:3: error: null format string [-Werror=format-overflow=]
111 | __fprintf_chk (stdout, 1, format, ld, d);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:115:3: error: null format string [-Werror=format-overflow=]
115 | __printf_chk (1, format, ld, d);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c:119:3: error: null format string [-Werror=format-truncation=]
119 | __snprintf_chk (string, 79, 1, 127, format, ld, d);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
On i686 debug/tst-sprintf-fortify-unchecked triggers:
UBSAN: Undefined behaviour in vfprintf-process-arg.c:41:57 negation of 9223372036854775808 cannot be represented in type 'long long int'
|
|
UBSAN: Undefined behaviour in tst-nss-hash.c:49:8 variable length array bound evaluates to non-positive value 0
|
|
The gethostname is defined as not accepting NULL arguments, so
use a minimal size for initial call.
|
|
UBSAN: Undefined behaviour in tst-makecontext3.c:164:40 left shift of 1794341827 by 1 cannot be represented in type 'int'
|
|
UBSAN: Undefined behaviour in ../sysdeps/unix/sysv/linux/tst-sched_setattr.c:86:5 null pointer passed as argument 2, nonnull attribute declared at unknown:0:0
|
|
UBSAN: Undefined behaviour in test-ffs.c:48:3 left shift of 1 by 31 cannot be represented in type 'int'
|
|
UBSAN: Undefined behaviour in tst-limits.c:14:16 left shift of 1 by 63 cannot be represented in type 'long long int'
|
|
The test explicits checks for passing a null argument to a
function with argument nonnull attribute.
|
|
|
|
With ubsan, test-float128-cabs triggers:
UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/s_isnanl.c:29:30 negation of 9223372036854775808 cannot be represented in type 'long int'
Rewrite with simplified version.
|
|
UBSAN: Undefined behaviour in ../sysdeps/ieee754/float128/../ldbl-128/e_atan2l.c:68:9 unsigned integer overflow: 9223372036854775808 - 4611404543450677248 cannot be represened in type 'long int'
|
|
UBSAN: Undefined behaviour in ../sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c:97:7 left shift of 1 by 31 cannot be represented in type 'int'
|
|
ubsan triggers:
UBSAN: Undefined behaviour in xdr.c:262:28 left shift of 18446744073709551615 by 32 cannot be represented in type 'long int'
Fix by using unsigned type cast for left shift.
|
|
Building with ubsan it triggers:
UBSAN: Undefined behaviour in ../string/strncmp.c:103:12 shift exponent 32 is too large for 32-bit type 'int'
Use an unsigned constant literal for MERGE, since op_t is defined
as unsigned.
|
|
Building with ubsan the test-strcnmp triggers:
UBSAN: Undefined behaviour in ../sysdeps/generic/string-fzi.h:39:12 passing zero to __builtin_ctz()
Use stdbit.h functions instead of ctl/clz.
|
|
Building with ubsan it trigger:
UBSAN: Undefined behaviour in ../string/strcmp.c:92:12 shift exponent 32 is too large for 32-bit type 'int'
Use an unsigned constant literal for MERGE, since op_t is defined
as unsigned.
|
|
Building with ubsan it trigger:
UBSAN: Undefined behaviour in ../string/stpcpy.c:91:12 shift exponent 56 is too large for 32-bit type 'int'
Use an unsigned constant literal for MERGE, since op_t is defined
as unsigned.
|
|
With glibc built with ubsan it triggers:
UBSAN: Undefined behaviour in strtod_l.c:1580:8 shift exponent 41 is too large for 32-bit type 'int'
Use the correct constant literal definition based on mp_limb_t size.
|
|
With glibc built with ubsan it triggers:
UBSAN: Undefined behaviour in jrand48_r.c:29:34 left shift of 41612 by 16 cannot be represented in type 'int'
UBSAN: Undefined behaviour in erand48_r.c:39:45 left shift of 3972 by 20 cannot be represented in type 'int'
Fix by casting to uint32_t for the shift operation.
|
|
The ubsan triggers an array item access error with stdlib/tst-bz20544.
|
|
Building with ubsan triggers:
UBSAN: Undefined behaviour in printf_fp.c:633:4 passing zero to __builtin_ctz()
So replace longlong.h with stdbit.h function.
|
|
|
|
Both level 2 and level 3 sizes can be zero, which triggers a 0-size
VLA. Reorganize the code to allocate the VLA iff sizes are positive.
|
|
To avoid a 0 size VLA.
|
|
Building with ubsan, the test triggers:
UBSAN: Undefined behaviour in programs/locfile.c:598:3 null pointer passed as argument 2, nonnull attribute declared at unknown:0:0
The obstack_grow is only define for size > 0.
|
|
The cost addition might overflow since the default value is
LONG_INT. Use wrap addition instead.
|
|
On 32-bit architecture ubsan triggers:
UBSAN: Undefined behaviour in dl-load.c:1345:54 pointer index expression with base 0x00612508 overflowed to 0xf7c3a508
Use explicit uintptr_t operation instead.
|
|
The left shift overflows for 'int', use uint32_t instead. It syncs
with CORE-MATH commit bbfabd99.
|
|
The left shift overflows for 'int', use uint64_t instead. It syncs
with CORE-MATH commit d0a2be200cbc1344d800d9ef0ebee9ad67dd3ad8.
|
|
The left shift overflows for 'int', use uint32_t instead. It syncs
with CORE-MATH commit bbfabd993a71b049c210b0febfd06d18369fadc1.
|
|
The left shift overflows for 'int64_t', use unsigned instead. It syncs
with CORE-MATH commit f7c7408d1749ec2859ea249495af699359ae559b.
|
|
The left shift overflows for 'int', use uint64_t instead. It syncs
with CORE-MATH commit bbfabd99.
|
|
The left shift overflows for 'int', use a literal instead. It syncs
with OPTIMIZED-ROUTINES commit 0f87f607b976820ef41fe64d004fe67dc7af8236.
|
|
The left shift overflows for 'int', use uint64_t instead. It syncs
with CORE-MATH commit 4d6192d2.
|
|
The left shift overflows for 'int', use unsigned instead. It syncs
with CORE-MATH commit 4d6192d2.
|
|
The code can shift the 1U for value larger than 31 depending of
the exponent value. Add a check prior the shift.
|
|
The code can shift the 1ULL for value larger than 63 depending of
the exponent value. Add a check prior the shift.
|
|
The subnormal exponent calculation invokes UB by left shifting the
high or lower work. Use unsigned values and stdc_leading_zeros
instead.
|
|
By removing the wrapper and setting FE_INVALID and errno inline.
|
|
The subnormal exponent calculation invokes UB by left shifting the
signed expoenent to fix the first leading bit.
The patch reimplements ilogb using the math_config.h macros and
uses the new stdbit function to simplify the subnormal handling.
On aarch64 it generates better code:
* master:
0000000000000000 <__ieee754_ilogbf>:
0: 1e260000 fmov w0, s0
4: 12007801 and w1, w0, #0x7fffffff
8: 72091c1f tst w0, #0x7f800000
c: 54000141 b.ne 34 <__ieee754_ilogbf+0x34> // b.any
10: 34000201 cbz w1, 50 <__ieee754_ilogbf+0x50>
14: 53185c21 lsl w1, w1, #8
18: 12800fa0 mov w0, #0xffffff82 // #-126
1c: d503201f nop
20: 531f7821 lsl w1, w1, #1
24: 51000400 sub w0, w0, #0x1
28: 7100003f cmp w1, #0x0
2c: 54ffffac b.gt 20 <__ieee754_ilogbf+0x20>
30: d65f03c0 ret
34: 13177c20 asr w0, w1, #23
38: 12b01002 mov w2, #0x7f7fffff // #2139095039
3c: 5101fc00 sub w0, w0, #0x7f
40: 6b02003f cmp w1, w2
44: 12b00001 mov w1, #0x7fffffff // #2147483647
48: 1a819000 csel w0, w0, w1, ls // ls = plast
4c: d65f03c0 ret
50: 320107e0 mov w0, #0x80000001 // #-2147483647
54: d65f03c0 ret
* patch:
0000000000000000 <__ieee754_ilogbf>:
0: 1e260001 fmov w1, s0
4: d3577820 ubfx x0, x1, #23, #8
8: 350000e0 cbnz w0, 24 <__ieee754_ilogbf+0x24>
c: 53175821 lsl w1, w1, #9
10: 34000141 cbz w1, 38 <__ieee754_ilogbf+0x38>
14: 5ac01021 clz w1, w1
18: 12800fc0 mov w0, #0xffffff81 // #-127
1c: 4b010000 sub w0, w0, w1
20: d65f03c0 ret
24: 7103fc1f cmp w0, #0xff
28: 5101fc00 sub w0, w0, #0x7f
2c: 12b00001 mov w1, #0x7fffffff // #2147483647
30: 1a811000 csel w0, w0, w1, ne // ne = any
34: d65f03c0 ret
38: 320107e0 mov w0, #0x80000001 // #-2147483647
3c: d65f03c0 ret
|
|
By removing the wrapper and setting FE_INVALID and errno inline.
|