[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Oct 2023 16:18:56 -0700
From: Kees Cook <keescook@...omium.org>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: linux-hardening@...r.kernel.org
Subject: 2-member sized buffer structs struct_size()
On Tue, Oct 10, 2023 at 03:53:28PM -0700, Kees Cook wrote:
> It's surprising how many of these 2-member structs we have in the kernel
> that do the same basic thing. :)
75. We have 75 of them:
// Options: --all-includes
@sized_byte_buffer@
identifier NAME, SIZE, ARRAY;
typedef s8, s16, s32, s64;
typedef __s8, __s16, __s32, __s64;
typedef u8, u16, u32, u64;
typedef __u8, __u16, __u32, __u64;
type SIZE_TYPE = {char, short, int, long, long long, ssize_t,
s8, s16, s32, s64, __s8, __s16, __s32, __s64,
unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, size_t,
u8, u16, u32, u64, __u8, __u16, __u32, __u64};
type BYTE_TYPE = {char, unsigned char, u8, __u8};
@@
*struct NAME {
SIZE_TYPE SIZE;
BYTE_TYPE ARRAY[];
};
https://paste.ubuntu.com/p/39CyK9nyqX/
Agh
--
Kees Cook
Powered by blists - more mailing lists