Re: [PATCH] mm: slub: Panic if the object corruption is checked.
From: kernel test robot <hidden>
Date: 2025-01-21 12:47:19
Also in:
linux-mm, lkml, oe-kbuild-all
Hi Hyesoo, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Hyesoo-Yu/mm-slub-Panic-if-the-object-corruption-is-checked/20250120-163233 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20250120082908.4162780-1-hyesoo.yu%40samsung.com patch subject: [PATCH] mm: slub: Panic if the object corruption is checked. config: mips-randconfig-r111-20250121 (https://download.01.org/0day-ci/archive/20250121/202501212026.lUnLNhv6-lkp@intel.com/config) compiler: mips-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20250121/202501212026.lUnLNhv6-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Closes: https://lore.kernel.org/oe-kbuild-all/202501212026.lUnLNhv6-lkp@intel.com/ (local) sparse warnings: (new ones prefixed by >>)
quoted
mm/slub.c:1308:9: sparse: sparse: cast from restricted slab_flags_t
mm/slub.c:1394:17: sparse: sparse: cast from restricted slab_flags_t
mm/slub.c:4440:47: sparse: sparse: context imbalance in '__slab_free' - unexpected unlock
vim +1308 mm/slub.c
1273
1274 /* Check the pad bytes at the end of a slab page */
1275 static pad_check_attributes void
1276 slab_pad_check(struct kmem_cache *s, struct slab *slab)
1277 {
1278 u8 *start;
1279 u8 *fault;
1280 u8 *end;
1281 u8 *pad;
1282 int length;
1283 int remainder;
1284
1285 if (!(s->flags & SLAB_POISON))
1286 return;
1287
1288 start = slab_address(slab);
1289 length = slab_size(slab);
1290 end = start + length;
1291 remainder = length % s->size;
1292 if (!remainder)
1293 return;
1294
1295 pad = end - remainder;
1296 metadata_access_enable();
1297 fault = memchr_inv(kasan_reset_tag(pad), POISON_INUSE, remainder);
1298 metadata_access_disable();
1299 if (!fault)
1300 return;
1301 while (end > fault && end[-1] == POISON_INUSE)
1302 end--;
1303
1304 slab_err(s, slab, "Padding overwritten. 0x%p-0x%p @offset=%tu",
1305 fault, end - 1, fault - start);
1306 print_section(KERN_ERR, "Padding ", pad, remainder);
1307 1308 BUG_ON(s->flags & SLAB_CORRUPTION_PANIC);
1309 1310 restore_bytes(s, "slab padding", POISON_INUSE, fault, end); 1311 } 1312 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki