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:
"Various fixes and followups"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mm, compaction: make sure we isolate a valid PFN
include/linux/generic-radix-tree.h: fix kerneldoc comment
kernel/signal.c: trace_signal_deliver when signal_group_exit
drivers/iommu/intel-iommu.c: fix variable 'iommu' set but not used
spdxcheck.py: fix directory structures
kasan: initialize tag to 0xff in __kasan_kmalloc
z3fold: fix sheduling while atomic
scripts/gdb: fix invocation when CONFIG_COMMON_CLK is not set
mm/gup: continue VM_FAULT_RETRY processing even for pre-faults
ocfs2: fix error path kobject memory leak
memcg: make it work on sparse non-0-node systems
mm, memcg: consider subtrees in memory.events
prctl_set_mm: downgrade mmap_sem to read lock
prctl_set_mm: refactor checks from validate_prctl_map
kernel/fork.c: make max_threads symbol static
arch/arm/boot/compressed/decompress.c: fix build error due to lz4 changes
arch/parisc/configs/c8000_defconfig: remove obsoleted CONFIG_DEBUG_SLAB_LEAK
mm/vmalloc.c: fix typo in comment
lib/sort.c: fix kernel-doc notation warnings
mm: fix Documentation/vm/hmm.rst Sphinx warnings

+121 -71
+9
Documentation/admin-guide/cgroup-v2.rst
··· 177 177 ignored on non-init namespace mounts. Please refer to the 178 178 Delegation section for details. 179 179 180 + memory_localevents 181 + 182 + Only populate memory.events with data for the current cgroup, 183 + and not any subtrees. This is legacy behaviour, the default 184 + behaviour without this option is to include subtree counts. 185 + This option is system wide and can only be set on mount or 186 + modified through remount from the init namespace. The mount 187 + option is ignored on non-init namespace mounts. 188 + 180 189 181 190 Organizing Processes and Threads 182 191 --------------------------------
+5 -3
Documentation/vm/hmm.rst
··· 288 288 WRITE (1 << 62) 289 289 290 290 Now let say that device driver wants to fault with at least read a range then 291 - it does set: 292 - range->default_flags = (1 << 63) 291 + it does set:: 292 + 293 + range->default_flags = (1 << 63); 293 294 range->pfn_flags_mask = 0; 294 295 295 296 and calls hmm_range_fault() as described above. This will fill fault all page 296 297 in the range with at least read permission. 297 298 298 299 Now let say driver wants to do the same except for one page in the range for 299 - which its want to have write. Now driver set: 300 + which its want to have write. Now driver set:: 301 + 300 302 range->default_flags = (1 << 63); 301 303 range->pfn_flags_mask = (1 << 62); 302 304 range->pfns[index_of_write] = (1 << 62);
+1
arch/arm/boot/compressed/decompress.c
··· 32 32 extern char * strstr(const char * s1, const char *s2); 33 33 extern size_t strlen(const char *s); 34 34 extern int memcmp(const void *cs, const void *ct, size_t count); 35 + extern char * strchrnul(const char *, int); 35 36 36 37 #ifdef CONFIG_KERNEL_GZIP 37 38 #include "../../../../lib/decompress_inflate.c"
-1
arch/parisc/configs/c8000_defconfig
··· 225 225 CONFIG_DEBUG_FS=y 226 226 CONFIG_MAGIC_SYSRQ=y 227 227 CONFIG_DEBUG_SLAB=y 228 - CONFIG_DEBUG_SLAB_LEAK=y 229 228 CONFIG_DEBUG_MEMORY_INIT=y 230 229 CONFIG_DEBUG_STACKOVERFLOW=y 231 230 CONFIG_PANIC_ON_OOPS=y
+2 -1
drivers/iommu/intel-iommu.c
··· 3034 3034 { 3035 3035 struct pci_dev *pdev = NULL; 3036 3036 struct dmar_drhd_unit *drhd; 3037 - struct intel_iommu *iommu; 3037 + /* To avoid a -Wunused-but-set-variable warning. */ 3038 + struct intel_iommu *iommu __maybe_unused; 3038 3039 struct device *dev; 3039 3040 int i; 3040 3041 int ret = 0;
+1
fs/ocfs2/filecheck.c
··· 193 193 ret = kobject_init_and_add(&entry->fs_kobj, &ocfs2_ktype_filecheck, 194 194 NULL, "filecheck"); 195 195 if (ret) { 196 + kobject_put(&entry->fs_kobj); 196 197 kfree(fcheck); 197 198 return ret; 198 199 }
+5
include/linux/cgroup-defs.h
··· 89 89 * Enable cpuset controller in v1 cgroup to use v2 behavior. 90 90 */ 91 91 CGRP_ROOT_CPUSET_V2_MODE = (1 << 4), 92 + 93 + /* 94 + * Enable legacy local memory.events. 95 + */ 96 + CGRP_ROOT_MEMORY_LOCAL_EVENTS = (1 << 5), 92 97 }; 93 98 94 99 /* cftype->flags */
+1 -1
include/linux/generic-radix-tree.h
··· 2 2 #define _LINUX_GENERIC_RADIX_TREE_H 3 3 4 4 /** 5 - * DOC: Generic radix trees/sparse arrays: 5 + * DOC: Generic radix trees/sparse arrays 6 6 * 7 7 * Very simple and minimalistic, supporting arbitrary size entries up to 8 8 * PAGE_SIZE.
+1
include/linux/list_lru.h
··· 54 54 #ifdef CONFIG_MEMCG_KMEM 55 55 struct list_head list; 56 56 int shrinker_id; 57 + bool memcg_aware; 57 58 #endif 58 59 }; 59 60
+8 -2
include/linux/memcontrol.h
··· 737 737 static inline void memcg_memory_event(struct mem_cgroup *memcg, 738 738 enum memcg_memory_event event) 739 739 { 740 - atomic_long_inc(&memcg->memory_events[event]); 741 - cgroup_file_notify(&memcg->events_file); 740 + do { 741 + atomic_long_inc(&memcg->memory_events[event]); 742 + cgroup_file_notify(&memcg->events_file); 743 + 744 + if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS) 745 + break; 746 + } while ((memcg = parent_mem_cgroup(memcg)) && 747 + !mem_cgroup_is_root(memcg)); 742 748 } 743 749 744 750 static inline void memcg_memory_event_mm(struct mm_struct *mm,
+14 -2
kernel/cgroup/cgroup.c
··· 1810 1810 1811 1811 enum cgroup2_param { 1812 1812 Opt_nsdelegate, 1813 + Opt_memory_localevents, 1813 1814 nr__cgroup2_params 1814 1815 }; 1815 1816 1816 1817 static const struct fs_parameter_spec cgroup2_param_specs[] = { 1817 - fsparam_flag ("nsdelegate", Opt_nsdelegate), 1818 + fsparam_flag("nsdelegate", Opt_nsdelegate), 1819 + fsparam_flag("memory_localevents", Opt_memory_localevents), 1818 1820 {} 1819 1821 }; 1820 1822 ··· 1839 1837 case Opt_nsdelegate: 1840 1838 ctx->flags |= CGRP_ROOT_NS_DELEGATE; 1841 1839 return 0; 1840 + case Opt_memory_localevents: 1841 + ctx->flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS; 1842 + return 0; 1842 1843 } 1843 1844 return -EINVAL; 1844 1845 } ··· 1853 1848 cgrp_dfl_root.flags |= CGRP_ROOT_NS_DELEGATE; 1854 1849 else 1855 1850 cgrp_dfl_root.flags &= ~CGRP_ROOT_NS_DELEGATE; 1851 + 1852 + if (root_flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS) 1853 + cgrp_dfl_root.flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS; 1854 + else 1855 + cgrp_dfl_root.flags &= ~CGRP_ROOT_MEMORY_LOCAL_EVENTS; 1856 1856 } 1857 1857 } 1858 1858 ··· 1865 1855 { 1866 1856 if (cgrp_dfl_root.flags & CGRP_ROOT_NS_DELEGATE) 1867 1857 seq_puts(seq, ",nsdelegate"); 1858 + if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS) 1859 + seq_puts(seq, ",memory_localevents"); 1868 1860 return 0; 1869 1861 } 1870 1862 ··· 6337 6325 static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr, 6338 6326 char *buf) 6339 6327 { 6340 - return snprintf(buf, PAGE_SIZE, "nsdelegate\n"); 6328 + return snprintf(buf, PAGE_SIZE, "nsdelegate\nmemory_localevents\n"); 6341 6329 } 6342 6330 static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features); 6343 6331
+1 -1
kernel/fork.c
··· 123 123 unsigned long total_forks; /* Handle normal Linux uptimes. */ 124 124 int nr_threads; /* The idle threads do not count.. */ 125 125 126 - int max_threads; /* tunable limit on nr_threads */ 126 + static int max_threads; /* tunable limit on nr_threads */ 127 127 128 128 DEFINE_PER_CPU(unsigned long, process_counts) = 0; 129 129
+2
kernel/signal.c
··· 2485 2485 if (signal_group_exit(signal)) { 2486 2486 ksig->info.si_signo = signr = SIGKILL; 2487 2487 sigdelset(&current->pending.signal, SIGKILL); 2488 + trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO, 2489 + &sighand->action[SIGKILL - 1]); 2488 2490 recalc_sigpending(); 2489 2491 goto fatal; 2490 2492 }
+34 -28
kernel/sys.c
··· 1882 1882 } 1883 1883 1884 1884 /* 1885 + * Check arithmetic relations of passed addresses. 1886 + * 1885 1887 * WARNING: we don't require any capability here so be very careful 1886 1888 * in what is allowed for modification from userspace. 1887 1889 */ 1888 - static int validate_prctl_map(struct prctl_mm_map *prctl_map) 1890 + static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map) 1889 1891 { 1890 1892 unsigned long mmap_max_addr = TASK_SIZE; 1891 - struct mm_struct *mm = current->mm; 1892 1893 int error = -EINVAL, i; 1893 1894 1894 1895 static const unsigned char offsets[] = { ··· 1950 1949 prctl_map->start_data)) 1951 1950 goto out; 1952 1951 1953 - /* 1954 - * Someone is trying to cheat the auxv vector. 1955 - */ 1956 - if (prctl_map->auxv_size) { 1957 - if (!prctl_map->auxv || prctl_map->auxv_size > sizeof(mm->saved_auxv)) 1958 - goto out; 1959 - } 1960 - 1961 - /* 1962 - * Finally, make sure the caller has the rights to 1963 - * change /proc/pid/exe link: only local sys admin should 1964 - * be allowed to. 1965 - */ 1966 - if (prctl_map->exe_fd != (u32)-1) { 1967 - if (!ns_capable(current_user_ns(), CAP_SYS_ADMIN)) 1968 - goto out; 1969 - } 1970 - 1971 1952 error = 0; 1972 1953 out: 1973 1954 return error; ··· 1976 1993 if (copy_from_user(&prctl_map, addr, sizeof(prctl_map))) 1977 1994 return -EFAULT; 1978 1995 1979 - error = validate_prctl_map(&prctl_map); 1996 + error = validate_prctl_map_addr(&prctl_map); 1980 1997 if (error) 1981 1998 return error; 1982 1999 1983 2000 if (prctl_map.auxv_size) { 2001 + /* 2002 + * Someone is trying to cheat the auxv vector. 2003 + */ 2004 + if (!prctl_map.auxv || 2005 + prctl_map.auxv_size > sizeof(mm->saved_auxv)) 2006 + return -EINVAL; 2007 + 1984 2008 memset(user_auxv, 0, sizeof(user_auxv)); 1985 2009 if (copy_from_user(user_auxv, 1986 2010 (const void __user *)prctl_map.auxv, ··· 2000 2010 } 2001 2011 2002 2012 if (prctl_map.exe_fd != (u32)-1) { 2013 + /* 2014 + * Make sure the caller has the rights to 2015 + * change /proc/pid/exe link: only local sys admin should 2016 + * be allowed to. 2017 + */ 2018 + if (!ns_capable(current_user_ns(), CAP_SYS_ADMIN)) 2019 + return -EINVAL; 2020 + 2003 2021 error = prctl_set_mm_exe_file(mm, prctl_map.exe_fd); 2004 2022 if (error) 2005 2023 return error; ··· 2095 2097 unsigned long arg4, unsigned long arg5) 2096 2098 { 2097 2099 struct mm_struct *mm = current->mm; 2098 - struct prctl_mm_map prctl_map; 2100 + struct prctl_mm_map prctl_map = { 2101 + .auxv = NULL, 2102 + .auxv_size = 0, 2103 + .exe_fd = -1, 2104 + }; 2099 2105 struct vm_area_struct *vma; 2100 2106 int error; 2101 2107 ··· 2127 2125 2128 2126 error = -EINVAL; 2129 2127 2130 - down_write(&mm->mmap_sem); 2128 + /* 2129 + * arg_lock protects concurent updates of arg boundaries, we need 2130 + * mmap_sem for a) concurrent sys_brk, b) finding VMA for addr 2131 + * validation. 2132 + */ 2133 + down_read(&mm->mmap_sem); 2131 2134 vma = find_vma(mm, addr); 2132 2135 2136 + spin_lock(&mm->arg_lock); 2133 2137 prctl_map.start_code = mm->start_code; 2134 2138 prctl_map.end_code = mm->end_code; 2135 2139 prctl_map.start_data = mm->start_data; ··· 2147 2139 prctl_map.arg_end = mm->arg_end; 2148 2140 prctl_map.env_start = mm->env_start; 2149 2141 prctl_map.env_end = mm->env_end; 2150 - prctl_map.auxv = NULL; 2151 - prctl_map.auxv_size = 0; 2152 - prctl_map.exe_fd = -1; 2153 2142 2154 2143 switch (opt) { 2155 2144 case PR_SET_MM_START_CODE: ··· 2186 2181 goto out; 2187 2182 } 2188 2183 2189 - error = validate_prctl_map(&prctl_map); 2184 + error = validate_prctl_map_addr(&prctl_map); 2190 2185 if (error) 2191 2186 goto out; 2192 2187 ··· 2223 2218 2224 2219 error = 0; 2225 2220 out: 2226 - up_write(&mm->mmap_sem); 2221 + spin_unlock(&mm->arg_lock); 2222 + up_read(&mm->mmap_sem); 2227 2223 return error; 2228 2224 } 2229 2225
+9 -6
lib/sort.c
··· 43 43 44 44 /** 45 45 * swap_words_32 - swap two elements in 32-bit chunks 46 - * @a, @b: pointers to the elements 47 - * @size: element size (must be a multiple of 4) 46 + * @a: pointer to the first element to swap 47 + * @b: pointer to the second element to swap 48 + * @n: element size (must be a multiple of 4) 48 49 * 49 50 * Exchange the two objects in memory. This exploits base+index addressing, 50 51 * which basically all CPUs have, to minimize loop overhead computations. ··· 66 65 67 66 /** 68 67 * swap_words_64 - swap two elements in 64-bit chunks 69 - * @a, @b: pointers to the elements 70 - * @size: element size (must be a multiple of 8) 68 + * @a: pointer to the first element to swap 69 + * @b: pointer to the second element to swap 70 + * @n: element size (must be a multiple of 8) 71 71 * 72 72 * Exchange the two objects in memory. This exploits base+index 73 73 * addressing, which basically all CPUs have, to minimize loop overhead ··· 102 100 103 101 /** 104 102 * swap_bytes - swap two elements a byte at a time 105 - * @a, @b: pointers to the elements 106 - * @size: element size 103 + * @a: pointer to the first element to swap 104 + * @b: pointer to the second element to swap 105 + * @n: element size 107 106 * 108 107 * This is the fallback if alignment doesn't allow using larger chunks. 109 108 */
+1 -1
mm/compaction.c
··· 1399 1399 page = pfn_to_page(highest); 1400 1400 cc->free_pfn = highest; 1401 1401 } else { 1402 - if (cc->direct_compaction) { 1402 + if (cc->direct_compaction && pfn_valid(min_pfn)) { 1403 1403 page = pfn_to_page(min_pfn); 1404 1404 cc->free_pfn = min_pfn; 1405 1405 }
+8 -7
mm/gup.c
··· 1042 1042 BUG_ON(ret >= nr_pages); 1043 1043 } 1044 1044 1045 - if (!pages) 1046 - /* If it's a prefault don't insist harder */ 1047 - return ret; 1048 - 1049 1045 if (ret > 0) { 1050 1046 nr_pages -= ret; 1051 1047 pages_done += ret; ··· 1057 1061 pages_done = ret; 1058 1062 break; 1059 1063 } 1060 - /* VM_FAULT_RETRY triggered, so seek to the faulting offset */ 1061 - pages += ret; 1064 + /* 1065 + * VM_FAULT_RETRY triggered, so seek to the faulting offset. 1066 + * For the prefault case (!pages) we only update counts. 1067 + */ 1068 + if (likely(pages)) 1069 + pages += ret; 1062 1070 start += ret << PAGE_SHIFT; 1063 1071 1064 1072 /* ··· 1085 1085 pages_done++; 1086 1086 if (!nr_pages) 1087 1087 break; 1088 - pages++; 1088 + if (likely(pages)) 1089 + pages++; 1089 1090 start += PAGE_SIZE; 1090 1091 } 1091 1092 if (lock_dropped && *locked) {
+1 -1
mm/kasan/common.c
··· 464 464 { 465 465 unsigned long redzone_start; 466 466 unsigned long redzone_end; 467 - u8 tag; 467 + u8 tag = 0xff; 468 468 469 469 if (gfpflags_allow_blocking(flags)) 470 470 quarantine_reduce();
+3 -5
mm/list_lru.c
··· 38 38 39 39 static inline bool list_lru_memcg_aware(struct list_lru *lru) 40 40 { 41 - /* 42 - * This needs node 0 to be always present, even 43 - * in the systems supporting sparse numa ids. 44 - */ 45 - return !!lru->node[0].memcg_lrus; 41 + return lru->memcg_aware; 46 42 } 47 43 48 44 static inline struct list_lru_one * ··· 447 451 static int memcg_init_list_lru(struct list_lru *lru, bool memcg_aware) 448 452 { 449 453 int i; 454 + 455 + lru->memcg_aware = memcg_aware; 450 456 451 457 if (!memcg_aware) 452 458 return 0;
+2 -2
mm/util.c
··· 718 718 if (!mm->arg_end) 719 719 goto out_mm; /* Shh! No looking before we're done */ 720 720 721 - down_read(&mm->mmap_sem); 721 + spin_lock(&mm->arg_lock); 722 722 arg_start = mm->arg_start; 723 723 arg_end = mm->arg_end; 724 724 env_start = mm->env_start; 725 725 env_end = mm->env_end; 726 - up_read(&mm->mmap_sem); 726 + spin_unlock(&mm->arg_lock); 727 727 728 728 len = arg_end - arg_start; 729 729
+1 -1
mm/vmalloc.c
··· 815 815 } 816 816 817 817 /* 818 - * OK. We roll back and find the fist right sub-tree, 818 + * OK. We roll back and find the first right sub-tree, 819 819 * that will satisfy the search criteria. It can happen 820 820 * only once due to "vstart" restriction. 821 821 */
+6 -5
mm/z3fold.c
··· 190 190 191 191 static void compact_page_work(struct work_struct *w); 192 192 193 - static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool) 193 + static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool, 194 + gfp_t gfp) 194 195 { 195 196 struct z3fold_buddy_slots *slots = kmem_cache_alloc(pool->c_handle, 196 - GFP_KERNEL); 197 + gfp); 197 198 198 199 if (slots) { 199 200 memset(slots->slot, 0, sizeof(slots->slot)); ··· 296 295 297 296 /* Initializes the z3fold header of a newly allocated z3fold page */ 298 297 static struct z3fold_header *init_z3fold_page(struct page *page, 299 - struct z3fold_pool *pool) 298 + struct z3fold_pool *pool, gfp_t gfp) 300 299 { 301 300 struct z3fold_header *zhdr = page_address(page); 302 - struct z3fold_buddy_slots *slots = alloc_slots(pool); 301 + struct z3fold_buddy_slots *slots = alloc_slots(pool, gfp); 303 302 304 303 if (!slots) 305 304 return NULL; ··· 913 912 if (!page) 914 913 return -ENOMEM; 915 914 916 - zhdr = init_z3fold_page(page, pool); 915 + zhdr = init_z3fold_page(page, pool, gfp); 917 916 if (!zhdr) { 918 917 __free_page(page); 919 918 return -ENOMEM;
+2 -1
scripts/gdb/linux/constants.py.in
··· 40 40 import gdb 41 41 42 42 /* linux/clk-provider.h */ 43 - LX_GDBPARSED(CLK_GET_RATE_NOCACHE) 43 + if IS_BUILTIN(CONFIG_COMMON_CLK): 44 + LX_GDBPARSED(CLK_GET_RATE_NOCACHE) 44 45 45 46 /* linux/fs.h */ 46 47 LX_VALUE(SB_RDONLY)
+4 -3
scripts/spdxcheck.py
··· 32 32 def read_spdxdata(repo): 33 33 34 34 # The subdirectories of LICENSES in the kernel source 35 - license_dirs = [ "preferred", "deprecated", "exceptions", "dual" ] 35 + # Note: exceptions needs to be parsed as last directory. 36 + license_dirs = [ "preferred", "dual", "deprecated", "exceptions" ] 36 37 lictree = repo.head.commit.tree['LICENSES'] 37 38 38 39 spdx = SPDXdata() ··· 59 58 elif l.startswith('SPDX-Licenses:'): 60 59 for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','): 61 60 if not lic in spdx.licenses: 62 - raise SPDXException(None, 'Exception %s missing license %s' %(ex, lic)) 61 + raise SPDXException(None, 'Exception %s missing license %s' %(exception, lic)) 63 62 spdx.exceptions[exception].append(lic) 64 63 65 64 elif l.startswith("License-Text:"): 66 65 if exception: 67 66 if not len(spdx.exceptions[exception]): 68 - raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %excid) 67 + raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %exception) 69 68 spdx.exception_files += 1 70 69 else: 71 70 spdx.license_files += 1