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

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
linux/kernel.h: fix overflow for DIV_ROUND_UP_ULL
mm, swap: fix THP swap out
fork,memcg: alloc_thread_stack_node needs to set tsk->stack
MAINTAINERS: add CLANG/LLVM BUILD SUPPORT info
mm/vmalloc.c: avoid bogus -Wmaybe-uninitialized warning
mm/page_idle.c: fix oops because end_pfn is larger than max_pfn
initramfs: fix populate_initrd_image() section mismatch
mm/oom_kill.c: fix uninitialized oc->constraint
mm: hugetlb: soft-offline: dissolve_free_huge_page() return zero on !PageHuge
mm: soft-offline: return -EBUSY if set_hwpoison_free_buddy_page() fails
signal: remove the wrong signal_pending() check in restore_user_sigmask()
fs/binfmt_flat.c: make load_flat_shared_library() work
mm/mempolicy.c: fix an incorrect rebind node in mpol_rebind_nodemask
fs/proc/array.c: allow reporting eip/esp for all coredumping threads
mm/dev_pfn: exclude MEMORY_DEVICE_PRIVATE while computing virtual address

+97 -80
+8
MAINTAINERS
··· 3942 3942 S: Maintained 3943 3943 F: .clang-format 3944 3944 3945 + CLANG/LLVM BUILD SUPPORT 3946 + L: clang-built-linux@googlegroups.com 3947 + W: https://clangbuiltlinux.github.io/ 3948 + B: https://github.com/ClangBuiltLinux/linux/issues 3949 + C: irc://chat.freenode.net/clangbuiltlinux 3950 + S: Supported 3951 + K: \b(?i:clang|llvm)\b 3952 + 3945 3953 CLEANCACHE API 3946 3954 M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 3947 3955 L: linux-kernel@vger.kernel.org
+20 -8
fs/aio.c
··· 2095 2095 struct __aio_sigset ksig = { NULL, }; 2096 2096 sigset_t ksigmask, sigsaved; 2097 2097 struct timespec64 ts; 2098 + bool interrupted; 2098 2099 int ret; 2099 2100 2100 2101 if (timeout && unlikely(get_timespec64(&ts, timeout))) ··· 2109 2108 return ret; 2110 2109 2111 2110 ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); 2112 - restore_user_sigmask(ksig.sigmask, &sigsaved); 2113 - if (signal_pending(current) && !ret) 2111 + 2112 + interrupted = signal_pending(current); 2113 + restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); 2114 + if (interrupted && !ret) 2114 2115 ret = -ERESTARTNOHAND; 2115 2116 2116 2117 return ret; ··· 2131 2128 struct __aio_sigset ksig = { NULL, }; 2132 2129 sigset_t ksigmask, sigsaved; 2133 2130 struct timespec64 ts; 2131 + bool interrupted; 2134 2132 int ret; 2135 2133 2136 2134 if (timeout && unlikely(get_old_timespec32(&ts, timeout))) ··· 2146 2142 return ret; 2147 2143 2148 2144 ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); 2149 - restore_user_sigmask(ksig.sigmask, &sigsaved); 2150 - if (signal_pending(current) && !ret) 2145 + 2146 + interrupted = signal_pending(current); 2147 + restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); 2148 + if (interrupted && !ret) 2151 2149 ret = -ERESTARTNOHAND; 2152 2150 2153 2151 return ret; ··· 2199 2193 struct __compat_aio_sigset ksig = { NULL, }; 2200 2194 sigset_t ksigmask, sigsaved; 2201 2195 struct timespec64 t; 2196 + bool interrupted; 2202 2197 int ret; 2203 2198 2204 2199 if (timeout && get_old_timespec32(&t, timeout)) ··· 2213 2206 return ret; 2214 2207 2215 2208 ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); 2216 - restore_user_sigmask(ksig.sigmask, &sigsaved); 2217 - if (signal_pending(current) && !ret) 2209 + 2210 + interrupted = signal_pending(current); 2211 + restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); 2212 + if (interrupted && !ret) 2218 2213 ret = -ERESTARTNOHAND; 2219 2214 2220 2215 return ret; ··· 2235 2226 struct __compat_aio_sigset ksig = { NULL, }; 2236 2227 sigset_t ksigmask, sigsaved; 2237 2228 struct timespec64 t; 2229 + bool interrupted; 2238 2230 int ret; 2239 2231 2240 2232 if (timeout && get_timespec64(&t, timeout)) ··· 2249 2239 return ret; 2250 2240 2251 2241 ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); 2252 - restore_user_sigmask(ksig.sigmask, &sigsaved); 2253 - if (signal_pending(current) && !ret) 2242 + 2243 + interrupted = signal_pending(current); 2244 + restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); 2245 + if (interrupted && !ret) 2254 2246 ret = -ERESTARTNOHAND; 2255 2247 2256 2248 return ret;
+7 -16
fs/binfmt_flat.c
··· 856 856 857 857 static int load_flat_shared_library(int id, struct lib_info *libs) 858 858 { 859 + /* 860 + * This is a fake bprm struct; only the members "buf", "file" and 861 + * "filename" are actually used. 862 + */ 859 863 struct linux_binprm bprm; 860 864 int res; 861 865 char buf[16]; 866 + loff_t pos = 0; 862 867 863 868 memset(&bprm, 0, sizeof(bprm)); 864 869 ··· 877 872 if (IS_ERR(bprm.file)) 878 873 return res; 879 874 880 - bprm.cred = prepare_exec_creds(); 881 - res = -ENOMEM; 882 - if (!bprm.cred) 883 - goto out; 875 + res = kernel_read(bprm.file, bprm.buf, BINPRM_BUF_SIZE, &pos); 884 876 885 - /* We don't really care about recalculating credentials at this point 886 - * as we're past the point of no return and are dealing with shared 887 - * libraries. 888 - */ 889 - bprm.called_set_creds = 1; 890 - 891 - res = prepare_binprm(&bprm); 892 - 893 - if (!res) 877 + if (res >= 0) 894 878 res = load_flat_file(&bprm, libs, id, NULL); 895 879 896 - abort_creds(bprm.cred); 897 - 898 - out: 899 880 allow_write_access(bprm.file); 900 881 fput(bprm.file); 901 882
+2 -2
fs/eventpoll.c
··· 2325 2325 2326 2326 error = do_epoll_wait(epfd, events, maxevents, timeout); 2327 2327 2328 - restore_user_sigmask(sigmask, &sigsaved); 2328 + restore_user_sigmask(sigmask, &sigsaved, error == -EINTR); 2329 2329 2330 2330 return error; 2331 2331 } ··· 2350 2350 2351 2351 err = do_epoll_wait(epfd, events, maxevents, timeout); 2352 2352 2353 - restore_user_sigmask(sigmask, &sigsaved); 2353 + restore_user_sigmask(sigmask, &sigsaved, err == -EINTR); 2354 2354 2355 2355 return err; 2356 2356 }
+4 -3
fs/io_uring.c
··· 2200 2200 } 2201 2201 2202 2202 ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events); 2203 - if (ret == -ERESTARTSYS) 2204 - ret = -EINTR; 2205 2203 2206 2204 if (sig) 2207 - restore_user_sigmask(sig, &sigsaved); 2205 + restore_user_sigmask(sig, &sigsaved, ret == -ERESTARTSYS); 2206 + 2207 + if (ret == -ERESTARTSYS) 2208 + ret = -EINTR; 2208 2209 2209 2210 return READ_ONCE(ring->r.head) == READ_ONCE(ring->r.tail) ? ret : 0; 2210 2211 }
+1 -1
fs/proc/array.c
··· 462 462 * a program is not able to use ptrace(2) in that case. It is 463 463 * safe because the task has stopped executing permanently. 464 464 */ 465 - if (permitted && (task->flags & PF_DUMPCORE)) { 465 + if (permitted && (task->flags & (PF_EXITING|PF_DUMPCORE))) { 466 466 if (try_get_task_stack(task)) { 467 467 eip = KSTK_EIP(task); 468 468 esp = KSTK_ESP(task);
+6 -12
fs/select.c
··· 758 758 return ret; 759 759 760 760 ret = core_sys_select(n, inp, outp, exp, to); 761 + restore_user_sigmask(sigmask, &sigsaved, ret == -ERESTARTNOHAND); 761 762 ret = poll_select_copy_remaining(&end_time, tsp, type, ret); 762 - 763 - restore_user_sigmask(sigmask, &sigsaved); 764 763 765 764 return ret; 766 765 } ··· 1105 1106 1106 1107 ret = do_sys_poll(ufds, nfds, to); 1107 1108 1108 - restore_user_sigmask(sigmask, &sigsaved); 1109 - 1109 + restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); 1110 1110 /* We can restart this syscall, usually */ 1111 1111 if (ret == -EINTR) 1112 1112 ret = -ERESTARTNOHAND; ··· 1140 1142 1141 1143 ret = do_sys_poll(ufds, nfds, to); 1142 1144 1143 - restore_user_sigmask(sigmask, &sigsaved); 1144 - 1145 + restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); 1145 1146 /* We can restart this syscall, usually */ 1146 1147 if (ret == -EINTR) 1147 1148 ret = -ERESTARTNOHAND; ··· 1347 1350 return ret; 1348 1351 1349 1352 ret = compat_core_sys_select(n, inp, outp, exp, to); 1353 + restore_user_sigmask(sigmask, &sigsaved, ret == -ERESTARTNOHAND); 1350 1354 ret = poll_select_copy_remaining(&end_time, tsp, type, ret); 1351 - 1352 - restore_user_sigmask(sigmask, &sigsaved); 1353 1355 1354 1356 return ret; 1355 1357 } ··· 1421 1425 1422 1426 ret = do_sys_poll(ufds, nfds, to); 1423 1427 1424 - restore_user_sigmask(sigmask, &sigsaved); 1425 - 1428 + restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); 1426 1429 /* We can restart this syscall, usually */ 1427 1430 if (ret == -EINTR) 1428 1431 ret = -ERESTARTNOHAND; ··· 1456 1461 1457 1462 ret = do_sys_poll(ufds, nfds, to); 1458 1463 1459 - restore_user_sigmask(sigmask, &sigsaved); 1460 - 1464 + restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); 1461 1465 /* We can restart this syscall, usually */ 1462 1466 if (ret == -EINTR) 1463 1467 ret = -ERESTARTNOHAND;
+2 -1
include/linux/kernel.h
··· 93 93 #define DIV_ROUND_DOWN_ULL(ll, d) \ 94 94 ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; }) 95 95 96 - #define DIV_ROUND_UP_ULL(ll, d) DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d)) 96 + #define DIV_ROUND_UP_ULL(ll, d) \ 97 + DIV_ROUND_DOWN_ULL((unsigned long long)(ll) + (d) - 1, (d)) 97 98 98 99 #if BITS_PER_LONG == 32 99 100 # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
+1 -1
include/linux/pfn_t.h
··· 68 68 69 69 static inline void *pfn_t_to_virt(pfn_t pfn) 70 70 { 71 - if (pfn_t_has_page(pfn)) 71 + if (pfn_t_has_page(pfn) && !is_device_private_page(pfn_t_to_page(pfn))) 72 72 return __va(pfn_t_to_phys(pfn)); 73 73 return NULL; 74 74 }
+1 -1
include/linux/signal.h
··· 276 276 extern int set_user_sigmask(const sigset_t __user *usigmask, sigset_t *set, 277 277 sigset_t *oldset, size_t sigsetsize); 278 278 extern void restore_user_sigmask(const void __user *usigmask, 279 - sigset_t *sigsaved); 279 + sigset_t *sigsaved, bool interrupted); 280 280 extern void set_current_blocked(sigset_t *); 281 281 extern void __set_current_blocked(const sigset_t *); 282 282 extern int show_unhandled_signals;
+2 -2
init/initramfs.c
··· 617 617 #endif /* CONFIG_BLK_DEV_RAM */ 618 618 619 619 #ifdef CONFIG_BLK_DEV_RAM 620 - static void populate_initrd_image(char *err) 620 + static void __init populate_initrd_image(char *err) 621 621 { 622 622 ssize_t written; 623 623 int fd; ··· 637 637 ksys_close(fd); 638 638 } 639 639 #else 640 - static void populate_initrd_image(char *err) 640 + static void __init populate_initrd_image(char *err) 641 641 { 642 642 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); 643 643 }
+5 -1
kernel/fork.c
··· 248 248 struct page *page = alloc_pages_node(node, THREADINFO_GFP, 249 249 THREAD_SIZE_ORDER); 250 250 251 - return page ? page_address(page) : NULL; 251 + if (likely(page)) { 252 + tsk->stack = page_address(page); 253 + return tsk->stack; 254 + } 255 + return NULL; 252 256 #endif 253 257 } 254 258
+3 -2
kernel/signal.c
··· 2912 2912 * This is useful for syscalls such as ppoll, pselect, io_pgetevents and 2913 2913 * epoll_pwait where a new sigmask is passed in from userland for the syscalls. 2914 2914 */ 2915 - void restore_user_sigmask(const void __user *usigmask, sigset_t *sigsaved) 2915 + void restore_user_sigmask(const void __user *usigmask, sigset_t *sigsaved, 2916 + bool interrupted) 2916 2917 { 2917 2918 2918 2919 if (!usigmask) ··· 2923 2922 * Restoring sigmask here can lead to delivering signals that the above 2924 2923 * syscalls are intended to block because of the sigmask passed in. 2925 2924 */ 2926 - if (signal_pending(current)) { 2925 + if (interrupted) { 2927 2926 current->saved_sigmask = *sigsaved; 2928 2927 set_restore_sigmask(); 2929 2928 return;
+20 -9
mm/hugetlb.c
··· 1510 1510 1511 1511 /* 1512 1512 * Dissolve a given free hugepage into free buddy pages. This function does 1513 - * nothing for in-use (including surplus) hugepages. Returns -EBUSY if the 1514 - * dissolution fails because a give page is not a free hugepage, or because 1515 - * free hugepages are fully reserved. 1513 + * nothing for in-use hugepages and non-hugepages. 1514 + * This function returns values like below: 1515 + * 1516 + * -EBUSY: failed to dissolved free hugepages or the hugepage is in-use 1517 + * (allocated or reserved.) 1518 + * 0: successfully dissolved free hugepages or the page is not a 1519 + * hugepage (considered as already dissolved) 1516 1520 */ 1517 1521 int dissolve_free_huge_page(struct page *page) 1518 1522 { 1519 1523 int rc = -EBUSY; 1520 1524 1525 + /* Not to disrupt normal path by vainly holding hugetlb_lock */ 1526 + if (!PageHuge(page)) 1527 + return 0; 1528 + 1521 1529 spin_lock(&hugetlb_lock); 1522 - if (PageHuge(page) && !page_count(page)) { 1530 + if (!PageHuge(page)) { 1531 + rc = 0; 1532 + goto out; 1533 + } 1534 + 1535 + if (!page_count(page)) { 1523 1536 struct page *head = compound_head(page); 1524 1537 struct hstate *h = page_hstate(head); 1525 1538 int nid = page_to_nid(head); ··· 1577 1564 1578 1565 for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << minimum_order) { 1579 1566 page = pfn_to_page(pfn); 1580 - if (PageHuge(page) && !page_count(page)) { 1581 - rc = dissolve_free_huge_page(page); 1582 - if (rc) 1583 - break; 1584 - } 1567 + rc = dissolve_free_huge_page(page); 1568 + if (rc) 1569 + break; 1585 1570 } 1586 1571 1587 1572 return rc;
+3 -4
mm/memory-failure.c
··· 1730 1730 if (!ret) { 1731 1731 if (set_hwpoison_free_buddy_page(page)) 1732 1732 num_poisoned_pages_inc(); 1733 + else 1734 + ret = -EBUSY; 1733 1735 } 1734 1736 } 1735 1737 return ret; ··· 1856 1854 1857 1855 static int soft_offline_free_page(struct page *page) 1858 1856 { 1859 - int rc = 0; 1860 - struct page *head = compound_head(page); 1857 + int rc = dissolve_free_huge_page(page); 1861 1858 1862 - if (PageHuge(head)) 1863 - rc = dissolve_free_huge_page(page); 1864 1859 if (!rc) { 1865 1860 if (set_hwpoison_free_buddy_page(page)) 1866 1861 num_poisoned_pages_inc();
+1 -1
mm/mempolicy.c
··· 306 306 else { 307 307 nodes_remap(tmp, pol->v.nodes,pol->w.cpuset_mems_allowed, 308 308 *nodes); 309 - pol->w.cpuset_mems_allowed = tmp; 309 + pol->w.cpuset_mems_allowed = *nodes; 310 310 } 311 311 312 312 if (nodes_empty(tmp))
+5 -7
mm/oom_kill.c
··· 987 987 /* 988 988 * Determines whether the kernel must panic because of the panic_on_oom sysctl. 989 989 */ 990 - static void check_panic_on_oom(struct oom_control *oc, 991 - enum oom_constraint constraint) 990 + static void check_panic_on_oom(struct oom_control *oc) 992 991 { 993 992 if (likely(!sysctl_panic_on_oom)) 994 993 return; ··· 997 998 * does not panic for cpuset, mempolicy, or memcg allocation 998 999 * failures. 999 1000 */ 1000 - if (constraint != CONSTRAINT_NONE) 1001 + if (oc->constraint != CONSTRAINT_NONE) 1001 1002 return; 1002 1003 } 1003 1004 /* Do not panic for oom kills triggered by sysrq */ ··· 1034 1035 bool out_of_memory(struct oom_control *oc) 1035 1036 { 1036 1037 unsigned long freed = 0; 1037 - enum oom_constraint constraint = CONSTRAINT_NONE; 1038 1038 1039 1039 if (oom_killer_disabled) 1040 1040 return false; ··· 1069 1071 * Check if there were limitations on the allocation (only relevant for 1070 1072 * NUMA and memcg) that may require different handling. 1071 1073 */ 1072 - constraint = constrained_alloc(oc); 1073 - if (constraint != CONSTRAINT_MEMORY_POLICY) 1074 + oc->constraint = constrained_alloc(oc); 1075 + if (oc->constraint != CONSTRAINT_MEMORY_POLICY) 1074 1076 oc->nodemask = NULL; 1075 - check_panic_on_oom(oc, constraint); 1077 + check_panic_on_oom(oc); 1076 1078 1077 1079 if (!is_memcg_oom(oc) && sysctl_oom_kill_allocating_task && 1078 1080 current->mm && !oom_unkillable_task(current, NULL, oc->nodemask) &&
+2 -2
mm/page_idle.c
··· 136 136 137 137 end_pfn = pfn + count * BITS_PER_BYTE; 138 138 if (end_pfn > max_pfn) 139 - end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS); 139 + end_pfn = max_pfn; 140 140 141 141 for (; pfn < end_pfn; pfn++) { 142 142 bit = pfn % BITMAP_CHUNK_BITS; ··· 181 181 182 182 end_pfn = pfn + count * BITS_PER_BYTE; 183 183 if (end_pfn > max_pfn) 184 - end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS); 184 + end_pfn = max_pfn; 185 185 186 186 for (; pfn < end_pfn; pfn++) { 187 187 bit = pfn % BITMAP_CHUNK_BITS;
+2 -5
mm/page_io.c
··· 29 29 static struct bio *get_swap_bio(gfp_t gfp_flags, 30 30 struct page *page, bio_end_io_t end_io) 31 31 { 32 - int i, nr = hpage_nr_pages(page); 33 32 struct bio *bio; 34 33 35 - bio = bio_alloc(gfp_flags, nr); 34 + bio = bio_alloc(gfp_flags, 1); 36 35 if (bio) { 37 36 struct block_device *bdev; 38 37 ··· 40 41 bio->bi_iter.bi_sector <<= PAGE_SHIFT - 9; 41 42 bio->bi_end_io = end_io; 42 43 43 - for (i = 0; i < nr; i++) 44 - bio_add_page(bio, page + i, PAGE_SIZE, 0); 45 - VM_BUG_ON(bio->bi_iter.bi_size != PAGE_SIZE * nr); 44 + bio_add_page(bio, page, PAGE_SIZE * hpage_nr_pages(page), 0); 46 45 } 47 46 return bio; 48 47 }
+2 -2
mm/vmalloc.c
··· 913 913 unsigned long nva_start_addr, unsigned long size, 914 914 enum fit_type type) 915 915 { 916 - struct vmap_area *lva; 916 + struct vmap_area *lva = NULL; 917 917 918 918 if (type == FL_FIT_TYPE) { 919 919 /* ··· 972 972 if (type != FL_FIT_TYPE) { 973 973 augment_tree_propagate_from(va); 974 974 975 - if (type == NE_FIT_TYPE) 975 + if (lva) /* type == NE_FIT_TYPE */ 976 976 insert_vmap_area_augment(lva, &va->rb_node, 977 977 &free_vmap_area_root, &free_vmap_area_list); 978 978 }