linux/mm/kasan
Andrey Konovalov 7bc0584e5d kasan: implement stack ring for tag-based modes
Implement storing stack depot handles for alloc/free stack traces for slab
objects for the tag-based KASAN modes in a ring buffer.

This ring buffer is referred to as the stack ring.

On each alloc/free of a slab object, the tagged address of the object and
the current stack trace are recorded in the stack ring.

On each bug report, if the accessed address belongs to a slab object, the
stack ring is scanned for matching entries.  The newest entries are used
to print the alloc/free stack traces in the report: one entry for alloc
and one for free.

The number of entries in the stack ring is fixed in this patch, but one of
the following patches adds a command-line argument to control it.

[andreyknvl@google.com: initialize read-write lock in stack ring]
  Link: https://lkml.kernel.org/r/576182d194e27531e8090bad809e4136953895f4.1663700262.git.andreyknvl@google.com
Link: https://lkml.kernel.org/r/692de14b6b6a1bc817fd55e4ad92fc1f83c1ab59.1662411799.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Peter Collingbourne <pcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-10-03 14:03:01 -07:00
..
common.c kasan: use kasan_addr_to_slab in print_address_description 2022-10-03 14:03:00 -07:00
generic.c kasan: move kasan_get_alloc/free_track definitions 2022-10-03 14:02:59 -07:00
hw_tags.c kasan: fix zeroing vmalloc memory with HW_TAGS 2022-07-03 18:08:39 -07:00
init.c kasan: use MAX_PTRS_PER_* for early shadow tables 2021-06-29 10:53:53 -07:00
kasan.h kasan: implement stack ring for tag-based modes 2022-10-03 14:03:01 -07:00
Makefile mm/kasan: remove unnecessary CONFIG_KASAN option 2022-03-24 19:06:48 -07:00
quarantine.c kasan: give better names to shadow values 2022-05-13 07:20:19 -07:00
report_generic.c kasan: introduce kasan_complete_mode_report_info 2022-10-03 14:03:01 -07:00
report_hw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_sw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_tags.c kasan: implement stack ring for tag-based modes 2022-10-03 14:03:01 -07:00
report.c kasan: introduce kasan_complete_mode_report_info 2022-10-03 14:03:01 -07:00
shadow.c UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
sw_tags.c kasan: add kasan mode messages when kasan init 2021-11-11 09:34:35 -08:00
tags.c kasan: implement stack ring for tag-based modes 2022-10-03 14:03:01 -07:00