[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <25ff3f7a-b1fe-15ab-ce41-1f1a62eeb624@intel.com>
Date: Mon, 28 Aug 2023 16:41:15 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: David Laight <David.Laight@...LAB.COM>, 'Kees Cook'
<keescook@...omium.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, Jacob Keller
<jacob.e.keller@...el.com>, "intel-wired-lan@...ts.osuosl.org"
<intel-wired-lan@...ts.osuosl.org>, Alexander Lobakin
<aleksander.lobakin@...el.com>, "linux-hardening@...r.kernel.org"
<linux-hardening@...r.kernel.org>, Steven Zou <steven.zou@...el.com>
Subject: Re: [PATCH net-next v3 1/7] overflow: add DEFINE_FLEX() for on-stack
allocs
On 8/23/23 22:52, Przemek Kitszel wrote:
> On 8/18/23 12:49, David Laight wrote:
>> From: Przemek Kitszel
>>> Sent: Friday, August 18, 2023 11:28 AM
>> ...
>>>>>> I'm not sure you should be forcing the memset() either.
>>>>>
>>>>> This already got discussed: better to fail safe.
>>>>
>>>> Perhaps call it DEFINE_FLEX_Z() to make this clear and
>>>> give the option for a non-zeroing version later.
>>>> Not everyone wants the expense of zeroing everything.
>>>
>>> per Kees, zeroing should be removed by compiler when not needed:
>>> https://lore.kernel.org/intel-wired-lan/202308101128.C4F0FA235@keescook/
>>
>> Expect in the most trivial cases the compiler is pretty much never
>> going to remove the zeroing of the data[] part.
>>
>> I'm also not at all sure what happens if there is a function
>> call between the initialisation and any assignments.
>>
>> With a bit of effort you should be able to pass the '= {}'
>> through into an inner #define.
>> Possibly with the alternative of a caller-provider
>> '= { .obj = call_supplied_initialiser }'
>> The 'not _Z' form would pass an empty argument.
>>
>> David
>
> Thanks, makes sense, there could be also DEFINE_FLEX_COUNTED
> (or DEFINE_FLEX_BOUNDED) to cover Kees's __counted_by() cases.
>
> Would you like me to cover/convert any existing code/use cases (as with
> other patches in the series, to have some examples/actual usage of newly
> introduced macros)?
I did some manual searches and found no obvious candidate :/
will post next version/RFC without _NOINIT() variant.
>
>>
>> -
>> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes,
>> MK1 1PT, UK
>> Registration No: 1397386 (Wales)
>
>
Powered by blists - more mailing lists