[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VetkKYhnOaoM880D+VTR96NscQfBGddgAwKz681Uk5ZJg@mail.gmail.com>
Date: Thu, 2 May 2024 12:45:33 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Andy Shevchenko <andy@...nel.org>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] string: Add additional __realloc_size() annotations for
"dup" helpers
On Thu, May 2, 2024 at 2:32 AM Kees Cook <keescook@...omium.org> wrote:
>
> Several other "dup"-style interfaces could use the __realloc_size()
> attribute. (As a reminder to myself and others: "realloc" is used here
> instead of "alloc" because the "alloc_size" attribute implies that the
> memory contents are uninitialized. Since we're copying contents into the
> resulting allocation, it must use "realloc_size" to avoid confusing the
> compiler's optimization passes.)
>
> Add KUnit test coverage where possible. (KUnit still does not have the
> ability to manipulate userspace memory.)
Makes sense to me,
Reviewed-by: Andy Shevchenko <andy@...nel.org>
...
> + checker(len, kmemdup_array(test_phrases[idx], len, 1, \
> + gfp), kfree(p)); \
Despite being longer, I would put gfp on the previous line for the
sake of logical split (and additionally to be consistent with the
below).
> + checker(len, kmemdup(test_phrases[idx], len, gfp), \
> + kfree(p)); \
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists