From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Kees Cook <kees@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
<cferris@google.com>, Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>, <netdev@vger.kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] UAPI: net/sched: Open-code __struct_group() in flex struct tc_u32_sel
Date: Tue, 17 Dec 2024 17:04:41 +0100 [thread overview]
Message-ID: <c49d316d-ce8f-43d4-8116-80c760e38a6b@intel.com> (raw)
In-Reply-To: <bbed49c7-56c0-4642-afec-e47b14425f76@embeddedor.com>
From: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date: Tue, 17 Dec 2024 09:58:28 -0600
>
>
> On 17/12/24 08:55, Alexander Lobakin wrote:
>> From: Kees Cook <kees@kernel.org>
>> Date: Mon, 16 Dec 2024 18:59:55 -0800
>>
>>> This switches to using a manually constructed form of struct tagging
>>> to avoid issues with C++ being unable to parse tagged structs within
>>> anonymous unions, even under 'extern "C"':
>>>
>>> ../linux/include/uapi/linux/pkt_cls.h:25124: error: ‘struct
>>> tc_u32_sel::<unnamed union>::tc_u32_sel_hdr,’ invalid; an anonymous
>>> union may only have public non-static data members [-fpermissive]
>>
>> I worked around that like this in the past: [0]
>> As I'm not sure it would be fine to fix every such occurrence manually
>> by open-coding.
>> What do you think?
>
> The thing is that, in this particular case, we need a struct tag to change
> the type of an object in another struct. See:
But the fix I mentioned still allows you to specify a tag in C code...
cxgb4 is for sure not C++.
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h b/
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
> index 9050568a034c..64663112cad8 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
> @@ -242,7 +242,7 @@ struct cxgb4_next_header {
> * field's value to jump to next header such as IHL field
> * in IPv4 header.
> */
> - struct tc_u32_sel sel;
> + struct tc_u32_sel_hdr sel;
> struct tc_u32_key key;
> /* location of jump to make */
> const struct cxgb4_match_field *jump;;
>
> You can also take a look at the original series:
>
> https://lore.kernel.org/linux-hardening/
> cover.1723586870.git.gustavoars@kernel.org/
>
> Thanks
> --
> Gustavo
Thanks,
Olek
next prev parent reply other threads:[~2024-12-17 16:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 2:59 [PATCH] UAPI: net/sched: Open-code __struct_group() in flex struct tc_u32_sel Kees Cook
2024-12-17 14:55 ` Alexander Lobakin
2024-12-17 15:58 ` Gustavo A. R. Silva
2024-12-17 16:04 ` Alexander Lobakin [this message]
2024-12-17 16:25 ` Gustavo A. R. Silva
2024-12-17 16:54 ` Alexander Lobakin
2024-12-17 18:30 ` Gustavo A. R. Silva
[not found] ` <CANtHk4nhH9XJi5+9BAu3kFoL14+4YAZTH7t6QApEvEAeMxdXgw@mail.gmail.com>
2024-12-17 19:19 ` Gustavo A. R. Silva
2024-12-17 20:25 ` Kees Cook
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=c49d316d-ce8f-43d4-8116-80c760e38a6b@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=cferris@google.com \
--cc=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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