gcc-14 Wflex-array-member-not-at-end may-be-ub in struct pthread
Siddhesh Poyarekar
siddhesh@gotplt.org
Wed Jul 19 19:04:34 GMT 2023
On 2023-07-19 14:36, Andreas K. Huettel via Libc-alpha wrote:
> Am Mittwoch, 19. Juli 2023, 16:17:50 CEST schrieb Adhemerval Zanella Netto:
>>>>
>>>> this happens because:
>>>>
>>>> #ifdef __has_include
>>>> # if __has_include ("linux/rseq.h")
>>>> # define __GLIBC_HAVE_KERNEL_RSEQ --> that is defined
>>>> # endif
>>>>
>>>>
>>>>> Perhaps you tried to nest 'struct pthread' inside another struct? If so,
>>>>> the C standard doesn't allow that but the attached untested patch should
>>>>> be a trivial fix.
>>>>>
>>>>
>>>> Your patch does indeed silence this particular warning, thanks.
>>>>
>>>
>>> I suggest you add this patch to the release queue. because as far as I can
>>> tell, It is UB when the kernel headers are present on the system.
>>
>> The flexible array on rseq was added on linux 6.3, should we treat this as
>> release blocker?
>>
>
> Yes IMHO (unless someone convinces me otherwise).
>
Paul's patch fixes this by dropping the end_padding flex array and
fixing up PTHREAD_STRUCT_END_PADDING. That fix looks correct to me and
is only really relevant for ia64. Paul, could you please push your fix?
Thanks,
Sid
More information about the Libc-alpha
mailing list