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 tag 'mm-hotfixes-stable-2024-04-05-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
"8 hotfixes, 3 are cc:stable

There are a couple of fixups for this cycle's vmalloc changes and one
for the stackdepot changes. And a fix for a very old x86 PAT issue
which can cause a warning splat"

* tag 'mm-hotfixes-stable-2024-04-05-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
stackdepot: rename pool_index to pool_index_plus_1
x86/mm/pat: fix VM_PAT handling in COW mappings
MAINTAINERS: change vmware.com addresses to broadcom.com
selftests/mm: include strings.h for ffsl
mm: vmalloc: fix lockdep warning
mm: vmalloc: bail out early in find_vmap_area() if vmap is not init
init: open output files from cpio unpacking with O_LARGEFILE
mm/secretmem: fix GUP-fast succeeding on secretmem folios

+121 -75
+5
.mailmap
··· 20 20 Adam Radford <aradford@gmail.com> 21 21 Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com> 22 22 Adrian Bunk <bunk@stusta.de> 23 + Ajay Kaher <ajay.kaher@broadcom.com> <akaher@vmware.com> 23 24 Akhil P Oommen <quic_akhilpo@quicinc.com> <akhilpo@codeaurora.org> 24 25 Alan Cox <alan@lxorguk.ukuu.org.uk> 25 26 Alan Cox <root@hraefn.swansea.linux.org.uk> ··· 37 36 Alexei Starovoitov <ast@kernel.org> <alexei.starovoitov@gmail.com> 38 37 Alexei Starovoitov <ast@kernel.org> <ast@fb.com> 39 38 Alexei Starovoitov <ast@kernel.org> <ast@plumgrid.com> 39 + Alexey Makhalov <alexey.amakhalov@broadcom.com> <amakhalov@vmware.com> 40 40 Alex Hung <alexhung@gmail.com> <alex.hung@canonical.com> 41 41 Alex Shi <alexs@kernel.org> <alex.shi@intel.com> 42 42 Alex Shi <alexs@kernel.org> <alex.shi@linaro.org> ··· 112 110 Brian Avery <b.avery@hp.com> 113 111 Brian King <brking@us.ibm.com> 114 112 Brian Silverman <bsilver16384@gmail.com> <brian.silverman@bluerivertech.com> 113 + Bryan Tan <bryan-bt.tan@broadcom.com> <bryantan@vmware.com> 115 114 Cai Huoqing <cai.huoqing@linux.dev> <caihuoqing@baidu.com> 116 115 Can Guo <quic_cang@quicinc.com> <cang@codeaurora.org> 117 116 Carl Huang <quic_cjhuang@quicinc.com> <cjhuang@codeaurora.org> ··· 532 529 Roman Gushchin <roman.gushchin@linux.dev> <guro@fb.com> 533 530 Roman Gushchin <roman.gushchin@linux.dev> <guroan@gmail.com> 534 531 Roman Gushchin <roman.gushchin@linux.dev> <klamm@yandex-team.ru> 532 + Ronak Doshi <ronak.doshi@broadcom.com> <doshir@vmware.com> 535 533 Muchun Song <muchun.song@linux.dev> <songmuchun@bytedance.com> 536 534 Muchun Song <muchun.song@linux.dev> <smuchun@gmail.com> 537 535 Ross Zwisler <zwisler@kernel.org> <ross.zwisler@linux.intel.com> ··· 655 651 Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> 656 652 Viresh Kumar <viresh.kumar@linaro.org> <viresh.kumar@linaro.org> 657 653 Viresh Kumar <viresh.kumar@linaro.org> <viresh.kumar@linaro.com> 654 + Vishnu Dasa <vishnu.dasa@broadcom.com> <vdasa@vmware.com> 658 655 Vivek Aknurwar <quic_viveka@quicinc.com> <viveka@codeaurora.org> 659 656 Vivien Didelot <vivien.didelot@gmail.com> <vivien.didelot@savoirfairelinux.com> 660 657 Vlad Dogaru <ddvlad@gmail.com> <vlad.dogaru@intel.com>
+23 -22
MAINTAINERS
··· 16733 16733 16734 16734 PARAVIRT_OPS INTERFACE 16735 16735 M: Juergen Gross <jgross@suse.com> 16736 - R: Ajay Kaher <akaher@vmware.com> 16737 - R: Alexey Makhalov <amakhalov@vmware.com> 16738 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 16736 + R: Ajay Kaher <ajay.kaher@broadcom.com> 16737 + R: Alexey Makhalov <alexey.amakhalov@broadcom.com> 16738 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 16739 16739 L: virtualization@lists.linux.dev 16740 16740 L: x86@kernel.org 16741 16741 S: Supported ··· 23654 23654 F: drivers/misc/vmw_balloon.c 23655 23655 23656 23656 VMWARE HYPERVISOR INTERFACE 23657 - M: Ajay Kaher <akaher@vmware.com> 23658 - M: Alexey Makhalov <amakhalov@vmware.com> 23659 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23657 + M: Ajay Kaher <ajay.kaher@broadcom.com> 23658 + M: Alexey Makhalov <alexey.amakhalov@broadcom.com> 23659 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23660 23660 L: virtualization@lists.linux.dev 23661 23661 L: x86@kernel.org 23662 23662 S: Supported ··· 23665 23665 F: arch/x86/kernel/cpu/vmware.c 23666 23666 23667 23667 VMWARE PVRDMA DRIVER 23668 - M: Bryan Tan <bryantan@vmware.com> 23669 - M: Vishnu Dasa <vdasa@vmware.com> 23670 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23668 + M: Bryan Tan <bryan-bt.tan@broadcom.com> 23669 + M: Vishnu Dasa <vishnu.dasa@broadcom.com> 23670 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23671 23671 L: linux-rdma@vger.kernel.org 23672 23672 S: Supported 23673 23673 F: drivers/infiniband/hw/vmw_pvrdma/ 23674 23674 23675 23675 VMWARE PVSCSI DRIVER 23676 - M: Vishal Bhakta <vbhakta@vmware.com> 23677 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23676 + M: Vishal Bhakta <vishal.bhakta@broadcom.com> 23677 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23678 23678 L: linux-scsi@vger.kernel.org 23679 23679 S: Supported 23680 23680 F: drivers/scsi/vmw_pvscsi.c 23681 23681 F: drivers/scsi/vmw_pvscsi.h 23682 23682 23683 23683 VMWARE VIRTUAL PTP CLOCK DRIVER 23684 - R: Ajay Kaher <akaher@vmware.com> 23685 - R: Alexey Makhalov <amakhalov@vmware.com> 23686 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23684 + M: Nick Shi <nick.shi@broadcom.com> 23685 + R: Ajay Kaher <ajay.kaher@broadcom.com> 23686 + R: Alexey Makhalov <alexey.amakhalov@broadcom.com> 23687 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23687 23688 L: netdev@vger.kernel.org 23688 23689 S: Supported 23689 23690 F: drivers/ptp/ptp_vmw.c 23690 23691 23691 23692 VMWARE VMCI DRIVER 23692 - M: Bryan Tan <bryantan@vmware.com> 23693 - M: Vishnu Dasa <vdasa@vmware.com> 23694 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23693 + M: Bryan Tan <bryan-bt.tan@broadcom.com> 23694 + M: Vishnu Dasa <vishnu.dasa@broadcom.com> 23695 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23695 23696 L: linux-kernel@vger.kernel.org 23696 23697 S: Supported 23697 23698 F: drivers/misc/vmw_vmci/ ··· 23707 23706 F: drivers/input/mouse/vmmouse.h 23708 23707 23709 23708 VMWARE VMXNET3 ETHERNET DRIVER 23710 - M: Ronak Doshi <doshir@vmware.com> 23711 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23709 + M: Ronak Doshi <ronak.doshi@broadcom.com> 23710 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23712 23711 L: netdev@vger.kernel.org 23713 23712 S: Supported 23714 23713 F: drivers/net/vmxnet3/ 23715 23714 23716 23715 VMWARE VSOCK VMCI TRANSPORT DRIVER 23717 - M: Bryan Tan <bryantan@vmware.com> 23718 - M: Vishnu Dasa <vdasa@vmware.com> 23719 - R: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> 23716 + M: Bryan Tan <bryan-bt.tan@broadcom.com> 23717 + M: Vishnu Dasa <vishnu.dasa@broadcom.com> 23718 + R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 23720 23719 L: linux-kernel@vger.kernel.org 23721 23720 S: Supported 23722 23721 F: net/vmw_vsock/vmci_transport*
+35 -14
arch/x86/mm/pat/memtype.c
··· 947 947 memtype_free(paddr, paddr + size); 948 948 } 949 949 950 + static int get_pat_info(struct vm_area_struct *vma, resource_size_t *paddr, 951 + pgprot_t *pgprot) 952 + { 953 + unsigned long prot; 954 + 955 + VM_WARN_ON_ONCE(!(vma->vm_flags & VM_PAT)); 956 + 957 + /* 958 + * We need the starting PFN and cachemode used for track_pfn_remap() 959 + * that covered the whole VMA. For most mappings, we can obtain that 960 + * information from the page tables. For COW mappings, we might now 961 + * suddenly have anon folios mapped and follow_phys() will fail. 962 + * 963 + * Fallback to using vma->vm_pgoff, see remap_pfn_range_notrack(), to 964 + * detect the PFN. If we need the cachemode as well, we're out of luck 965 + * for now and have to fail fork(). 966 + */ 967 + if (!follow_phys(vma, vma->vm_start, 0, &prot, paddr)) { 968 + if (pgprot) 969 + *pgprot = __pgprot(prot); 970 + return 0; 971 + } 972 + if (is_cow_mapping(vma->vm_flags)) { 973 + if (pgprot) 974 + return -EINVAL; 975 + *paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT; 976 + return 0; 977 + } 978 + WARN_ON_ONCE(1); 979 + return -EINVAL; 980 + } 981 + 950 982 /* 951 983 * track_pfn_copy is called when vma that is covering the pfnmap gets 952 984 * copied through copy_page_range(). ··· 989 957 int track_pfn_copy(struct vm_area_struct *vma) 990 958 { 991 959 resource_size_t paddr; 992 - unsigned long prot; 993 960 unsigned long vma_size = vma->vm_end - vma->vm_start; 994 961 pgprot_t pgprot; 995 962 996 963 if (vma->vm_flags & VM_PAT) { 997 - /* 998 - * reserve the whole chunk covered by vma. We need the 999 - * starting address and protection from pte. 1000 - */ 1001 - if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) { 1002 - WARN_ON_ONCE(1); 964 + if (get_pat_info(vma, &paddr, &pgprot)) 1003 965 return -EINVAL; 1004 - } 1005 - pgprot = __pgprot(prot); 966 + /* reserve the whole chunk covered by vma. */ 1006 967 return reserve_pfn_range(paddr, vma_size, &pgprot, 1); 1007 968 } 1008 969 ··· 1070 1045 unsigned long size, bool mm_wr_locked) 1071 1046 { 1072 1047 resource_size_t paddr; 1073 - unsigned long prot; 1074 1048 1075 1049 if (vma && !(vma->vm_flags & VM_PAT)) 1076 1050 return; ··· 1077 1053 /* free the chunk starting from pfn or the whole chunk */ 1078 1054 paddr = (resource_size_t)pfn << PAGE_SHIFT; 1079 1055 if (!paddr && !size) { 1080 - if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) { 1081 - WARN_ON_ONCE(1); 1056 + if (get_pat_info(vma, &paddr, NULL)) 1082 1057 return; 1083 - } 1084 - 1085 1058 size = vma->vm_end - vma->vm_start; 1086 1059 } 1087 1060 free_pfn_range(paddr, size);
+2 -2
include/linux/secretmem.h
··· 13 13 /* 14 14 * Using folio_mapping() is quite slow because of the actual call 15 15 * instruction. 16 - * We know that secretmem pages are not compound and LRU so we can 16 + * We know that secretmem pages are not compound, so we can 17 17 * save a couple of cycles here. 18 18 */ 19 - if (folio_test_large(folio) || !folio_test_lru(folio)) 19 + if (folio_test_large(folio)) 20 20 return false; 21 21 22 22 mapping = (struct address_space *)
+3 -4
include/linux/stackdepot.h
··· 44 44 union handle_parts { 45 45 depot_stack_handle_t handle; 46 46 struct { 47 - /* pool_index is offset by 1 */ 48 - u32 pool_index : DEPOT_POOL_INDEX_BITS; 49 - u32 offset : DEPOT_OFFSET_BITS; 50 - u32 extra : STACK_DEPOT_EXTRA_BITS; 47 + u32 pool_index_plus_1 : DEPOT_POOL_INDEX_BITS; 48 + u32 offset : DEPOT_OFFSET_BITS; 49 + u32 extra : STACK_DEPOT_EXTRA_BITS; 51 50 }; 52 51 }; 53 52
+1 -1
init/initramfs.c
··· 367 367 if (S_ISREG(mode)) { 368 368 int ml = maybe_link(); 369 369 if (ml >= 0) { 370 - int openflags = O_WRONLY|O_CREAT; 370 + int openflags = O_WRONLY|O_CREAT|O_LARGEFILE; 371 371 if (ml != 1) 372 372 openflags |= O_TRUNC; 373 373 wfile = filp_open(collected, openflags, mode);
+2 -2
lib/stackdepot.c
··· 330 330 stack = current_pool + pool_offset; 331 331 332 332 /* Pre-initialize handle once. */ 333 - stack->handle.pool_index = pool_index + 1; 333 + stack->handle.pool_index_plus_1 = pool_index + 1; 334 334 stack->handle.offset = pool_offset >> DEPOT_STACK_ALIGN; 335 335 stack->handle.extra = 0; 336 336 INIT_LIST_HEAD(&stack->hash_list); ··· 441 441 const int pools_num_cached = READ_ONCE(pools_num); 442 442 union handle_parts parts = { .handle = handle }; 443 443 void *pool; 444 - u32 pool_index = parts.pool_index - 1; 444 + u32 pool_index = parts.pool_index_plus_1 - 1; 445 445 size_t offset = parts.offset << DEPOT_STACK_ALIGN; 446 446 struct stack_record *stack; 447 447
+4
mm/memory.c
··· 5973 5973 goto out; 5974 5974 pte = ptep_get(ptep); 5975 5975 5976 + /* Never return PFNs of anon folios in COW mappings. */ 5977 + if (vm_normal_folio(vma, address, pte)) 5978 + goto unlock; 5979 + 5976 5980 if ((flags & FOLL_WRITE) && !pte_write(pte)) 5977 5981 goto unlock; 5978 5982
+45 -29
mm/vmalloc.c
··· 989 989 return atomic_long_read(&nr_vmalloc_pages); 990 990 } 991 991 992 + static struct vmap_area *__find_vmap_area(unsigned long addr, struct rb_root *root) 993 + { 994 + struct rb_node *n = root->rb_node; 995 + 996 + addr = (unsigned long)kasan_reset_tag((void *)addr); 997 + 998 + while (n) { 999 + struct vmap_area *va; 1000 + 1001 + va = rb_entry(n, struct vmap_area, rb_node); 1002 + if (addr < va->va_start) 1003 + n = n->rb_left; 1004 + else if (addr >= va->va_end) 1005 + n = n->rb_right; 1006 + else 1007 + return va; 1008 + } 1009 + 1010 + return NULL; 1011 + } 1012 + 992 1013 /* Look up the first VA which satisfies addr < va_end, NULL if none. */ 993 1014 static struct vmap_area * 994 1015 __find_vmap_area_exceed_addr(unsigned long addr, struct rb_root *root) ··· 1046 1025 static struct vmap_node * 1047 1026 find_vmap_area_exceed_addr_lock(unsigned long addr, struct vmap_area **va) 1048 1027 { 1049 - struct vmap_node *vn, *va_node = NULL; 1050 - struct vmap_area *va_lowest; 1028 + unsigned long va_start_lowest; 1029 + struct vmap_node *vn; 1051 1030 int i; 1052 1031 1053 - for (i = 0; i < nr_vmap_nodes; i++) { 1032 + repeat: 1033 + for (i = 0, va_start_lowest = 0; i < nr_vmap_nodes; i++) { 1054 1034 vn = &vmap_nodes[i]; 1055 1035 1056 1036 spin_lock(&vn->busy.lock); 1057 - va_lowest = __find_vmap_area_exceed_addr(addr, &vn->busy.root); 1058 - if (va_lowest) { 1059 - if (!va_node || va_lowest->va_start < (*va)->va_start) { 1060 - if (va_node) 1061 - spin_unlock(&va_node->busy.lock); 1037 + *va = __find_vmap_area_exceed_addr(addr, &vn->busy.root); 1062 1038 1063 - *va = va_lowest; 1064 - va_node = vn; 1065 - continue; 1066 - } 1067 - } 1039 + if (*va) 1040 + if (!va_start_lowest || (*va)->va_start < va_start_lowest) 1041 + va_start_lowest = (*va)->va_start; 1068 1042 spin_unlock(&vn->busy.lock); 1069 1043 } 1070 1044 1071 - return va_node; 1072 - } 1045 + /* 1046 + * Check if found VA exists, it might have gone away. In this case we 1047 + * repeat the search because a VA has been removed concurrently and we 1048 + * need to proceed to the next one, which is a rare case. 1049 + */ 1050 + if (va_start_lowest) { 1051 + vn = addr_to_node(va_start_lowest); 1073 1052 1074 - static struct vmap_area *__find_vmap_area(unsigned long addr, struct rb_root *root) 1075 - { 1076 - struct rb_node *n = root->rb_node; 1053 + spin_lock(&vn->busy.lock); 1054 + *va = __find_vmap_area(va_start_lowest, &vn->busy.root); 1077 1055 1078 - addr = (unsigned long)kasan_reset_tag((void *)addr); 1056 + if (*va) 1057 + return vn; 1079 1058 1080 - while (n) { 1081 - struct vmap_area *va; 1082 - 1083 - va = rb_entry(n, struct vmap_area, rb_node); 1084 - if (addr < va->va_start) 1085 - n = n->rb_left; 1086 - else if (addr >= va->va_end) 1087 - n = n->rb_right; 1088 - else 1089 - return va; 1059 + spin_unlock(&vn->busy.lock); 1060 + goto repeat; 1090 1061 } 1091 1062 1092 1063 return NULL; ··· 2355 2342 struct vmap_node *vn; 2356 2343 struct vmap_area *va; 2357 2344 int i, j; 2345 + 2346 + if (unlikely(!vmap_initialized)) 2347 + return NULL; 2358 2348 2359 2349 /* 2360 2350 * An addr_to_node_id(addr) converts an address to a node index
+1 -1
tools/testing/selftests/mm/vm_util.h
··· 3 3 #include <stdbool.h> 4 4 #include <sys/mman.h> 5 5 #include <err.h> 6 - #include <string.h> /* ffsl() */ 6 + #include <strings.h> /* ffsl() */ 7 7 #include <unistd.h> /* _SC_PAGESIZE */ 8 8 9 9 #define BIT_ULL(nr) (1ULL << (nr))