Re: [PATCH] refcount: Report UAF for refcount_sub_and_test(0) when counter==0
From: Kees Cook
Date: Wed Jul 17 2024 - 12:43:17 EST
On Wed, 17 Jul 2024 15:00:23 +0200, Petr Pavlu wrote:
> When a reference counter is at zero and refcount_sub_and_test() is invoked
> to subtract zero, the function accepts this request without any warning and
> returns true. This behavior does not seem ideal because the counter being
> already at zero indicates a use-after-free. Furthermore, returning true by
> refcount_sub_and_test() in this case potentially results in a double-free
> done by its caller.
>
> [...]
(Peter, let me know if you'd rather this went via a different tree...)
Applied to for-linus/hardening, thanks!
[1/1] refcount: Report UAF for refcount_sub_and_test(0) when counter==0
https://git.kernel.org/kees/c/cee1fb1bb8bd
Take care,
--
Kees Cook