public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: "Cristian Rodríguez" <cristian@rodriguez.im>,
	"Paul Eggert" <eggert@cs.ucla.edu>,
	"Carlos O'Donell" <carlos@redhat.com>,
	"Andreas K. Huettel" <dilfridge@gentoo.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: gcc-14 Wflex-array-member-not-at-end may-be-ub in struct pthread
Date: Wed, 19 Jul 2023 11:22:45 -0300	[thread overview]
Message-ID: <dcc5dd7e-4a19-3e7a-c7c0-47c89a6489ca@linaro.org> (raw)
In-Reply-To: <8cbaa90f-fa6e-fd5e-3ae0-5b0bcdc8fddd@linaro.org>



On 19/07/23 11:17, Adhemerval Zanella Netto wrote:
> 
> 
> On 08/07/23 16:21, Cristian Rodríguez via Libc-alpha wrote:
>> On Wed, Jul 5, 2023 at 2:13 PM Cristian Rodríguez <cristian@rodriguez.im>
>> wrote:
>>
>>>
>>>
>>> On Wed, Jul 5, 2023 at 11:53 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
>>>
>>>> On 2023-07-05 06:46, Cristian Rodríguez via Libc-alpha wrote:
>>>>>    char end_padding[]; --> This is incorrect, since struct rseq
>>>> contains a
>>>>> flexible array it must be the last member..
>>>>
>>>> ? struct rseq doesn't contain a flexible array on the master branch, so
>>>> there's no error here.
>>>>
>>>
>>> I may be missing something but I have struct rseq containing a final
>>> flexible array..
>>>
>>> /*
>>>          * Flexible array member at end of structure, after last feature
>>> field.
>>>          */
>>>         char end[];
>>> }
>>>
>>> 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?

Also, glibc currently does not handle AT_RSEQ_FEATURE_SIZE/AT_RSEQ_ALIGN. Is
this a potential issue for newer kernels?

  reply	other threads:[~2023-07-19 14:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 13:46 Cristian Rodríguez
2023-07-05 15:53 ` Paul Eggert
2023-07-05 18:13   ` Cristian Rodríguez
2023-07-08 19:21     ` Cristian Rodríguez
2023-07-19 14:17       ` Adhemerval Zanella Netto
2023-07-19 14:22         ` Adhemerval Zanella Netto [this message]
2023-07-19 14:55           ` Mathieu Desnoyers
2023-07-19 15:28             ` Adhemerval Zanella Netto
2023-07-19 18:36         ` Andreas K. Huettel
2023-07-19 19:04           ` Siddhesh Poyarekar
2023-07-19 21:16             ` Paul Eggert
2023-07-19 21:49               ` Andreas K. Huettel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcc5dd7e-4a19-3e7a-c7c0-47c89a6489ca@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=cristian@rodriguez.im \
    --cc=dilfridge@gentoo.org \
    --cc=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.org \
    --cc=mathieu.desnoyers@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).