Re: [PATCH] string: Check for "nonstring" attribute on strscpy() arguments

2024-08-22 Thread Kees Cook
On Mon, 05 Aug 2024 14:43:44 -0700, Kees Cook wrote: > GCC already checks for arguments that are marked with the "nonstring"[1] > attribute when used on standard C String API functions (e.g. strcpy). Gain > this compile-time checking also for the kernel's primary string copying > function, strscpy(

Re: [PATCH] string: Check for "nonstring" attribute on strscpy() arguments

2024-08-22 Thread Kees Cook
On Tue, Aug 06, 2024 at 12:29:30PM +0200, Przemek Kitszel wrote: > On 8/5/24 23:43, Kees Cook wrote: > > GCC already checks for arguments that are marked with the "nonstring"[1] > > attribute when used on standard C String API functions (e.g. strcpy). Gain > > this compile-time checking also for th

Re: [PATCH] string: Check for "nonstring" attribute on strscpy() arguments

2024-08-06 Thread Miguel Ojeda
On Mon, Aug 5, 2024 at 11:43 PM Kees Cook wrote: > > +/* Determine if an attribute has been applied to a variable. */ > +#if __has_builtin(__builtin_has_attribute) > +#define __annotated(var, attr) __builtin_has_attribute(var, attr) > +#else > +#define __annotated(var, attr) (false) > +#endif `__

Re: [PATCH] string: Check for "nonstring" attribute on strscpy() arguments

2024-08-06 Thread Przemek Kitszel
On 8/5/24 23:43, Kees Cook wrote: GCC already checks for arguments that are marked with the "nonstring"[1] attribute when used on standard C String API functions (e.g. strcpy). Gain this compile-time checking also for the kernel's primary string copying function, strscpy(). Note that Clang has n

[PATCH] string: Check for "nonstring" attribute on strscpy() arguments

2024-08-05 Thread Kees Cook
GCC already checks for arguments that are marked with the "nonstring"[1] attribute when used on standard C String API functions (e.g. strcpy). Gain this compile-time checking also for the kernel's primary string copying function, strscpy(). Note that Clang has neither "nonstring" nor __builtin_has