Skip to content

Commit 5d85355

Browse files
committed
Merge tag 'v6.1.119' into orange-pi-6.1-rk35xx
This is the 6.1.119 stable release * tag 'v6.1.119' of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux: Linux 6.1.119 net: Make copy_safe_from_sockptr() match documentation char: xillybus: Fix trivial bug with mutex parisc: fix a possible DMA corruption null_blk: Fix return value of nullb_device_power_store() null_blk: fix null-ptr-dereference while configuring 'power' and 'submit_queues' null_blk: Remove usage of the deprecated ida_simple_xx() API char: xillybus: Prevent use-after-free due to race condition drm/amd: check num of link levels when update pcie param mm: resolve faulty mmap_region() error path behaviour mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling mm: unconditionally close VMAs on error mm: avoid unsafe VMA hook invocation when error arises on mmap hook mm: revert "mm: shmem: fix data-race in shmem_getattr()" net: fec: remove .ndo_poll_controller to avoid deadlocks net/sched: taprio: extend minimum interval restriction to entire cycle too ipvs: properly dereference pe in ip_vs_add_service fs/9p: fix uninitialized values during inode evict nfc: llcp: fix nfc_llcp_setsockopt() unsafe copies net: add copy_safe_from_sockptr() helper ksmbd: fix potencial out-of-bounds when buffer offset is invalid ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16() mptcp: pm: use _rcu variant under rcu_read_lock mptcp: drop lookup_by_id in lookup_addr mptcp: hold pm lock when deleting entry mptcp: update local address flags when setting it mptcp: add userspace_pm_lookup_addr_by_id helper mptcp: define more local variables sk mptcp: cope racing subflow creation in mptcp_rcv_space_adjust NFSD: Never decrement pending_async_copies on error NFSD: Initialize struct nfsd4_copy earlier NFSD: Limit the number of concurrent async COPY operations NFSD: Async COPY result needs to return a write verifier NFSD: initialize copy->cp_clp early in nfsd4_copy for use by trace point media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set cxl/pci: fix error code in __cxl_hdm_decode_init() lib/buildid: Fix build ID parsing logic Bluetooth: ISO: Fix not validating setsockopt user input fs/ntfs3: Additional check in ntfs_file_release staging: vchiq_arm: Use devm_kzalloc() for vchiq_arm_state allocation staging: vchiq_arm: Get the rid off struct vchiq_2835_state drm/amd: Fix initialization mistake for NBIO 7.7.0 drm/bridge: tc358768: Fix DSI command tx mmc: sunxi-mmc: Fix A100 compatible description Revert "mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K" nilfs2: fix null-ptr-deref in block_dirty_buffer tracepoint ocfs2: fix UBSAN warning in ocfs2_verify_volume() ALSA: hda/realtek: fix mute/micmute LEDs for a HP EliteBook 645 G10 ALSA: hda/realtek - Fixed Clevo platform headset Mic issue nilfs2: fix null-ptr-deref in block_touch_buffer tracepoint KVM: VMX: Bury Intel PT virtualization (guest/host mode) behind CONFIG_BROKEN KVM: x86: Unconditionally set irr_pending when updating APICv state KVM: nVMX: Treat vpid01 as current if L2 is active, but with VPID disabled ima: fix buffer overrun in ima_eventdigest_init_common vp_vdpa: fix id_table array not null terminated error vdpa/mlx5: Fix PA offset with unaligned starting iotlb map ocfs2: uncache inode which has failed entering the group mm: fix NULL pointer dereference in alloc_pages_bulk_noprof x86/mm: Fix a kdump kernel failure on SME system when CONFIG_IMA_KEXEC=y ARM: 9419/1: mm: Fix kernel memory mapping for xip kernels bonding: add ns target multicast address to slave device samples: pktgen: correct dev to DEV net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes. net/sched: cls_u32: replace int refcounts with proper refcounts Bluetooth: hci_core: Fix calling mgmt_device_connected Bluetooth: hci_event: Remove code to removed CONFIG_BT_HS virtio/vsock: Fix accept_queue memory leak net/mlx5e: CT: Fix null-ptr-deref in add rule err flow net/mlx5e: kTLS, Fix incorrect page refcounting net/mlx5: fs, lock FTE when checking if active mptcp: error out earlier on disconnect drm/rockchip: vop: Fix a dereferenced before check warning net: vertexcom: mse102x: Fix tx_bytes calculation netlink: terminate outstanding dump on socket close Signed-off-by: Khusika Dhamar Gusti <[email protected]>
2 parents f8d6b30 + e4d90d6 commit 5d85355

File tree

71 files changed

+755
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+755
-579
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 1
4-
SUBLEVEL = 118
4+
SUBLEVEL = 119
55
EXTRAVERSION =
66
NAME = Curry Ramen
77

arch/arm/kernel/head.S

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,27 +253,31 @@ __create_page_tables:
253253
*/
254254
add r0, r4, #KERNEL_OFFSET >> (SECTION_SHIFT - PMD_ENTRY_ORDER)
255255
ldr r6, =(_end - 1)
256+
257+
/* For XIP, kernel_sec_start/kernel_sec_end are currently in RO memory */
258+
#ifndef CONFIG_XIP_KERNEL
256259
adr_l r5, kernel_sec_start @ _pa(kernel_sec_start)
257260
#if defined CONFIG_CPU_ENDIAN_BE8 || defined CONFIG_CPU_ENDIAN_BE32
258261
str r8, [r5, #4] @ Save physical start of kernel (BE)
259262
#else
260263
str r8, [r5] @ Save physical start of kernel (LE)
264+
#endif
261265
#endif
262266
orr r3, r8, r7 @ Add the MMU flags
263267
add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ENTRY_ORDER)
264268
1: str r3, [r0], #1 << PMD_ENTRY_ORDER
265269
add r3, r3, #1 << SECTION_SHIFT
266270
cmp r0, r6
267271
bls 1b
272+
#ifndef CONFIG_XIP_KERNEL
268273
eor r3, r3, r7 @ Remove the MMU flags
269274
adr_l r5, kernel_sec_end @ _pa(kernel_sec_end)
270275
#if defined CONFIG_CPU_ENDIAN_BE8 || defined CONFIG_CPU_ENDIAN_BE32
271276
str r3, [r5, #4] @ Save physical end of kernel (BE)
272277
#else
273278
str r3, [r5] @ Save physical end of kernel (LE)
274279
#endif
275-
276-
#ifdef CONFIG_XIP_KERNEL
280+
#else
277281
/*
278282
* Map the kernel image separately as it is not located in RAM.
279283
*/

arch/arm/mm/mmu.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,18 +1401,6 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)
14011401
create_mapping(&map);
14021402
}
14031403

1404-
/*
1405-
* Map the kernel if it is XIP.
1406-
* It is always first in the modulearea.
1407-
*/
1408-
#ifdef CONFIG_XIP_KERNEL
1409-
map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);
1410-
map.virtual = MODULES_VADDR;
1411-
map.length = ((unsigned long)_exiprom - map.virtual + ~SECTION_MASK) & SECTION_MASK;
1412-
map.type = MT_ROM;
1413-
create_mapping(&map);
1414-
#endif
1415-
14161404
/*
14171405
* Map the cache flushing regions.
14181406
*/
@@ -1602,12 +1590,27 @@ static void __init map_kernel(void)
16021590
* This will only persist until we turn on proper memory management later on
16031591
* and we remap the whole kernel with page granularity.
16041592
*/
1593+
#ifdef CONFIG_XIP_KERNEL
1594+
phys_addr_t kernel_nx_start = kernel_sec_start;
1595+
#else
16051596
phys_addr_t kernel_x_start = kernel_sec_start;
16061597
phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
16071598
phys_addr_t kernel_nx_start = kernel_x_end;
1599+
#endif
16081600
phys_addr_t kernel_nx_end = kernel_sec_end;
16091601
struct map_desc map;
16101602

1603+
/*
1604+
* Map the kernel if it is XIP.
1605+
* It is always first in the modulearea.
1606+
*/
1607+
#ifdef CONFIG_XIP_KERNEL
1608+
map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);
1609+
map.virtual = MODULES_VADDR;
1610+
map.length = ((unsigned long)_exiprom - map.virtual + ~SECTION_MASK) & SECTION_MASK;
1611+
map.type = MT_ROM;
1612+
create_mapping(&map);
1613+
#else
16111614
map.pfn = __phys_to_pfn(kernel_x_start);
16121615
map.virtual = __phys_to_virt(kernel_x_start);
16131616
map.length = kernel_x_end - kernel_x_start;
@@ -1617,7 +1620,7 @@ static void __init map_kernel(void)
16171620
/* If the nx part is small it may end up covered by the tail of the RWX section */
16181621
if (kernel_x_end == kernel_nx_end)
16191622
return;
1620-
1623+
#endif
16211624
map.pfn = __phys_to_pfn(kernel_nx_start);
16221625
map.virtual = __phys_to_virt(kernel_nx_start);
16231626
map.length = kernel_nx_end - kernel_nx_start;
@@ -1762,6 +1765,11 @@ void __init paging_init(const struct machine_desc *mdesc)
17621765
{
17631766
void *zero_page;
17641767

1768+
#ifdef CONFIG_XIP_KERNEL
1769+
/* Store the kernel RW RAM region start/end in these variables */
1770+
kernel_sec_start = CONFIG_PHYS_OFFSET & SECTION_MASK;
1771+
kernel_sec_end = round_up(__pa(_end), SECTION_SIZE);
1772+
#endif
17651773
pr_debug("physical kernel sections: 0x%08llx-0x%08llx\n",
17661774
kernel_sec_start, kernel_sec_end);
17671775

arch/arm64/include/asm/mman.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#define __ASM_MMAN_H__
44

55
#include <linux/compiler.h>
6+
#include <linux/fs.h>
7+
#include <linux/shmem_fs.h>
68
#include <linux/types.h>
79
#include <uapi/asm/mman.h>
810

@@ -21,19 +23,21 @@ static inline unsigned long arch_calc_vm_prot_bits(unsigned long prot,
2123
}
2224
#define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
2325

24-
static inline unsigned long arch_calc_vm_flag_bits(unsigned long flags)
26+
static inline unsigned long arch_calc_vm_flag_bits(struct file *file,
27+
unsigned long flags)
2528
{
2629
/*
2730
* Only allow MTE on anonymous mappings as these are guaranteed to be
2831
* backed by tags-capable memory. The vm_flags may be overridden by a
2932
* filesystem supporting MTE (RAM-based).
3033
*/
31-
if (system_supports_mte() && (flags & MAP_ANONYMOUS))
34+
if (system_supports_mte() &&
35+
((flags & MAP_ANONYMOUS) || shmem_file(file)))
3236
return VM_MTE_ALLOWED;
3337

3438
return 0;
3539
}
36-
#define arch_calc_vm_flag_bits(flags) arch_calc_vm_flag_bits(flags)
40+
#define arch_calc_vm_flag_bits(file, flags) arch_calc_vm_flag_bits(file, flags)
3741

3842
static inline bool arch_validate_prot(unsigned long prot,
3943
unsigned long addr __always_unused)

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ config PARISC
1818
select ARCH_SUPPORTS_HUGETLBFS if PA20
1919
select ARCH_SUPPORTS_MEMORY_FAILURE
2020
select ARCH_STACKWALK
21+
select ARCH_HAS_CACHE_LINE_SIZE
2122
select ARCH_HAS_DEBUG_VM_PGTABLE
2223
select HAVE_RELIABLE_STACKTRACE
2324
select DMA_OPS

arch/parisc/include/asm/cache.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@
2020

2121
#define SMP_CACHE_BYTES L1_CACHE_BYTES
2222

23-
#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
23+
#ifdef CONFIG_PA20
24+
#define ARCH_DMA_MINALIGN 128
25+
#else
26+
#define ARCH_DMA_MINALIGN 32
27+
#endif
28+
#define ARCH_KMALLOC_MINALIGN 16 /* ldcw requires 16-byte alignment */
29+
30+
#define arch_slab_minalign() ((unsigned)dcache_stride)
31+
#define cache_line_size() dcache_stride
32+
#define dma_get_cache_alignment cache_line_size
2433

2534
#define __read_mostly __section(".data..read_mostly")
2635

arch/x86/kvm/lapic.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,19 +2453,26 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu)
24532453
{
24542454
struct kvm_lapic *apic = vcpu->arch.apic;
24552455

2456-
if (apic->apicv_active) {
2457-
/* irr_pending is always true when apicv is activated. */
2458-
apic->irr_pending = true;
2456+
/*
2457+
* When APICv is enabled, KVM must always search the IRR for a pending
2458+
* IRQ, as other vCPUs and devices can set IRR bits even if the vCPU
2459+
* isn't running. If APICv is disabled, KVM _should_ search the IRR
2460+
* for a pending IRQ. But KVM currently doesn't ensure *all* hardware,
2461+
* e.g. CPUs and IOMMUs, has seen the change in state, i.e. searching
2462+
* the IRR at this time could race with IRQ delivery from hardware that
2463+
* still sees APICv as being enabled.
2464+
*
2465+
* FIXME: Ensure other vCPUs and devices observe the change in APICv
2466+
* state prior to updating KVM's metadata caches, so that KVM
2467+
* can safely search the IRR and set irr_pending accordingly.
2468+
*/
2469+
apic->irr_pending = true;
2470+
2471+
if (apic->apicv_active)
24592472
apic->isr_count = 1;
2460-
} else {
2461-
/*
2462-
* Don't clear irr_pending, searching the IRR can race with
2463-
* updates from the CPU as APICv is still active from hardware's
2464-
* perspective. The flag will be cleared as appropriate when
2465-
* KVM injects the interrupt.
2466-
*/
2473+
else
24672474
apic->isr_count = count_vectors(apic->regs + APIC_ISR);
2468-
}
2475+
24692476
apic->highest_isr_cache = -1;
24702477
}
24712478
EXPORT_SYMBOL_GPL(kvm_apic_update_apicv);

arch/x86/kvm/vmx/nested.c

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,11 +1126,14 @@ static void nested_vmx_transition_tlb_flush(struct kvm_vcpu *vcpu,
11261126
struct vcpu_vmx *vmx = to_vmx(vcpu);
11271127

11281128
/*
1129-
* If vmcs12 doesn't use VPID, L1 expects linear and combined mappings
1130-
* for *all* contexts to be flushed on VM-Enter/VM-Exit, i.e. it's a
1131-
* full TLB flush from the guest's perspective. This is required even
1132-
* if VPID is disabled in the host as KVM may need to synchronize the
1133-
* MMU in response to the guest TLB flush.
1129+
* If VPID is disabled, then guest TLB accesses use VPID=0, i.e. the
1130+
* same VPID as the host, and so architecturally, linear and combined
1131+
* mappings for VPID=0 must be flushed at VM-Enter and VM-Exit. KVM
1132+
* emulates L2 sharing L1's VPID=0 by using vpid01 while running L2,
1133+
* and so KVM must also emulate TLB flush of VPID=0, i.e. vpid01. This
1134+
* is required if VPID is disabled in KVM, as a TLB flush (there are no
1135+
* VPIDs) still occurs from L1's perspective, and KVM may need to
1136+
* synchronize the MMU in response to the guest TLB flush.
11341137
*
11351138
* Note, using TLB_FLUSH_GUEST is correct even if nested EPT is in use.
11361139
* EPT is a special snowflake, as guest-physical mappings aren't
@@ -2196,6 +2199,17 @@ static void prepare_vmcs02_early_rare(struct vcpu_vmx *vmx,
21962199

21972200
vmcs_write64(VMCS_LINK_POINTER, INVALID_GPA);
21982201

2202+
/*
2203+
* If VPID is disabled, then guest TLB accesses use VPID=0, i.e. the
2204+
* same VPID as the host. Emulate this behavior by using vpid01 for L2
2205+
* if VPID is disabled in vmcs12. Note, if VPID is disabled, VM-Enter
2206+
* and VM-Exit are architecturally required to flush VPID=0, but *only*
2207+
* VPID=0. I.e. using vpid02 would be ok (so long as KVM emulates the
2208+
* required flushes), but doing so would cause KVM to over-flush. E.g.
2209+
* if L1 runs L2 X with VPID12=1, then runs L2 Y with VPID12 disabled,
2210+
* and then runs L2 X again, then KVM can and should retain TLB entries
2211+
* for VPID12=1.
2212+
*/
21992213
if (enable_vpid) {
22002214
if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
22012215
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
@@ -5758,6 +5772,12 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
57585772
return nested_vmx_fail(vcpu,
57595773
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
57605774

5775+
/*
5776+
* Always flush the effective vpid02, i.e. never flush the current VPID
5777+
* and never explicitly flush vpid01. INVVPID targets a VPID, not a
5778+
* VMCS, and so whether or not the current vmcs12 has VPID enabled is
5779+
* irrelevant (and there may not be a loaded vmcs12).
5780+
*/
57615781
vpid02 = nested_get_vpid02(vcpu);
57625782
switch (type) {
57635783
case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:

arch/x86/kvm/vmx/vmx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ module_param(ple_window_shrink, uint, 0444);
209209
static unsigned int ple_window_max = KVM_VMX_DEFAULT_PLE_WINDOW_MAX;
210210
module_param(ple_window_max, uint, 0444);
211211

212-
/* Default is SYSTEM mode, 1 for host-guest mode */
212+
/* Default is SYSTEM mode, 1 for host-guest mode (which is BROKEN) */
213213
int __read_mostly pt_mode = PT_MODE_SYSTEM;
214+
#ifdef CONFIG_BROKEN
214215
module_param(pt_mode, int, S_IRUGO);
216+
#endif
215217

216218
static DEFINE_STATIC_KEY_FALSE(vmx_l1d_should_flush);
217219
static DEFINE_STATIC_KEY_FALSE(vmx_l1d_flush_cond);
@@ -3098,7 +3100,7 @@ static void vmx_flush_tlb_all(struct kvm_vcpu *vcpu)
30983100

30993101
static inline int vmx_get_current_vpid(struct kvm_vcpu *vcpu)
31003102
{
3101-
if (is_guest_mode(vcpu))
3103+
if (is_guest_mode(vcpu) && nested_cpu_has_vpid(get_vmcs12(vcpu)))
31023104
return nested_get_vpid02(vcpu);
31033105
return to_vmx(vcpu)->vpid;
31043106
}

arch/x86/mm/ioremap.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ static bool memremap_is_setup_data(resource_size_t phys_addr,
650650
paddr_next = data->next;
651651
len = data->len;
652652

653-
if ((phys_addr > paddr) && (phys_addr < (paddr + len))) {
653+
if ((phys_addr > paddr) &&
654+
(phys_addr < (paddr + sizeof(struct setup_data) + len))) {
654655
memunmap(data);
655656
return true;
656657
}
@@ -712,7 +713,8 @@ static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
712713
paddr_next = data->next;
713714
len = data->len;
714715

715-
if ((phys_addr > paddr) && (phys_addr < (paddr + len))) {
716+
if ((phys_addr > paddr) &&
717+
(phys_addr < (paddr + sizeof(struct setup_data) + len))) {
716718
early_memunmap(data, sizeof(*data));
717719
return true;
718720
}

0 commit comments

Comments
 (0)