Re: [PATCH RFC kspp-next 0/3] compiler_types: add Endianness-dependent __counted_by_{le,be}

From: Alexander Lobakin
Date: Tue Mar 19 2024 - 05:33:46 EST


From: Kees Cook <keescook@xxxxxxxxxxxx>
Date: Mon, 18 Mar 2024 10:49:25 -0700

> On Mon, Mar 18, 2024 at 02:03:51PM +0100, Alexander Lobakin wrote:
>> include/linux/compiler_types.h | 11 ++++++++++
>> drivers/net/ethernet/intel/idpf/virtchnl2.h | 24 ++++++++++-----------
>> 2 files changed, 23 insertions(+), 12 deletions(-)
>
> Oh, I see the Subject says "kspp-next" -- normally I'd expect things
> touch net to go through netdev. I'm fine with this going through either
> tree. Perhaps better through netdev since that subsystem has the most
> users and may gain more using the new macros?

Yeah sure. I send it with "kspp-next", so that it would be clear it's a
security feature :>

Thanks for the ack. Re expressions -- Przemek suggested it would be nice
to have something like

__le32 counter;
struct a flex[] __counted_by(le32_to_cpu(counter));

but we don't know whether something like this is possible to implement
in the compiler.

>
> -Kees

Thanks,
Olek