KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
81 stars 5 forks source link

Add __access() annotations to function prototypes #208

Open kees opened 1 year ago

kees commented 1 year ago

GCC has an attribute to help give information to __builtin_dynamic_object_size() in the form of the access() function attribute that describes a pointer and length: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

This could turn this:

int do_something(struct context *ctx, u32 *data, int count)

into this:

int __access(read_write, 2, 3) do_something(struct context *ctx, u32 *data, int count)

https://lore.kernel.org/lkml/202209212034.16D9025882@keescook