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
99
1010 struct kmem_cache;
1111 struct page;
12+struct slab;
1213 struct vm_struct;
1314 struct task_struct;
1415
@@ -193,11 +194,11 @@ static __always_inline size_t kasan_metadata_size(struct kmem_cache *cache) · 178 unmodified lines
193194 return 0;
194195 }
195196
196−void __kasan_poison_slab(struct page *page);
197−static __always_inline void kasan_poison_slab(struct page *page)
197+void __kasan_poison_slab(struct slab *slab);
198+static __always_inline void kasan_poison_slab(struct slab *slab)
198199 {
199200 if (kasan_enabled())
200− __kasan_poison_slab(page);
201+ __kasan_poison_slab(slab);
201202 }
202203
203204 void __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
322323 slab_flags_t *flags) {}
323324 static inline void kasan_cache_create_kmalloc(struct kmem_cache *cache) {}
324325 static inline size_t kasan_metadata_size(struct kmem_cache *cache) { return 0; }
325−static inline void kasan_poison_slab(struct page *page) {}
326+static inline void kasan_poison_slab(struct slab *slab) {}
326327 static inline void kasan_unpoison_object_data(struct kmem_cache *cache,
327328 void *object) {}
328329 static 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