@@ -576,8 +576,8 @@ static void print_section(char *level, char *text, u8 *addr,
576576 unsigned int length )
577577{
578578 metadata_access_enable ();
579- print_hex_dump (level , kasan_reset_tag ( text ) , DUMP_PREFIX_ADDRESS ,
580- 16 , 1 , addr , length , 1 );
579+ print_hex_dump (level , text , DUMP_PREFIX_ADDRESS ,
580+ 16 , 1 , kasan_reset_tag (( void * ) addr ) , length , 1 );
581581 metadata_access_disable ();
582582}
583583
@@ -1400,12 +1400,13 @@ parse_slub_debug_flags(char *str, slab_flags_t *flags, char **slabs, bool init)
14001400static int __init setup_slub_debug (char * str )
14011401{
14021402 slab_flags_t flags ;
1403+ slab_flags_t global_flags ;
14031404 char * saved_str ;
14041405 char * slab_list ;
14051406 bool global_slub_debug_changed = false;
14061407 bool slab_list_specified = false;
14071408
1408- slub_debug = DEBUG_DEFAULT_FLAGS ;
1409+ global_flags = DEBUG_DEFAULT_FLAGS ;
14091410 if (* str ++ != '=' || !* str )
14101411 /*
14111412 * No options specified. Switch on full debugging.
@@ -1417,7 +1418,7 @@ static int __init setup_slub_debug(char *str)
14171418 str = parse_slub_debug_flags (str , & flags , & slab_list , true);
14181419
14191420 if (!slab_list ) {
1420- slub_debug = flags ;
1421+ global_flags = flags ;
14211422 global_slub_debug_changed = true;
14221423 } else {
14231424 slab_list_specified = true;
@@ -1426,16 +1427,18 @@ static int __init setup_slub_debug(char *str)
14261427
14271428 /*
14281429 * For backwards compatibility, a single list of flags with list of
1429- * slabs means debugging is only enabled for those slabs, so the global
1430- * slub_debug should be 0. We can extended that to multiple lists as
1430+ * slabs means debugging is only changed for those slabs, so the global
1431+ * slub_debug should be unchanged (0 or DEBUG_DEFAULT_FLAGS, depending
1432+ * on CONFIG_SLUB_DEBUG_ON). We can extended that to multiple lists as
14311433 * long as there is no option specifying flags without a slab list.
14321434 */
14331435 if (slab_list_specified ) {
14341436 if (!global_slub_debug_changed )
1435- slub_debug = 0 ;
1437+ global_flags = slub_debug ;
14361438 slub_debug_string = saved_str ;
14371439 }
14381440out :
1441+ slub_debug = global_flags ;
14391442 if (slub_debug != 0 || slub_debug_string )
14401443 static_branch_enable (& slub_debug_enabled );
14411444 else
@@ -3236,12 +3239,12 @@ struct detached_freelist {
32363239 struct kmem_cache * s ;
32373240};
32383241
3239- static inline void free_nonslab_page (struct page * page )
3242+ static inline void free_nonslab_page (struct page * page , void * object )
32403243{
32413244 unsigned int order = compound_order (page );
32423245
32433246 VM_BUG_ON_PAGE (!PageCompound (page ), page );
3244- kfree_hook (page_address ( page ) );
3247+ kfree_hook (object );
32453248 mod_lruvec_page_state (page , NR_SLAB_UNRECLAIMABLE_B , - (PAGE_SIZE << order ));
32463249 __free_pages (page , order );
32473250}
@@ -3282,7 +3285,7 @@ int build_detached_freelist(struct kmem_cache *s, size_t size,
32823285 if (!s ) {
32833286 /* Handle kalloc'ed objects */
32843287 if (unlikely (!PageSlab (page ))) {
3285- free_nonslab_page (page );
3288+ free_nonslab_page (page , object );
32863289 p [size ] = NULL ; /* mark object processed */
32873290 return size ;
32883291 }
@@ -4258,7 +4261,7 @@ void kfree(const void *x)
42584261
42594262 page = virt_to_head_page (x );
42604263 if (unlikely (!PageSlab (page ))) {
4261- free_nonslab_page (page );
4264+ free_nonslab_page (page , object );
42624265 return ;
42634266 }
42644267 slab_free (page -> slab_cache , page , object , NULL , 1 , _RET_IP_ );
0 commit comments