lib/stacktrace, kasan, kmsan: rework extra_bits interface
authorAndrey Konovalov <andreyknvl@google.com>
Fri, 10 Feb 2023 21:16:03 +0000 (22:16 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 17 Feb 2023 04:43:51 +0000 (20:43 -0800)
commit36aa1e6779c3c6f8e0d4552544214f5cffe3c287
tree1639d4bb581f0baab0ebed256c8e2af3a0fa6c5e
parentd11a5621f3252120dfc7cef7600a90bd8e605caf
lib/stacktrace, kasan, kmsan: rework extra_bits interface

The current implementation of the extra_bits interface is confusing:
passing extra_bits to __stack_depot_save makes it seem that the extra
bits are somehow stored in stack depot. In reality, they are only
embedded into a stack depot handle and are not used within stack depot.

Drop the extra_bits argument from __stack_depot_save and instead provide
a new stack_depot_set_extra_bits function (similar to the exsiting
stack_depot_get_extra_bits) that saves extra bits into a stack depot
handle.

Update the callers of __stack_depot_save to use the new interace.

This change also fixes a minor issue in the old code: __stack_depot_save
does not return NULL if saving stack trace fails and extra_bits is used.

Link: https://lkml.kernel.org/r/317123b5c05e2f82854fc55d8b285e0869d3cb77.1676063693.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/stackdepot.h
lib/stackdepot.c
mm/kasan/common.c
mm/kmsan/core.c