diff options
| author | Andrey Konovalov <[email protected]> | 2018-12-28 08:30:50 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2018-12-28 20:11:44 +0000 |
| commit | 7f94ffbc4c6a1bdb51d39965e4f2acaa19bd798f (patch) | |
| tree | 5b6b2519c9979a3b557a812843d054c91886e441 /lib/debugobjects.c | |
| parent | mm: move obj_to_index to include/linux/slab_def.h (diff) | |
| download | kernel-7f94ffbc4c6a1bdb51d39965e4f2acaa19bd798f.tar.gz kernel-7f94ffbc4c6a1bdb51d39965e4f2acaa19bd798f.zip | |
kasan: add hooks implementation for tag-based mode
This commit adds tag-based KASAN specific hooks implementation and
adjusts common generic and tag-based KASAN ones.
1. When a new slab cache is created, tag-based KASAN rounds up the size of
the objects in this cache to KASAN_SHADOW_SCALE_SIZE (== 16).
2. On each kmalloc tag-based KASAN generates a random tag, sets the shadow
memory, that corresponds to this object to this tag, and embeds this
tag value into the top byte of the returned pointer.
3. On each kfree tag-based KASAN poisons the shadow memory with a random
tag to allow detection of use-after-free bugs.
The rest of the logic of the hook implementation is very much similar to
the one provided by generic KASAN. Tag-based KASAN saves allocation and
free stack metadata to the slab object the same way generic KASAN does.
Link: http://lkml.kernel.org/r/bda78069e3b8422039794050ddcb2d53d053ed41.1544099024.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <[email protected]>
Reviewed-by: Andrey Ryabinin <[email protected]>
Reviewed-by: Dmitry Vyukov <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/debugobjects.c')
0 files changed, 0 insertions, 0 deletions
