History

mm/kasan: Convert to struct folio and struct slab

KASAN accesses some slab related struct page fields so we need to convert it to struct slab. Some places are a bit simplified thanks to kasan_addr_to_slab() encapsulating the PageSlab flag check through virt_to_slab(). When resolving object address to either a real slab or a large kmalloc, use struct folio as the intermediate type for testing the slab flag to avoid unnecessary implicit compound_head(). [ vbabka@suse.cz: use struct folio, adjust to differences in previous patches ]

Matthew Wilcox (Oracle) committed 5 years ago

Commit 6e48a961 parent 50757019 files · +42 −28Browse files

Showing the changes to include (1 of 9 files). Show all

Unified · Split

include/linux/kasan.h+5−4
@@ -9,6 +9,7 @@ · 8 unmodified lines
9 9
10struct kmem_cache;10struct kmem_cache;
11struct page;11struct page;
12struct slab;
12struct vm_struct;13struct vm_struct;
13struct task_struct;14struct task_struct;
14 15
@@ -193,11 +194,11 @@ static __always_inline size_t kasan_metadata_size(struct kmem_cache *cache) · 178 unmodified lines
193 return 0;194 return 0;
194}195}
195 196
196void __kasan_poison_slab(struct page *page);197void __kasan_poison_slab(struct slab *slab);
197static __always_inline void kasan_poison_slab(struct page *page)198static __always_inline void kasan_poison_slab(struct slab *slab)
198{199{
199 if (kasan_enabled())200 if (kasan_enabled())
200 __kasan_poison_slab(page);201 __kasan_poison_slab(slab);
201}202}
202 203
203void __kasan_unpoison_object_data(struct kmem_cache *cache, void *object);204void __kasan_unpoison_object_data(struct kmem_cache *cache, void *object);
@@ -322,7 +323,7 @@ static inline void kasan_cache_create(struct kmem_cache *cache, · 118 unmodified lines
322 slab_flags_t *flags) {}323 slab_flags_t *flags) {}
323static inline void kasan_cache_create_kmalloc(struct kmem_cache *cache) {}324static inline void kasan_cache_create_kmalloc(struct kmem_cache *cache) {}
324static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }325static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }
325static inline void kasan_poison_slab(struct page *page) {}326static inline void kasan_poison_slab(struct slab *slab) {}
326static inline void kasan_unpoison_object_data(struct kmem_cache *cache,327static inline void kasan_unpoison_object_data(struct kmem_cache *cache,
327 void *object) {}328 void *object) {}
328static inline void kasan_poison_object_data(struct kmem_cache *cache,329static inline void kasan_poison_object_data(struct kmem_cache *cache,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t