Skip to content

Commit b3032fd

Browse files
committed
Merge branch 'lineage-20' of github.com:LineageOS/android_kernel_qcom_sm8350 into lineage-22.2
* 'lineage-20' of github.com:LineageOS/android_kernel_qcom_sm8350: power: supply: core: Use blocking_notifier_call_chain to avoid RCU complaint qcacld-3.0: Fix potential OOB memory access qcacmn: Avoid incrementing usable channel count for 0 freq Revert "ANDROID: GKI: mm: add struct vm_fault fields for SPECULATIVE_PAGE_FAULTS" Revert "mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT" Revert "mm: prepare for FAULT_FLAG_SPECULATIVE" Revert "mm: introduce pte_spinlock for FAULT_FLAG_SPECULATIVE" Revert "mm: make pte_unmap_same compatible with SPF" Revert "mm: introduce INIT_VMA()" Revert "mm: VMA sequence count" Revert "mm: protect VMA modifications using VMA sequence count" Revert "mm: protect mremap() against SPF hanlder" Revert "mm: protect SPF handler against anon_vma changes" Revert "mm: cache some VMA fields in the vm_fault structure" Revert "mm/migrate: Pass vm_fault pointer to migrate_misplaced_page()" Revert "mm: introduce __lru_cache_add_active_or_unevictable" Revert "mm: introduce __vm_normal_page()" Revert "mm: introduce __page_add_new_anon_rmap()" Revert "mm: protect mm_rb tree with a rwlock" Revert "mm: provide speculative fault infrastructure" Revert "mm: adding speculative page fault failure trace events" Revert "mm: speculative page fault handler return VMA" Revert "mm: add speculative page fault vmstats" Revert "arm64/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT" Revert "arm64/mm: add speculative page fault" Revert "mm: protect against PTE changes done by dup_mmap()" Revert "mm: don't do swap readahead during speculative page fault" Revert "mm: Fix sleeping while atomic during speculative page fault" Revert "mm: allow vmas with vm_ops to be speculatively handled" Revert "mm: remove the speculative page fault traces" Revert "mm: sync rss in speculative page fault path" Revert "mm: skip speculative path for non-anonymous COW faults" Revert "mm: fix non-anon COW fault" Revert "ANDROID: mm: use raw seqcount variants in vm_write_*" Revert "ANDROID: mm: Fix page table lookup in speculative fault path" Revert "ANDROID: mm: skip pte_alloc during speculative page fault" Revert "ANDROID: mm: prevent speculative page fault handling for in do_swap_page()" Revert "ANDROID: mm: prevent reads of unstable pmd during speculation" Revert "BACKPORT: FROMLIST: mm: implement speculative handling in filemap_fault()" Revert "ANDROID: mm/khugepaged: add missing vm_write_{begin|end}" Revert "ANDROID: mm: remove sequence counting when mmap_lock is not exclusively owned" Revert "ANDROID: mm: assert that mmap_lock is taken exclusively in vm_write_begin" Revert "ANDROID: disable page table moves when speculative page faults are enabled" Revert "ANDROID: mm: fix invalid backport in speculative page fault path" Revert "ANDROID: Re-enable fast mremap and fix UAF with SPF" Revert "ANDROID: mm/filemap: Fix missing put_page() for speculative page fault" Revert "BACKPORT: FROMLIST: mm: protect free_pgtables with mmap_lock write lock in exit_mmap" Change-Id: I2b20b51b004a7c8114673ad8a0612c9bd7b1ef01
2 parents 19f173d + 6df7207 commit b3032fd

File tree

37 files changed

+239
-1287
lines changed

37 files changed

+239
-1287
lines changed

arch/arm64/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ config ARM64
191191
select SYSCTL_EXCEPTION_TRACE
192192
select THREAD_INFO_IN_TASK
193193
select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
194-
select ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
195194
help
196195
ARM 64-bit (AArch64) Linux support.
197196

arch/arm64/mm/fault.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,10 @@ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *re
410410
#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000)
411411
#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000)
412412

413-
static int __do_page_fault(struct vm_area_struct *vma, unsigned long addr,
413+
static vm_fault_t __do_page_fault(struct mm_struct *mm, unsigned long addr,
414414
unsigned int mm_flags, unsigned long vm_flags)
415415
{
416+
struct vm_area_struct *vma = find_vma(mm, addr);
416417

417418
if (unlikely(!vma))
418419
return VM_FAULT_BADMAP;
@@ -459,7 +460,6 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
459460
vm_fault_t fault, major = 0;
460461
unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
461462
unsigned int mm_flags = FAULT_FLAG_DEFAULT;
462-
struct vm_area_struct *vma = NULL;
463463

464464
if (kprobe_page_fault(regs, esr))
465465
return 0;
@@ -499,14 +499,6 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
499499

500500
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
501501

502-
/*
503-
* let's try a speculative page fault without grabbing the
504-
* mmap_sem.
505-
*/
506-
fault = handle_speculative_fault(mm, addr, mm_flags, &vma);
507-
if (fault != VM_FAULT_RETRY)
508-
goto done;
509-
510502
/*
511503
* As per x86, we may deadlock here. However, since the kernel only
512504
* validly references user space from well defined areas of the code,
@@ -531,10 +523,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
531523
#endif
532524
}
533525

534-
if (!vma || !can_reuse_spf_vma(vma, addr))
535-
vma = find_vma(mm, addr);
536-
537-
fault = __do_page_fault(vma, addr, mm_flags, vm_flags);
526+
fault = __do_page_fault(mm, addr, mm_flags, vm_flags);
538527
major |= fault & VM_FAULT_MAJOR;
539528

540529
/* Quick path to respond to signals */
@@ -547,20 +536,11 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
547536
if (fault & VM_FAULT_RETRY) {
548537
if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
549538
mm_flags |= FAULT_FLAG_TRIED;
550-
551-
/*
552-
* Do not try to reuse this vma and fetch it
553-
* again since we will release the mmap_sem.
554-
*/
555-
vma = NULL;
556-
557539
goto retry;
558540
}
559541
}
560542
up_read(&mm->mmap_sem);
561543

562-
done:
563-
564544
/*
565545
* Handle the "normal" (no error) case first.
566546
*/

drivers/power/supply/power_supply_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
struct class *power_supply_class;
2828
EXPORT_SYMBOL_GPL(power_supply_class);
2929

30-
ATOMIC_NOTIFIER_HEAD(power_supply_notifier);
30+
BLOCKING_NOTIFIER_HEAD(power_supply_notifier);
3131
EXPORT_SYMBOL_GPL(power_supply_notifier);
3232

3333
static struct device_type power_supply_dev_type;
@@ -95,7 +95,7 @@ static void power_supply_changed_work(struct work_struct *work)
9595
class_for_each_device(power_supply_class, NULL, psy,
9696
__power_supply_changed_work);
9797
power_supply_update_leds(psy);
98-
atomic_notifier_call_chain(&power_supply_notifier,
98+
blocking_notifier_call_chain(&power_supply_notifier,
9999
PSY_EVENT_PROP_CHANGED, psy);
100100
kobject_uevent(&psy->dev.kobj, KOBJ_CHANGE);
101101
spin_lock_irqsave(&psy->changed_lock, flags);
@@ -913,13 +913,13 @@ static void power_supply_dev_release(struct device *dev)
913913

914914
int power_supply_reg_notifier(struct notifier_block *nb)
915915
{
916-
return atomic_notifier_chain_register(&power_supply_notifier, nb);
916+
return blocking_notifier_chain_register(&power_supply_notifier, nb);
917917
}
918918
EXPORT_SYMBOL_GPL(power_supply_reg_notifier);
919919

920920
void power_supply_unreg_notifier(struct notifier_block *nb)
921921
{
922-
atomic_notifier_chain_unregister(&power_supply_notifier, nb);
922+
blocking_notifier_chain_unregister(&power_supply_notifier, nb);
923923
}
924924
EXPORT_SYMBOL_GPL(power_supply_unreg_notifier);
925925

drivers/staging/qca-wifi-host-cmn/umac/regulatory/core/src/reg_services_common.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,7 +3338,7 @@ reg_update_usable_chan_resp(struct wlan_objmgr_pdev *pdev,
33383338
struct ch_params ch_params = {0};
33393339
int index = *count;
33403340

3341-
for (i = 0; i < len; i++) {
3341+
for (i = 0; i < len && index < NUM_CHANNELS; i++) {
33423342
/* In case usable channels are required for multiple filter
33433343
* mask, Some frequencies may present in res_msg . To avoid
33443344
* frequency duplication, only mode mask is updated for
@@ -3690,6 +3690,8 @@ reg_get_usable_channel_coex_filter(struct wlan_objmgr_pdev *pdev,
36903690
chan_list[chan_enum].center_freq &&
36913691
freq_range.end_freq >=
36923692
chan_list[chan_enum].center_freq) {
3693+
reg_debug("avoid freq %d",
3694+
chan_list[chan_enum].center_freq);
36933695
reg_remove_freq(res_msg, chan_enum);
36943696
}
36953697
}
@@ -3808,16 +3810,15 @@ wlan_reg_get_usable_channel(struct wlan_objmgr_pdev *pdev,
38083810
}
38093811
}
38103812

3811-
if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX)
3812-
status =
3813-
reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg,
3814-
chan_list, usable_channels);
3815-
38163813
if (req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY)
38173814
status =
38183815
reg_get_usable_channel_con_filter(pdev, req_msg, res_msg,
38193816
usable_channels);
38203817

3818+
if (req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX)
3819+
status =
3820+
reg_get_usable_channel_coex_filter(pdev, req_msg, res_msg,
3821+
chan_list, usable_channels);
38213822
if (!(req_msg.filter_mask & 1 << FILTER_CELLULAR_COEX) &&
38223823
!(req_msg.filter_mask & 1 << FILTER_WLAN_CONCURRENCY))
38233824
status =

drivers/staging/qcacld-3.0/core/wma/src/wma_utils.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
3-
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
3+
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
44
*
55
* Permission to use, copy, modify, and/or distribute this software for
66
* any purpose with or without fee is hereby granted, provided that the
@@ -708,7 +708,6 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
708708
}
709709

710710
stats_ext_info = param_buf->fixed_param;
711-
buf_ptr = (uint8_t *)stats_ext_info;
712711

713712
alloc_len = sizeof(tSirStatsExtEvent);
714713
alloc_len += stats_ext_info->data_len;
@@ -725,7 +724,7 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
725724
if (!stats_ext_event)
726725
return -ENOMEM;
727726

728-
buf_ptr += sizeof(wmi_stats_ext_event_fixed_param) + WMI_TLV_HDR_SIZE;
727+
buf_ptr = (uint8_t *)param_buf->data;
729728

730729
stats_ext_event->vdev_id = stats_ext_info->vdev_id;
731730
stats_ext_event->event_data_len = stats_ext_info->data_len;
@@ -775,7 +774,6 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
775774
}
776775

777776
stats_ext_info = param_buf->fixed_param;
778-
buf_ptr = (uint8_t *)stats_ext_info;
779777

780778
alloc_len = sizeof(tSirStatsExtEvent);
781779
alloc_len += stats_ext_info->data_len;
@@ -791,7 +789,7 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
791789
if (!stats_ext_event)
792790
return -ENOMEM;
793791

794-
buf_ptr += sizeof(wmi_stats_ext_event_fixed_param) + WMI_TLV_HDR_SIZE;
792+
buf_ptr = (uint8_t *)param_buf->data;
795793

796794
stats_ext_event->vdev_id = stats_ext_info->vdev_id;
797795
stats_ext_event->event_data_len = stats_ext_info->data_len;

fs/proc/task_mmu.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,11 +1296,8 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
12961296
goto out_mm;
12971297
}
12981298
for (vma = mm->mmap; vma; vma = vma->vm_next) {
1299-
vm_write_begin(vma);
1300-
WRITE_ONCE(vma->vm_flags,
1301-
vma->vm_flags & ~VM_SOFTDIRTY);
1299+
vma->vm_flags &= ~VM_SOFTDIRTY;
13021300
vma_set_page_prot(vma);
1303-
vm_write_end(vma);
13041301
}
13051302
downgrade_write(&mm->mmap_sem);
13061303
break;

fs/userfaultfd.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,8 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs)
678678

679679
octx = vma->vm_userfaultfd_ctx.ctx;
680680
if (!octx || !(octx->features & UFFD_FEATURE_EVENT_FORK)) {
681-
vm_write_begin(vma);
682681
vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
683-
WRITE_ONCE(vma->vm_flags,
684-
vma->vm_flags & ~__VM_UFFD_FLAGS);
685-
vm_write_end(vma);
682+
vma->vm_flags &= ~__VM_UFFD_FLAGS;
686683
return 0;
687684
}
688685

@@ -924,10 +921,8 @@ static int userfaultfd_release(struct inode *inode, struct file *file)
924921
else
925922
prev = vma;
926923
}
927-
vm_write_begin(vma);
928-
WRITE_ONCE(vma->vm_flags, new_flags);
924+
vma->vm_flags = new_flags;
929925
vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
930-
vm_write_end(vma);
931926
}
932927
up_write(&mm->mmap_sem);
933928
mmput(mm);
@@ -1499,10 +1494,8 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
14991494
* the next vma was merged into the current one and
15001495
* the current one has not been updated yet.
15011496
*/
1502-
vm_write_begin(vma);
1503-
WRITE_ONCE(vma->vm_flags, vma_pad_fixup_flags(vma, new_flags));
1497+
vma->vm_flags = vma_pad_fixup_flags(vma, new_flags);
15041498
vma->vm_userfaultfd_ctx.ctx = ctx;
1505-
vm_write_end(vma);
15061499

15071500
if (is_vm_hugetlb_page(vma) && uffd_disable_huge_pmd_share(vma))
15081501
hugetlb_unshare_all_pmds(vma);
@@ -1674,10 +1667,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
16741667
* the next vma was merged into the current one and
16751668
* the current one has not been updated yet.
16761669
*/
1677-
vm_write_begin(vma);
1678-
WRITE_ONCE(vma->vm_flags, vma_pad_fixup_flags(vma, new_flags));
1670+
vma->vm_flags = vma_pad_fixup_flags(vma, new_flags);
16791671
vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
1680-
vm_write_end(vma);
16811672

16821673
skip:
16831674
prev = vma;

include/linux/hugetlb_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
1010
{
11-
return !!(READ_ONCE(vma->vm_flags) & VM_HUGETLB);
11+
return !!(vma->vm_flags & VM_HUGETLB);
1212
}
1313

1414
#else

include/linux/migrate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ static inline void __ClearPageMovable(struct page *page)
131131
#ifdef CONFIG_NUMA_BALANCING
132132
extern bool pmd_trans_migrating(pmd_t pmd);
133133
extern int migrate_misplaced_page(struct page *page,
134-
struct vm_fault *vmf, int node);
134+
struct vm_area_struct *vma, int node);
135135
#else
136136
static inline bool pmd_trans_migrating(pmd_t pmd)
137137
{
138138
return false;
139139
}
140140
static inline int migrate_misplaced_page(struct page *page,
141-
struct vm_fault *vmf, int node)
141+
struct vm_area_struct *vma, int node)
142142
{
143143
return -EAGAIN; /* can't migrate now */
144144
}

0 commit comments

Comments
 (0)