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:
"17 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
drivers/acpi/scan.c: document why we don't need the device_hotplug_lock
memremap: move from kernel/ to mm/
lib/test_meminit.c: use GFP_ATOMIC in RCU critical section
asm-generic: fix -Wtype-limits compiler warnings
cgroup: kselftest: relax fs_spec checks
mm/memory_hotplug.c: remove unneeded return for void function
mm/migrate.c: initialize pud_entry in migrate_vma()
coredump: split pipe command whitespace before expanding template
page flags: prioritize kasan bits over last-cpuid
ubsan: build ubsan.c more conservatively
kasan: remove clang version check for KASAN_STACK
mm: compaction: avoid 100% CPU usage during compaction when a task is killed
mm: migrate: fix reference check race between __find_get_block() and migration
mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
ocfs2: remove set but not used variable 'last_hash'
Revert "kmemleak: allow to coexist with fault injection"
kernel/signal.c: fix a kernel-doc markup

+114 -76
+1
arch/mips/vdso/vdso.h
··· 9 9 #if _MIPS_SIM != _MIPS_SIM_ABI64 && defined(CONFIG_64BIT) 10 10 11 11 /* Building 32-bit VDSO for the 64-bit kernel. Fake a 32-bit Kconfig. */ 12 + #define BUILD_VDSO32_64 12 13 #undef CONFIG_64BIT 13 14 #define CONFIG_32BIT 1 14 15 #ifndef __ASSEMBLY__
+6
drivers/acpi/scan.c
··· 2204 2204 acpi_gpe_apply_masked_gpes(); 2205 2205 acpi_update_all_gpes(); 2206 2206 2207 + /* 2208 + * Although we call __add_memory() that is documented to require the 2209 + * device_hotplug_lock, it is not necessary here because this is an 2210 + * early code when userspace or any other code path cannot trigger 2211 + * hotplug/hotunplug operations. 2212 + */ 2207 2213 mutex_lock(&acpi_scan_lock); 2208 2214 /* 2209 2215 * Enumerate devices in the ACPI namespace.
+39 -5
fs/coredump.c
··· 7 7 #include <linux/stat.h> 8 8 #include <linux/fcntl.h> 9 9 #include <linux/swap.h> 10 + #include <linux/ctype.h> 10 11 #include <linux/string.h> 11 12 #include <linux/init.h> 12 13 #include <linux/pagemap.h> ··· 188 187 * name into corename, which must have space for at least 189 188 * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. 190 189 */ 191 - static int format_corename(struct core_name *cn, struct coredump_params *cprm) 190 + static int format_corename(struct core_name *cn, struct coredump_params *cprm, 191 + size_t **argv, int *argc) 192 192 { 193 193 const struct cred *cred = current_cred(); 194 194 const char *pat_ptr = core_pattern; 195 195 int ispipe = (*pat_ptr == '|'); 196 + bool was_space = false; 196 197 int pid_in_pattern = 0; 197 198 int err = 0; 198 199 ··· 204 201 return -ENOMEM; 205 202 cn->corename[0] = '\0'; 206 203 207 - if (ispipe) 204 + if (ispipe) { 205 + int argvs = sizeof(core_pattern) / 2; 206 + (*argv) = kmalloc_array(argvs, sizeof(**argv), GFP_KERNEL); 207 + if (!(*argv)) 208 + return -ENOMEM; 209 + (*argv)[(*argc)++] = 0; 208 210 ++pat_ptr; 211 + } 209 212 210 213 /* Repeat as long as we have more pattern to process and more output 211 214 space */ 212 215 while (*pat_ptr) { 216 + /* 217 + * Split on spaces before doing template expansion so that 218 + * %e and %E don't get split if they have spaces in them 219 + */ 220 + if (ispipe) { 221 + if (isspace(*pat_ptr)) { 222 + was_space = true; 223 + pat_ptr++; 224 + continue; 225 + } else if (was_space) { 226 + was_space = false; 227 + err = cn_printf(cn, "%c", '\0'); 228 + if (err) 229 + return err; 230 + (*argv)[(*argc)++] = cn->used; 231 + } 232 + } 213 233 if (*pat_ptr != '%') { 214 234 err = cn_printf(cn, "%c", *pat_ptr++); 215 235 } else { ··· 572 546 struct cred *cred; 573 547 int retval = 0; 574 548 int ispipe; 549 + size_t *argv = NULL; 550 + int argc = 0; 575 551 struct files_struct *displaced; 576 552 /* require nonrelative corefile path and be extra careful */ 577 553 bool need_suid_safe = false; ··· 620 592 621 593 old_cred = override_creds(cred); 622 594 623 - ispipe = format_corename(&cn, &cprm); 595 + ispipe = format_corename(&cn, &cprm, &argv, &argc); 624 596 625 597 if (ispipe) { 598 + int argi; 626 599 int dump_count; 627 600 char **helper_argv; 628 601 struct subprocess_info *sub_info; ··· 666 637 goto fail_dropcount; 667 638 } 668 639 669 - helper_argv = argv_split(GFP_KERNEL, cn.corename, NULL); 640 + helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv), 641 + GFP_KERNEL); 670 642 if (!helper_argv) { 671 643 printk(KERN_WARNING "%s failed to allocate memory\n", 672 644 __func__); 673 645 goto fail_dropcount; 674 646 } 647 + for (argi = 0; argi < argc; argi++) 648 + helper_argv[argi] = cn.corename + argv[argi]; 649 + helper_argv[argi] = NULL; 675 650 676 651 retval = -ENOMEM; 677 652 sub_info = call_usermodehelper_setup(helper_argv[0], ··· 685 652 retval = call_usermodehelper_exec(sub_info, 686 653 UMH_WAIT_EXEC); 687 654 688 - argv_free(helper_argv); 655 + kfree(helper_argv); 689 656 if (retval) { 690 657 printk(KERN_INFO "Core dump to |%s pipe failed\n", 691 658 cn.corename); ··· 799 766 if (ispipe) 800 767 atomic_dec(&core_dump_count); 801 768 fail_unlock: 769 + kfree(argv); 802 770 kfree(cn.corename); 803 771 coredump_finish(mm, core_dumped); 804 772 revert_creds(old_cred);
-3
fs/ocfs2/xattr.c
··· 3825 3825 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 3826 3826 int low_bucket = 0, bucket, high_bucket; 3827 3827 struct ocfs2_xattr_bucket *search; 3828 - u32 last_hash; 3829 3828 u64 blkno, lower_blkno = 0; 3830 3829 3831 3830 search = ocfs2_xattr_bucket_new(inode); ··· 3867 3868 */ 3868 3869 if (xh->xh_count) 3869 3870 xe = &xh->xh_entries[le16_to_cpu(xh->xh_count) - 1]; 3870 - 3871 - last_hash = le32_to_cpu(xe->xe_name_hash); 3872 3871 3873 3872 /* record lower_blkno which may be the insert place. */ 3874 3873 lower_blkno = blkno;
+20 -30
include/asm-generic/getorder.h
··· 7 7 #include <linux/compiler.h> 8 8 #include <linux/log2.h> 9 9 10 - /* 11 - * Runtime evaluation of get_order() 12 - */ 13 - static inline __attribute_const__ 14 - int __get_order(unsigned long size) 15 - { 16 - int order; 17 - 18 - size--; 19 - size >>= PAGE_SHIFT; 20 - #if BITS_PER_LONG == 32 21 - order = fls(size); 22 - #else 23 - order = fls64(size); 24 - #endif 25 - return order; 26 - } 27 - 28 10 /** 29 11 * get_order - Determine the allocation order of a memory size 30 12 * @size: The size for which to get the order ··· 25 43 * to hold an object of the specified size. 26 44 * 27 45 * The result is undefined if the size is 0. 28 - * 29 - * This function may be used to initialise variables with compile time 30 - * evaluations of constants. 31 46 */ 32 - #define get_order(n) \ 33 - ( \ 34 - __builtin_constant_p(n) ? ( \ 35 - ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \ 36 - (((n) < (1UL << PAGE_SHIFT)) ? 0 : \ 37 - ilog2((n) - 1) - PAGE_SHIFT + 1) \ 38 - ) : \ 39 - __get_order(n) \ 40 - ) 47 + static inline __attribute_const__ int get_order(unsigned long size) 48 + { 49 + if (__builtin_constant_p(size)) { 50 + if (!size) 51 + return BITS_PER_LONG - PAGE_SHIFT; 52 + 53 + if (size < (1UL << PAGE_SHIFT)) 54 + return 0; 55 + 56 + return ilog2((size) - 1) - PAGE_SHIFT + 1; 57 + } 58 + 59 + size--; 60 + size >>= PAGE_SHIFT; 61 + #if BITS_PER_LONG == 32 62 + return fls(size); 63 + #else 64 + return fls64(size); 65 + #endif 66 + } 41 67 42 68 #endif /* __ASSEMBLY__ */ 43 69
+11 -7
include/linux/page-flags-layout.h
··· 32 32 33 33 #endif /* CONFIG_SPARSEMEM */ 34 34 35 + #ifndef BUILD_VDSO32_64 35 36 /* 36 37 * page->flags layout: 37 38 * ··· 77 76 #define LAST_CPUPID_SHIFT 0 78 77 #endif 79 78 80 - #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS 79 + #ifdef CONFIG_KASAN_SW_TAGS 80 + #define KASAN_TAG_WIDTH 8 81 + #else 82 + #define KASAN_TAG_WIDTH 0 83 + #endif 84 + 85 + #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT+KASAN_TAG_WIDTH \ 86 + <= BITS_PER_LONG - NR_PAGEFLAGS 81 87 #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT 82 88 #else 83 89 #define LAST_CPUPID_WIDTH 0 84 90 #endif 85 91 86 - #ifdef CONFIG_KASAN_SW_TAGS 87 - #define KASAN_TAG_WIDTH 8 88 92 #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH+LAST_CPUPID_WIDTH+KASAN_TAG_WIDTH \ 89 93 > BITS_PER_LONG - NR_PAGEFLAGS 90 - #error "KASAN: not enough bits in page flags for tag" 91 - #endif 92 - #else 93 - #define KASAN_TAG_WIDTH 0 94 + #error "Not enough bits in page flags" 94 95 #endif 95 96 96 97 /* ··· 107 104 #define LAST_CPUPID_NOT_IN_PAGE_FLAGS 108 105 #endif 109 106 107 + #endif 110 108 #endif /* _LINUX_PAGE_FLAGS_LAYOUT */
-1
kernel/Makefile
··· 111 111 obj-$(CONFIG_TORTURE_TEST) += torture.o 112 112 113 113 obj-$(CONFIG_HAS_IOMEM) += iomem.o 114 - obj-$(CONFIG_ZONE_DEVICE) += memremap.o 115 114 obj-$(CONFIG_RSEQ) += rseq.o 116 115 117 116 obj-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak.o
kernel/memremap.c mm/memremap.c
+1 -1
kernel/signal.c
··· 349 349 * @task has %JOBCTL_STOP_PENDING set and is participating in a group stop. 350 350 * Group stop states are cleared and the group stop count is consumed if 351 351 * %JOBCTL_STOP_CONSUME was set. If the consumption completes the group 352 - * stop, the appropriate %SIGNAL_* flags are set. 352 + * stop, the appropriate `SIGNAL_*` flags are set. 353 353 * 354 354 * CONTEXT: 355 355 * Must be called with @task->sighand->siglock held.
+5 -6
lib/Kconfig.kasan
··· 106 106 107 107 config KASAN_STACK_ENABLE 108 108 bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST 109 - default !(CLANG_VERSION < 90000) 110 109 depends on KASAN 111 110 help 112 111 The LLVM stack address sanitizer has a know problem that ··· 114 115 Disabling asan-stack makes it safe to run kernels build 115 116 with clang-8 with KASAN enabled, though it loses some of 116 117 the functionality. 117 - This feature is always disabled when compile-testing with clang-8 118 - or earlier to avoid cluttering the output in stack overflow 119 - warnings, but clang-8 users can still enable it for builds without 120 - CONFIG_COMPILE_TEST. On gcc and later clang versions it is 121 - assumed to always be safe to use and enabled by default. 118 + This feature is always disabled when compile-testing with clang 119 + to avoid cluttering the output in stack overflow warnings, 120 + but clang users can still enable it for builds without 121 + CONFIG_COMPILE_TEST. On gcc it is assumed to always be safe 122 + to use and enabled by default. 122 123 123 124 config KASAN_STACK 124 125 int
+2 -1
lib/Makefile
··· 279 279 obj-$(CONFIG_UBSAN) += ubsan.o 280 280 281 281 UBSAN_SANITIZE_ubsan.o := n 282 - CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) 282 + KASAN_SANITIZE_ubsan.o := n 283 + CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN) 283 284 284 285 obj-$(CONFIG_SBITMAP) += sbitmap.o 285 286
+1 -1
lib/test_meminit.c
··· 222 222 * Copy the buffer to check that it's not wiped on 223 223 * free(). 224 224 */ 225 - buf_copy = kmalloc(size, GFP_KERNEL); 225 + buf_copy = kmalloc(size, GFP_ATOMIC); 226 226 if (buf_copy) 227 227 memcpy(buf_copy, buf, size); 228 228
+1
mm/Makefile
··· 102 102 obj-$(CONFIG_DEBUG_PAGE_REF) += debug_page_ref.o 103 103 obj-$(CONFIG_HARDENED_USERCOPY) += usercopy.o 104 104 obj-$(CONFIG_PERCPU_STATS) += percpu-stats.o 105 + obj-$(CONFIG_ZONE_DEVICE) += memremap.o 105 106 obj-$(CONFIG_HMM_MIRROR) += hmm.o 106 107 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
+7 -4
mm/compaction.c
··· 842 842 843 843 /* 844 844 * Periodically drop the lock (if held) regardless of its 845 - * contention, to give chance to IRQs. Abort async compaction 846 - * if contended. 845 + * contention, to give chance to IRQs. Abort completely if 846 + * a fatal signal is pending. 847 847 */ 848 848 if (!(low_pfn % SWAP_CLUSTER_MAX) 849 849 && compact_unlock_should_abort(&pgdat->lru_lock, 850 - flags, &locked, cc)) 851 - break; 850 + flags, &locked, cc)) { 851 + low_pfn = 0; 852 + goto fatal_pending; 853 + } 852 854 853 855 if (!pfn_valid_within(low_pfn)) 854 856 goto isolate_fail; ··· 1062 1060 trace_mm_compaction_isolate_migratepages(start_pfn, low_pfn, 1063 1061 nr_scanned, nr_isolated); 1064 1062 1063 + fatal_pending: 1065 1064 cc->total_migrate_scanned += nr_scanned; 1066 1065 if (nr_isolated) 1067 1066 count_compact_events(COMPACTISOLATED, nr_isolated);
+1 -1
mm/kmemleak.c
··· 114 114 /* GFP bitmask for kmemleak internal allocations */ 115 115 #define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC)) | \ 116 116 __GFP_NORETRY | __GFP_NOMEMALLOC | \ 117 - __GFP_NOWARN | __GFP_NOFAIL) 117 + __GFP_NOWARN) 118 118 119 119 /* scanning area inside a memory block */ 120 120 struct kmemleak_scan_area {
-2
mm/memory_hotplug.c
··· 132 132 return; 133 133 release_resource(res); 134 134 kfree(res); 135 - return; 136 135 } 137 136 138 137 #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE ··· 978 979 arch_refresh_nodedata(nid, NULL); 979 980 free_percpu(pgdat->per_cpu_nodestats); 980 981 arch_free_nodedata(pgdat); 981 - return; 982 982 } 983 983 984 984
+10 -11
mm/migrate.c
··· 767 767 } 768 768 bh = bh->b_this_page; 769 769 } while (bh != head); 770 - spin_unlock(&mapping->private_lock); 771 770 if (busy) { 772 771 if (invalidated) { 773 772 rc = -EAGAIN; 774 773 goto unlock_buffers; 775 774 } 775 + spin_unlock(&mapping->private_lock); 776 776 invalidate_bh_lrus(); 777 777 invalidated = true; 778 778 goto recheck_buffers; ··· 805 805 806 806 rc = MIGRATEPAGE_SUCCESS; 807 807 unlock_buffers: 808 + if (check_refs) 809 + spin_unlock(&mapping->private_lock); 808 810 bh = head; 809 811 do { 810 812 unlock_buffer(bh); ··· 2340 2338 static void migrate_vma_collect(struct migrate_vma *migrate) 2341 2339 { 2342 2340 struct mmu_notifier_range range; 2343 - struct mm_walk mm_walk; 2344 - 2345 - mm_walk.pmd_entry = migrate_vma_collect_pmd; 2346 - mm_walk.pte_entry = NULL; 2347 - mm_walk.pte_hole = migrate_vma_collect_hole; 2348 - mm_walk.hugetlb_entry = NULL; 2349 - mm_walk.test_walk = NULL; 2350 - mm_walk.vma = migrate->vma; 2351 - mm_walk.mm = migrate->vma->vm_mm; 2352 - mm_walk.private = migrate; 2341 + struct mm_walk mm_walk = { 2342 + .pmd_entry = migrate_vma_collect_pmd, 2343 + .pte_hole = migrate_vma_collect_hole, 2344 + .vma = migrate->vma, 2345 + .mm = migrate->vma->vm_mm, 2346 + .private = migrate, 2347 + }; 2353 2348 2354 2349 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm_walk.mm, 2355 2350 migrate->start,
+8 -1
mm/vmscan.c
··· 699 699 unsigned long ret, freed = 0; 700 700 struct shrinker *shrinker; 701 701 702 - if (!mem_cgroup_is_root(memcg)) 702 + /* 703 + * The root memcg might be allocated even though memcg is disabled 704 + * via "cgroup_disable=memory" boot parameter. This could make 705 + * mem_cgroup_is_root() return false, then just run memcg slab 706 + * shrink, but skip global shrink. This may result in premature 707 + * oom. 708 + */ 709 + if (!mem_cgroup_disabled() && !mem_cgroup_is_root(memcg)) 703 710 return shrink_slab_memcg(gfp_mask, nid, memcg, priority); 704 711 705 712 if (!down_read_trylock(&shrinker_rwsem))
+1 -2
tools/testing/selftests/cgroup/cgroup_util.c
··· 191 191 strtok(NULL, delim); 192 192 strtok(NULL, delim); 193 193 194 - if (strcmp(fs, "cgroup") == 0 && 195 - strcmp(type, "cgroup2") == 0) { 194 + if (strcmp(type, "cgroup2") == 0) { 196 195 strncpy(root, mount, len); 197 196 return 0; 198 197 }