Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
"7 patches.

Subsystems affected by this patch series: mm (kasan, mm/slub,
mm/madvise, and memcg), and lib"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
lib: use PFN_PHYS() in devmem_is_allowed()
mm/memcg: fix incorrect flushing of lruvec data in obj_stock
mm/madvise: report SIGBUS as -EFAULT for MADV_POPULATE_(READ|WRITE)
mm: slub: fix slub_debug disabling for list of slabs
slub: fix kmalloc_pagealloc_invalid_free unit test
kasan, slub: reset tag when printing address
kasan, kmemleak: reset tags when scanning block

+30 -20
+1 -1
lib/devmem_is_allowed.c
··· 19 19 */ 20 20 int devmem_is_allowed(unsigned long pfn) 21 21 { 22 - if (iomem_is_exclusive(pfn << PAGE_SHIFT)) 22 + if (iomem_is_exclusive(PFN_PHYS(pfn))) 23 23 return 0; 24 24 if (!page_is_ram(pfn)) 25 25 return 1;
+5 -2
mm/gup.c
··· 1558 1558 gup_flags |= FOLL_WRITE; 1559 1559 1560 1560 /* 1561 - * See check_vma_flags(): Will return -EFAULT on incompatible mappings 1562 - * or with insufficient permissions. 1561 + * We want to report -EINVAL instead of -EFAULT for any permission 1562 + * problems or incompatible mappings. 1563 1563 */ 1564 + if (check_vma_flags(vma, gup_flags)) 1565 + return -EINVAL; 1566 + 1564 1567 return __get_user_pages(mm, start, nr_pages, gup_flags, 1565 1568 NULL, NULL, locked); 1566 1569 }
+3 -3
mm/kmemleak.c
··· 290 290 warn_or_seq_printf(seq, " hex dump (first %zu bytes):\n", len); 291 291 kasan_disable_current(); 292 292 warn_or_seq_hex_dump(seq, DUMP_PREFIX_NONE, HEX_ROW_SIZE, 293 - HEX_GROUP_SIZE, ptr, len, HEX_ASCII); 293 + HEX_GROUP_SIZE, kasan_reset_tag((void *)ptr), len, HEX_ASCII); 294 294 kasan_enable_current(); 295 295 } 296 296 ··· 1171 1171 1172 1172 kasan_disable_current(); 1173 1173 kcsan_disable_current(); 1174 - object->checksum = crc32(0, (void *)object->pointer, object->size); 1174 + object->checksum = crc32(0, kasan_reset_tag((void *)object->pointer), object->size); 1175 1175 kasan_enable_current(); 1176 1176 kcsan_enable_current(); 1177 1177 ··· 1246 1246 break; 1247 1247 1248 1248 kasan_disable_current(); 1249 - pointer = *ptr; 1249 + pointer = *(unsigned long *)kasan_reset_tag((void *)ptr); 1250 1250 kasan_enable_current(); 1251 1251 1252 1252 untagged_ptr = (unsigned long)kasan_reset_tag((void *)pointer);
+3 -1
mm/madvise.c
··· 862 862 switch (pages) { 863 863 case -EINTR: 864 864 return -EINTR; 865 - case -EFAULT: /* Incompatible mappings / permissions. */ 865 + case -EINVAL: /* Incompatible mappings / permissions. */ 866 866 return -EINVAL; 867 867 case -EHWPOISON: 868 868 return -EHWPOISON; 869 + case -EFAULT: /* VM_FAULT_SIGBUS or VM_FAULT_SIGSEGV */ 870 + return -EFAULT; 869 871 default: 870 872 pr_warn_once("%s: unhandled return value: %ld\n", 871 873 __func__, pages);
+4 -2
mm/memcontrol.c
··· 3106 3106 stock->cached_pgdat = pgdat; 3107 3107 } else if (stock->cached_pgdat != pgdat) { 3108 3108 /* Flush the existing cached vmstat data */ 3109 + struct pglist_data *oldpg = stock->cached_pgdat; 3110 + 3109 3111 if (stock->nr_slab_reclaimable_b) { 3110 - mod_objcg_mlstate(objcg, pgdat, NR_SLAB_RECLAIMABLE_B, 3112 + mod_objcg_mlstate(objcg, oldpg, NR_SLAB_RECLAIMABLE_B, 3111 3113 stock->nr_slab_reclaimable_b); 3112 3114 stock->nr_slab_reclaimable_b = 0; 3113 3115 } 3114 3116 if (stock->nr_slab_unreclaimable_b) { 3115 - mod_objcg_mlstate(objcg, pgdat, NR_SLAB_UNRECLAIMABLE_B, 3117 + mod_objcg_mlstate(objcg, oldpg, NR_SLAB_UNRECLAIMABLE_B, 3116 3118 stock->nr_slab_unreclaimable_b); 3117 3119 stock->nr_slab_unreclaimable_b = 0; 3118 3120 }
+14 -11
mm/slub.c
··· 576 576 unsigned int length) 577 577 { 578 578 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); 581 581 metadata_access_disable(); 582 582 } 583 583 ··· 1400 1400 static int __init setup_slub_debug(char *str) 1401 1401 { 1402 1402 slab_flags_t flags; 1403 + slab_flags_t global_flags; 1403 1404 char *saved_str; 1404 1405 char *slab_list; 1405 1406 bool global_slub_debug_changed = false; 1406 1407 bool slab_list_specified = false; 1407 1408 1408 - slub_debug = DEBUG_DEFAULT_FLAGS; 1409 + global_flags = DEBUG_DEFAULT_FLAGS; 1409 1410 if (*str++ != '=' || !*str) 1410 1411 /* 1411 1412 * No options specified. Switch on full debugging. ··· 1418 1417 str = parse_slub_debug_flags(str, &flags, &slab_list, true); 1419 1418 1420 1419 if (!slab_list) { 1421 - slub_debug = flags; 1420 + global_flags = flags; 1422 1421 global_slub_debug_changed = true; 1423 1422 } else { 1424 1423 slab_list_specified = true; ··· 1427 1426 1428 1427 /* 1429 1428 * For backwards compatibility, a single list of flags with list of 1430 - * slabs means debugging is only enabled for those slabs, so the global 1431 - * slub_debug should be 0. We can extended that to multiple lists as 1429 + * slabs means debugging is only changed for those slabs, so the global 1430 + * slub_debug should be unchanged (0 or DEBUG_DEFAULT_FLAGS, depending 1431 + * on CONFIG_SLUB_DEBUG_ON). We can extended that to multiple lists as 1432 1432 * long as there is no option specifying flags without a slab list. 1433 1433 */ 1434 1434 if (slab_list_specified) { 1435 1435 if (!global_slub_debug_changed) 1436 - slub_debug = 0; 1436 + global_flags = slub_debug; 1437 1437 slub_debug_string = saved_str; 1438 1438 } 1439 1439 out: 1440 + slub_debug = global_flags; 1440 1441 if (slub_debug != 0 || slub_debug_string) 1441 1442 static_branch_enable(&slub_debug_enabled); 1442 1443 else ··· 3239 3236 struct kmem_cache *s; 3240 3237 }; 3241 3238 3242 - static inline void free_nonslab_page(struct page *page) 3239 + static inline void free_nonslab_page(struct page *page, void *object) 3243 3240 { 3244 3241 unsigned int order = compound_order(page); 3245 3242 3246 3243 VM_BUG_ON_PAGE(!PageCompound(page), page); 3247 - kfree_hook(page_address(page)); 3244 + kfree_hook(object); 3248 3245 mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order)); 3249 3246 __free_pages(page, order); 3250 3247 } ··· 3285 3282 if (!s) { 3286 3283 /* Handle kalloc'ed objects */ 3287 3284 if (unlikely(!PageSlab(page))) { 3288 - free_nonslab_page(page); 3285 + free_nonslab_page(page, object); 3289 3286 p[size] = NULL; /* mark object processed */ 3290 3287 return size; 3291 3288 } ··· 4261 4258 4262 4259 page = virt_to_head_page(x); 4263 4260 if (unlikely(!PageSlab(page))) { 4264 - free_nonslab_page(page); 4261 + free_nonslab_page(page, object); 4265 4262 return; 4266 4263 } 4267 4264 slab_free(page->slab_cache, page, object, NULL, 1, _RET_IP_);