On 6/7/23 7:55 pm, J. R. Okajima wrote:
>
> My current development base version is v5.10.
> I tried aufs5.10, and failed compiling tools/lib/subcmd/subcmd-util.h.
> There is a commit in v5.17-rc5,
>
> ----------------------------------------
> commit 52a9dab6d892763b2a8334a568bd4e2c1a6fde66
> Author: Kees Cook <keesc...@chromium.org>
> Date:   Sun Feb 13 10:24:43 2022 -0800
>
>     libsubcmd: Fix use-after-free for realloc(..., 0)
>
>     GCC 12 correctly reports a potential use-after-free condition in the
>     xrealloc helper. Fix the warning by avoiding an implicit "free(ptr)"
>     when size == 0:
>
>     In file included from help.c:12:
>     In function 'xrealloc',
>         inlined from 'add_cmdname' at help.c:24:2: subcmd-util.h:56:23: 
> error: p
> ointer may be used after 'realloc' [-Werror=use-after-free]
>        56 |                 ret = realloc(ptr, size);
>           |                       ^~~~~~~~~~~~~~~~~~
> :::
>
>
> J. R. Okajima

Thank you for pointing this out, Junjiro-san.
My kernel is 5.19 and was built with gcc 7.3.0, and it compiled okay
(with aufs) back then.
I'm going to update to one of the stable 6.x releases soon with gcc 12,
so this is something that I really have to watch out.

cheers!

Reply via email to