diff options
| author | Vlastimil Babka <[email protected]> | 2022-11-11 09:08:18 +0100 |
|---|---|---|
| committer | Vlastimil Babka <[email protected]> | 2022-11-21 10:36:09 +0100 |
| commit | 90e9b23a60d5b4c8317f58e01ed05d3bdf063440 (patch) | |
| tree | b87f0bd1d2c0ab251fafcbc4aebd5e3c73799397 /include/linux | |
| parent | 76537db3b95cbf5d0189ce185c16db9f93017021 (diff) | |
| parent | 946fa0dbf2d8923a587f7348adf16563d59f1b3d (diff) | |
Merge branch 'slab/for-6.2/kmalloc_redzone' into slab/for-next
kmalloc() redzone improvements by Feng Tang
From cover letter [1]:
kmalloc's API family is critical for mm, and one of its nature is that
it will round up the request size to a fixed one (mostly power of 2).
When user requests memory for '2^n + 1' bytes, actually 2^(n+1) bytes
could be allocated, so there is an extra space than what is originally
requested.
This patchset tries to extend the redzone sanity check to the extra
kmalloced buffer than requested, to better detect un-legitimate access
to it. (depends on SLAB_STORE_USER & SLAB_RED_ZONE)
[1] https://lore.kernel.org/all/[email protected]/
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kasan.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index d811b3d7d2a1..96c9d56e5510 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -302,7 +302,7 @@ static inline void kasan_unpoison_task_stack(struct task_struct *task) {} #ifdef CONFIG_KASAN_GENERIC -size_t kasan_metadata_size(struct kmem_cache *cache); +size_t kasan_metadata_size(struct kmem_cache *cache, bool in_object); slab_flags_t kasan_never_merge(void); void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, slab_flags_t *flags); @@ -315,7 +315,8 @@ void kasan_record_aux_stack_noalloc(void *ptr); #else /* CONFIG_KASAN_GENERIC */ /* Tag-based KASAN modes do not use per-object metadata. */ -static inline size_t kasan_metadata_size(struct kmem_cache *cache) +static inline size_t kasan_metadata_size(struct kmem_cache *cache, + bool in_object) { return 0; } |