Re: [PATCH 6/9] fortify: Split reporting and avoid passing string pointer

From: Kees Cook
Date: Fri Apr 07 2023 - 15:49:57 EST


On April 7, 2023 1:34:41 AM PDT, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
>On Fri, Apr 7, 2023 at 1:57 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>> On Thu, Apr 06, 2023 at 01:20:52PM +0300, Andy Shevchenko wrote:
>> > On Thu, Apr 6, 2023 at 3:02 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
>...
>
>> > > + WARN(1, "%s: detected buffer %s overflow\n", name, write ? "write" : "read");
>> >
>> > Using str_read_write() ?
>> >
>> > Dunno if it's already there or needs to be added. I have some patches
>> > to move those str_*() to string_choices.h. We can also prepend yours
>> > with those.
>>
>> Oh! Hah. I totally forgot about str_read_write. :) I will use that.
>
>Btw, makes sense to add
>
> #define str_write_read(v) str_read_write(!(v))
>
>to the header, so we won't use negation in the parameter for better readability.

I ended up not going this far because the use of str_read_write() gets removed again in the last patch in the series.



--
Kees Cook