https://github.com/torvalds/linux
Revision 928501344fc645f80390afc12708c81b3595745d authored by Andrey Konovalov on 26 February 2021, 01:19:55 UTC, committed by Linus Torvalds on 26 February 2021, 17:41:02 UTC
Patch series "kasan: optimizations and fixes for HW_TAGS", v4.

This patchset makes the HW_TAGS mode more efficient, mostly by reworking
poisoning approaches and simplifying/inlining some internal helpers.

With this change, the overhead of HW_TAGS annotations excluding setting
and checking memory tags is ~3%.  The performance impact caused by tags
will be unknown until we have hardware that supports MTE.

As a side-effect, this patchset speeds up generic KASAN by ~15%.

This patch (of 13):

Currently KASAN saves allocation stacks in both kasan_slab_alloc() and
kasan_kmalloc() annotations.  This patch changes KASAN to save allocation
stacks for slab objects from kmalloc caches in kasan_kmalloc() only, and
stacks for other slab objects in kasan_slab_alloc() only.

This change requires ____kasan_kmalloc() knowing whether the object
belongs to a kmalloc cache.  This is implemented by adding a flag field to
the kasan_info structure.  That flag is only set for kmalloc caches via a
new kasan_cache_create_kmalloc() annotation.

Link: https://lkml.kernel.org/r/cover.1612546384.git.andreyknvl@google.com
Link: https://lkml.kernel.org/r/7c673ebca8d00f40a7ad6f04ab9a2bddeeae2097.1612546384.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Branislav Rankov <Branislav.Rankov@arm.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d3a61f7
History
Tip revision: 928501344fc645f80390afc12708c81b3595745d authored by Andrey Konovalov on 26 February 2021, 01:19:55 UTC
kasan, mm: don't save alloc stacks twice
Tip revision: 9285013
File Mode Size
internal
acompress.h -rw-r--r-- 8.8 KB
aead.h -rw-r--r-- 18.3 KB
aes.h -rw-r--r-- 2.5 KB
akcipher.h -rw-r--r-- 12.9 KB
algapi.h -rw-r--r-- 7.1 KB
arc4.h -rw-r--r-- 484 bytes
asym_tpm_subtype.h -rw-r--r-- 521 bytes
authenc.h -rw-r--r-- 635 bytes
b128ops.h -rw-r--r-- 2.4 KB
blake2b.h -rw-r--r-- 1.6 KB
blake2s.h -rw-r--r-- 2.7 KB
blowfish.h -rw-r--r-- 415 bytes
cast5.h -rw-r--r-- 590 bytes
cast6.h -rw-r--r-- 607 bytes
cast_common.h -rw-r--r-- 232 bytes
chacha.h -rw-r--r-- 3.1 KB
chacha20poly1305.h -rw-r--r-- 1.7 KB
cryptd.h -rw-r--r-- 2.0 KB
ctr.h -rw-r--r-- 1.4 KB
curve25519.h -rw-r--r-- 2.0 KB
des.h -rw-r--r-- 1.7 KB
dh.h -rw-r--r-- 2.5 KB
drbg.h -rw-r--r-- 8.9 KB
ecdh.h -rw-r--r-- 2.5 KB
engine.h -rw-r--r-- 4.1 KB
gcm.h -rw-r--r-- 867 bytes
gf128mul.h -rw-r--r-- 9.4 KB
ghash.h -rw-r--r-- 388 bytes
hash.h -rw-r--r-- 33.9 KB
hash_info.h -rw-r--r-- 998 bytes
hmac.h -rw-r--r-- 173 bytes
if_alg.h -rw-r--r-- 6.6 KB
kpp.h -rw-r--r-- 9.8 KB
md5.h -rw-r--r-- 497 bytes
nhpoly1305.h -rw-r--r-- 2.2 KB
null.h -rw-r--r-- 346 bytes
padlock.h -rw-r--r-- 438 bytes
pcrypt.h -rw-r--r-- 815 bytes
pkcs7.h -rw-r--r-- 1.2 KB
poly1305.h -rw-r--r-- 2.4 KB
public_key.h -rw-r--r-- 2.4 KB
rng.h -rw-r--r-- 6.5 KB
scatterwalk.h -rw-r--r-- 3.1 KB
serpent.h -rw-r--r-- 696 bytes
sha1.h -rw-r--r-- 1.2 KB
sha1_base.h -rw-r--r-- 2.5 KB
sha2.h -rw-r--r-- 3.8 KB
sha256_base.h -rw-r--r-- 2.6 KB
sha3.h -rw-r--r-- 879 bytes
sha512_base.h -rw-r--r-- 3.2 KB
skcipher.h -rw-r--r-- 19.9 KB
sm2.h -rw-r--r-- 749 bytes
sm3.h -rw-r--r-- 897 bytes
sm3_base.h -rw-r--r-- 2.5 KB
sm4.h -rw-r--r-- 754 bytes
streebog.h -rw-r--r-- 949 bytes
twofish.h -rw-r--r-- 743 bytes
xts.h -rw-r--r-- 1.1 KB

back to top