diff options
| author | Petr Pavlu <[email protected]> | 2024-07-17 13:00:23 +0000 |
|---|---|---|
| committer | Kees Cook <[email protected]> | 2024-08-05 21:34:23 +0000 |
| commit | f91f7ac900e7342e0fd66093dfbf7cb8cb585a99 (patch) | |
| tree | 126191748ddf797d75e0ad3582f64b991295f29a /scripts/gcc-plugins/randomize_layout_plugin.c | |
| parent | Linux 6.11-rc2 (diff) | |
| download | kernel-f91f7ac900e7342e0fd66093dfbf7cb8cb585a99.tar.gz kernel-f91f7ac900e7342e0fd66093dfbf7cb8cb585a99.zip | |
refcount: Report UAF for refcount_sub_and_test(0) when counter==0
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.
Modify the underlying function __refcount_sub_and_test() to warn about this
case as a use-after-free and have it return false to avoid the potential
double-free.
Signed-off-by: Petr Pavlu <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'scripts/gcc-plugins/randomize_layout_plugin.c')
0 files changed, 0 insertions, 0 deletions
