Skip to content

Commit 63ccd7e

Browse files
committed
Merge: mm: backport of proactive fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6650 JIRA: https://issues.redhat.com/browse/RHEL-78989 JIRA: https://issues.redhat.com/browse/RHEL-80529 JIRA: https://issues.redhat.com/browse/RHEL-83249 JIRA: https://issues.redhat.com/browse/RHEL-84184 CVE: CVE-2025-21691 CVE: CVE-2025-21696 CVE: CVE-2025-21861 Proactively backport a set of selected follow-up Fixes for the MM patches previously backported into RHEL-9 minor releases. Dependencies and follow-up fixes for the selected commits are also selectively backported. Omitted-fix: e080a26 ("erofs: allow large folios for compressed files") Omitted-fix: 3488af0 ("mm/damon/core: handle zero {aggregation,ops_update} intervals") Omitted-fix: 5e06ad5 ("mm/damon/core-test: test max_nr_accesses overflow caused divide-by-zero") Omitted-fix: 25e8acb ("mm/damon/tests/core-kunit: skip damon_test_nr_accesses_to_accesses_bp() if aggr_interval is zero") Omitted-fix: 1390a33 ("mm/hugetlb: fix kernel NULL pointer dereference when migrating hugetlb folio") Omitted-fix: 7ddeb91 ("mm: kmemleak: add support for dumping physical and __percpu object info") Signed-off-by: Rafael Aquini <[email protected]> Approved-by: David Arcari <[email protected]> Approved-by: Čestmír Kalina <[email protected]> Approved-by: Herton R. Krzesinski <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents edfef66 + e373f57 commit 63ccd7e

Some content is hidden

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

50 files changed

+639
-293
lines changed

arch/s390/include/asm/set_memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ __SET_MEMORY_FUNC(set_memory_4k, SET_MEMORY_4K)
6262

6363
int set_direct_map_invalid_noflush(struct page *page);
6464
int set_direct_map_default_noflush(struct page *page);
65+
bool kernel_page_present(struct page *page);
6566

6667
#endif

arch/s390/mm/pageattr.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,21 @@ int set_direct_map_default_noflush(struct page *page)
406406
return __set_memory((unsigned long)page_to_virt(page), 1, SET_MEMORY_DEF);
407407
}
408408

409+
bool kernel_page_present(struct page *page)
410+
{
411+
unsigned long addr;
412+
unsigned int cc;
413+
414+
addr = (unsigned long)page_address(page);
415+
asm volatile(
416+
" lra %[addr],0(%[addr])\n"
417+
" ipm %[cc]\n"
418+
: [cc] "=d" (cc), [addr] "+a" (addr)
419+
:
420+
: "cc");
421+
return (cc >> 28) == 0;
422+
}
423+
409424
#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
410425

411426
static void ipte_range(pte_t *pte, unsigned long address, int nr)

arch/sparc/include/asm/pgtable_64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
941941

942942
#ifdef DCACHE_ALIASING_POSSIBLE
943943
#define __HAVE_ARCH_MOVE_PTE
944-
#define move_pte(pte, prot, old_addr, new_addr) \
944+
#define move_pte(pte, old_addr, new_addr) \
945945
({ \
946946
pte_t newpte = (pte); \
947947
if (tlb_type != hypervisor && pte_present(pte)) { \

arch/um/include/asm/kasan.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#ifdef CONFIG_KASAN
2626
void kasan_init(void);
27-
void kasan_map_memory(void *start, unsigned long len);
2827
extern int kasan_um_is_ready;
2928

3029
#ifdef CONFIG_STATIC_LINK

arch/um/include/shared/kern_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,6 @@ extern void fatal_sigsegv(void) __attribute__ ((noreturn));
6969

7070
void um_idle_sleep(void);
7171

72+
void kasan_map_memory(void *start, size_t len);
73+
7274
#endif

arch/um/os-Linux/mem.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <sys/vfs.h>
1616
#include <linux/magic.h>
1717
#include <init.h>
18+
#include <kern_util.h>
1819
#include <os.h>
1920

2021
/*

arch/x86/kernel/cpu/vmware.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/export.h>
2727
#include <linux/clocksource.h>
2828
#include <linux/cpu.h>
29+
#include <linux/efi.h>
2930
#include <linux/reboot.h>
3031
#include <linux/static_call.h>
3132
#include <asm/div64.h>
@@ -429,6 +430,9 @@ static void __init vmware_platform_setup(void)
429430
pr_warn("Failed to get TSC freq from the hypervisor\n");
430431
}
431432

433+
if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP) && !efi_enabled(EFI_BOOT))
434+
x86_init.mpparse.find_mptable = mpparse_find_mptable;
435+
432436
vmware_paravirt_ops_setup();
433437

434438
#ifdef CONFIG_X86_IO_APIC

arch/x86/kernel/kvm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static void __init sev_map_percpu_data(void)
435435
{
436436
int cpu;
437437

438-
if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
438+
if (cc_vendor != CC_VENDOR_AMD ||
439+
!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
439440
return;
440441

441442
for_each_possible_cpu(cpu) {

arch/x86/mm/tlb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ static inline void cr4_update_pce_mm(struct mm_struct *mm) { }
494494
#endif
495495

496496
/*
497-
* The "prev" argument passed by the caller does not always match CR3. For
498-
* example, the scheduler passes in active_mm when switching from lazy TLB mode
499-
* to normal mode, but switch_mm_irqs_off() can be called from x86 code without
500-
* updating active_mm. Use cpu_tlbstate.loaded_mm instead.
497+
* This optimizes when not actually switching mm's. Some architectures use the
498+
* 'unused' argument for this optimization, but x86 must use
499+
* 'cpu_tlbstate.loaded_mm' instead because it does not always keep
500+
* 'current->active_mm' up to date.
501501
*/
502502
void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
503503
struct task_struct *tsk)

drivers/of/of_reserved_mem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
5050
memblock_phys_free(base, size);
5151
}
5252

53-
kmemleak_ignore_phys(base);
53+
if (!err)
54+
kmemleak_ignore_phys(base);
5455

5556
return err;
5657
}

0 commit comments

Comments
 (0)