Skip to content

[LTS 8.6 RT] Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm - #93

Merged
PlaidCat merged 1 commit into
ctrliq:ciqlts8_6-rtfrom
pvts-mat:ciqlts8_6-rt-CVE-2022-42896
Jan 28, 2025
Merged

[LTS 8.6 RT] Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm#93
PlaidCat merged 1 commit into
ctrliq:ciqlts8_6-rtfrom
pvts-mat:ciqlts8_6-rt-CVE-2022-42896

Conversation

@pvts-mat

Copy link
Copy Markdown
Contributor

CVE-2022-42896
VULN-205

Solution

The bug fix in the mainline is provided1 in two commits:

  • f937b758a188d6fd328a81367087eddbb2fce50f
  • 711f8c3fb3db61897080468586b970c87c61d9e4

Of these the 711f8c3 is already applied on ciqlts8_6-rt (commit 0c319402e3cb34e46cad6ed4299faffa7916b670).

(Same situation as in #41)

kABI check: omitted

Boot test: passed

boot-test.log

Kselftests: passed relative

Methodology

All kselftests used were compiled from the kernel source code, branch ciqlts8_6-rt (5d362bf39d935ad7de47fa83661d2965e54ae013). The kernel-rt-selftests-internal package is not available for Rocky LTS 8.6 RT.

Additionally the tests were ran using the installed kselftests, as with

make -C tools/testing/selftests install

in order to evaluate the usefulness of this feature. (The installed selftests use the same run_kselftest.sh -defined interface as those from kernel-selftests-internal, kernel-rt-selftests-internal packages, providing high granularity of tests selection and potentially streamlining testing across different rocky versions.)

Covered test groups (including those skipped during execution)

android, bpf, breakpoints, capabilities, core, cpu-hotplug, cpufreq, efivarfs, exec, filesystems, firmware, fpu, ftrace, futex, gpio, intel_pstate, ipc, kcmp, kvm, lib, livepatch, membarrier, memfd, memory-hotplug, mount, net, net/forwarding, net/mptcp, netfilter, nsfs, pstore, ptrace, rseq, rtc, sgx, sigaltstack, size, splice, static_keys, sync, sysctl, tc-testing, timens, timers, tpm2, user, vm, x86, zram

Compiled selftests

Tests stability analysis on a reference kernel

A series of 5 test runs were conducted on the reference LTS 8.6 RT kernel ciqlts8_6-rt (5d362bf39d935ad7de47fa83661d2965e54ae013) of which 2 finished without issues.

kselftests–source–ciqlts8_6-rt–run1.log
kselftests–source–ciqlts8_6-rt–run2.log

It was found that

  • Two tests are dysfunctional
    • bpf:test_sockmap: Sometimes hangs the machine by blocking the kworker
    • bpf:test_progs: Sometimes causes the machine to spontaneously reboot, interrupting the tests run. Potentially this also applies to the bpf:test_progs-no_alu32 test as is the case on other Rocky versions, but on these test runs it behaved properly.
  • Two tests are "flappy", their results differing depending on the run
    • ipc:msgque
    • net:gro.sh

For the full picture of unit tests stability state refer to the column https://docs.google.com/spreadsheets/d/1tUwJ2rV57cYZXh7momPtraSjZcHDjMYHLeHA3DYWrUU/edit?pli=1&gid=0#gid=0&range=D:D

Patched kernel

A single test run was conducted on the patched kernel.
kselftests–source–ciqlts8_6-rt-CVE-2022-42896.log

Comparison

Compared to the reference kernel and omitting the unstable and flappy tests the results are identical except for the net:reuseport_addr_any.sh test, which the reference kernel was failing while the patched kernel was passing. An additional series of net tests were conducted on the reference kernel in hope of obtaining the passing result, without success.

kselftests–source–ciqlts8_6-rt–net–run1.log
kselftests–source–ciqlts8_6-rt–net–run2.log
kselftests–source–ciqlts8_6-rt–net–run3.log

Full comparison give below

xonsh ktests.xsh table \
kselftests--source--ciqlts8_6-rt--run1.log \
kselftests--source--ciqlts8_6-rt--run2.log \
kselftests--source--ciqlts8_6-rt--net--run1.log \
kselftests--source--ciqlts8_6-rt--net--run2.log \
kselftests--source--ciqlts8_6-rt--net--run3.log \
kselftests--source--ciqlts8_6-rt-CVE-2022-42896.log
Column File
-------- ---------------------------------------------------
Status0 kselftests--source--ciqlts8_6-rt--run1.log
Status1 kselftests--source--ciqlts8_6-rt--run2.log
Status2 kselftests--source--ciqlts8_6-rt--net--run1.log
Status3 kselftests--source--ciqlts8_6-rt--net--run2.log
Status4 kselftests--source--ciqlts8_6-rt--net--run3.log
Status5 kselftests--source--ciqlts8_6-rt-CVE-2022-42896.log
TestCase Status0 Status1 Status2 Status3 Status4 Status5 Summary
android:run.sh skip skip skip same
bpf:get_cgroup_id_user pass pass pass same
bpf:test_bpftool.sh fail fail fail same
bpf:test_bpftool_build.sh pass pass pass same
bpf:test_bpftool_metadata.sh skip skip skip same
bpf:test_cgroup_storage pass pass pass same
bpf:test_dev_cgroup pass pass pass same
bpf:test_doc_build.sh pass pass pass same
bpf:test_flow_dissector.sh fail fail fail same
bpf:test_kmod.sh pass pass pass same
bpf:test_lirc_mode2.sh pass pass pass same
bpf:test_lpm_map pass pass pass same
bpf:test_lru_map pass pass pass same
bpf:test_lwt_ip_encap.sh pass pass pass same
bpf:test_lwt_seg6local.sh pass pass pass same
bpf:test_maps pass pass pass same
bpf:test_netcnt pass pass pass same
bpf:test_offload.py pass pass pass same
bpf:test_progs fail fail fail same
bpf:test_progs-no_alu32 fail fail fail same
bpf:test_skb_cgroup_id.sh fail fail fail same
bpf:test_sock pass pass pass same
bpf:test_sock_addr.sh pass pass pass same
bpf:test_sockmap pass pass pass same
bpf:test_sysctl pass pass pass same
bpf:test_tag pass pass pass same
bpf:test_tc_edt.sh fail fail fail same
bpf:test_tc_tunnel.sh fail fail fail same
bpf:test_tcp_check_syncookie.sh fail fail fail same
bpf:test_tcpnotify_user fail fail fail same
bpf:test_tunnel.sh fail fail fail same
bpf:test_verifier fail fail fail same
bpf:test_verifier_log pass pass pass same
bpf:test_xdp_meta.sh fail fail fail same
bpf:test_xdp_redirect.sh pass pass pass same
bpf:test_xdp_veth.sh skip skip skip same
bpf:test_xdp_vlan_mode_generic.sh fail fail fail same
bpf:test_xdp_vlan_mode_native.sh fail fail fail same
bpf:test_xdping.sh pass pass pass same
bpf:test_xsk.sh fail fail fail same
bpf:urandom_read pass pass pass same
breakpoints:step_after_suspend_test fail fail fail same
capabilities:test_execve pass pass pass same
core:close_range_test pass pass pass same
cpu-hotplug:cpu-on-off-test.sh pass pass pass same
cpufreq:main.sh fail fail fail same
efivarfs:efivarfs.sh skip skip skip same
exec:execveat pass pass pass same
filesystems:devpts_pts pass pass pass same
firmware:fw_run_tests.sh skip skip skip same
fpu:run_test_fpu.sh skip skip skip same
fpu:test_fpu pass pass pass same
ftrace:ftracetest fail fail fail same
futex:run.sh pass pass pass same
gpio:gpio-mockup.sh fail fail fail same
intel_pstate:run.sh pass pass pass same
ipc:msgque pass fail pass diff
kcmp:kcmp_test pass pass pass same
kvm:access_tracking_perf_test fail fail fail same
kvm:amx_test skip skip skip same
kvm:cr4_cpuid_sync_test pass pass pass same
kvm:debug_regs pass pass pass same
kvm:demand_paging_test pass pass pass same
kvm:dirty_log_perf_test pass pass pass same
kvm:dirty_log_test fail fail fail same
kvm:emulator_error_test pass pass pass same
kvm:evmcs_test pass pass pass same
kvm:get_cpuid_test pass pass pass same
kvm:get_msr_index_features pass pass pass same
kvm:hardware_disable_test pass pass pass same
kvm:hyperv_clock fail fail fail same
kvm:hyperv_cpuid pass pass pass same
kvm:hyperv_features pass pass pass same
kvm:kvm_binary_stats_test pass pass pass same
kvm:kvm_create_max_vcpus skip skip skip same
kvm:kvm_page_table_test pass pass pass same
kvm:kvm_pv_test pass pass pass same
kvm:memslot_modification_stress_test pass pass pass same
kvm:memslot_perf_test fail fail fail same
kvm:mmio_warning_test skip skip skip same
kvm:mmu_role_test pass pass pass same
kvm:platform_info_test pass pass pass same
kvm:rseq_test fail fail fail same
kvm:set_boot_cpu_id pass pass pass same
kvm:set_memory_region_test fail fail fail same
kvm:set_sregs_test pass pass pass same
kvm:smm_test pass pass pass same
kvm:state_test pass pass pass same
kvm:steal_time pass pass pass same
kvm:svm_int_ctl_test skip skip skip same
kvm:svm_vmcall_test skip skip skip same
kvm:sync_regs_test pass pass pass same
kvm:tsc_msrs_test pass pass pass same
kvm:userspace_msr_exit_test pass pass pass same
kvm:vmx_apic_access_test pass pass pass same
kvm:vmx_close_while_nested_test pass pass pass same
kvm:vmx_dirty_log_test pass pass pass same
kvm:vmx_nested_tsc_scaling_test skip skip skip same
kvm:vmx_pmu_msrs_test pass pass pass same
kvm:vmx_preemption_timer_test fail fail fail same
kvm:vmx_set_nested_state_test pass pass pass same
kvm:vmx_tsc_adjust_test pass pass pass same
kvm:xapic_ipi_test pass pass pass same
kvm:xen_shinfo_test skip skip skip same
kvm:xen_vmcall_test skip skip skip same
kvm:xss_msr_test pass pass pass same
lib:bitmap.sh skip skip skip same
lib:prime_numbers.sh skip skip skip same
lib:printf.sh skip skip skip same
lib:scanf.sh fail fail fail same
livepatch:test-callbacks.sh pass pass pass same
livepatch:test-ftrace.sh pass pass pass same
livepatch:test-livepatch.sh pass pass pass same
livepatch:test-shadow-vars.sh pass pass pass same
livepatch:test-state.sh pass pass pass same
membarrier:membarrier_test_multi_thread pass pass pass same
membarrier:membarrier_test_single_thread pass pass pass same
memfd:memfd_test pass pass pass same
memfd:run_fuse_test.sh fail fail fail same
memfd:run_hugetlbfs_test.sh pass pass pass same
memory-hotplug:mem-on-off-test.sh pass pass pass same
mount:run_tests.sh pass pass pass same
net/forwarding:bridge_igmp.sh fail fail fail same
net/forwarding:bridge_port_isolation.sh fail fail fail same
net/forwarding:bridge_sticky_fdb.sh fail fail fail same
net/forwarding:bridge_vlan_aware.sh fail fail fail same
net/forwarding:bridge_vlan_unaware.sh fail fail fail same
net/forwarding:ethtool.sh fail fail fail same
net/forwarding:gre_multipath.sh fail fail fail same
net/forwarding:ip6_forward_instats_vrf.sh fail fail fail same
net/forwarding:ipip_flat_gre.sh fail fail fail same
net/forwarding:ipip_flat_gre_key.sh fail fail fail same
net/forwarding:ipip_flat_gre_keys.sh fail fail fail same
net/forwarding:ipip_hier_gre.sh fail fail fail same
net/forwarding:ipip_hier_gre_key.sh fail fail fail same
net/forwarding:ipip_hier_gre_keys.sh fail fail fail same
net/forwarding:loopback.sh fail fail fail same
net/forwarding:mirror_gre.sh fail fail fail same
net/forwarding:mirror_gre_bound.sh fail fail fail same
net/forwarding:mirror_gre_bridge_1d.sh fail fail fail same
net/forwarding:mirror_gre_bridge_1d_vlan.sh fail fail fail same
net/forwarding:mirror_gre_bridge_1q.sh fail fail fail same
net/forwarding:mirror_gre_bridge_1q_lag.sh fail fail fail same
net/forwarding:mirror_gre_changes.sh fail fail fail same
net/forwarding:mirror_gre_flower.sh fail fail fail same
net/forwarding:mirror_gre_lag_lacp.sh fail fail fail same
net/forwarding:mirror_gre_neigh.sh fail fail fail same
net/forwarding:mirror_gre_nh.sh fail fail fail same
net/forwarding:mirror_gre_vlan.sh fail fail fail same
net/forwarding:mirror_gre_vlan_bridge_1q.sh fail fail fail same
net/forwarding:mirror_vlan.sh fail fail fail same
net/forwarding:router.sh fail fail fail same
net/forwarding:router_bridge.sh fail fail fail same
net/forwarding:router_bridge_vlan.sh fail fail fail same
net/forwarding:router_broadcast.sh fail fail fail same
net/forwarding:router_multicast.sh fail fail fail same
net/forwarding:router_multipath.sh fail fail fail same
net/forwarding:router_vid_1.sh fail fail fail same
net/forwarding:sch_ets.sh fail fail fail same
net/forwarding:sch_tbf_ets.sh fail fail fail same
net/forwarding:sch_tbf_prio.sh fail fail fail same
net/forwarding:sch_tbf_root.sh fail fail fail same
net/forwarding:tc_actions.sh fail fail fail same
net/forwarding:tc_chains.sh fail fail fail same
net/forwarding:tc_flower.sh fail fail fail same
net/forwarding:tc_flower_router.sh fail fail fail same
net/forwarding:tc_mpls_l2vpn.sh fail fail fail same
net/forwarding:tc_shblocks.sh fail fail fail same
net/forwarding:tc_vlan_modify.sh fail fail fail same
net/forwarding:vxlan_asymmetric.sh fail fail fail same
net/forwarding:vxlan_bridge_1d.sh fail fail fail same
net/forwarding:vxlan_bridge_1d_port_8472.sh fail fail fail same
net/forwarding:vxlan_bridge_1q.sh fail fail fail same
net/forwarding:vxlan_bridge_1q_port_8472.sh fail fail fail same
net/forwarding:vxlan_symmetric.sh fail fail fail same
net/mptcp:diag.sh pass pass pass same
net/mptcp:mptcp_connect.sh pass pass pass same
net/mptcp:mptcp_join.sh skip skip skip same
net/mptcp:mptcp_sockopt.sh skip skip skip same
net/mptcp:pm_netlink.sh pass pass pass same
net/mptcp:simult_flows.sh pass pass pass same
net:bareudp.sh skip skip skip skip skip skip same
net:devlink_port_split.py skip skip skip skip skip skip same
net:drop_monitor_tests.sh skip skip skip skip skip skip same
net:fcnal-test.sh pass pass pass pass pass pass same
net:fib-onlink-tests.sh pass pass pass pass pass pass same
net:fib_rule_tests.sh fail fail fail fail fail fail same
net:fib_tests.sh pass pass pass pass pass pass same
net:gre_gso.sh skip skip skip skip skip skip same
net:gro.sh fail pass pass pass pass pass diff
net:icmp_redirect.sh pass pass pass pass pass pass same
net:ip6_gre_headroom.sh pass pass pass pass pass pass same
net:ip_defrag.sh fail fail fail fail fail fail same
net:ipv6_flowlabel.sh pass pass pass pass pass pass same
net:l2tp.sh pass pass pass pass pass pass same
net:msg_zerocopy.sh fail fail fail fail fail fail same
net:netdevice.sh pass pass pass pass pass pass same
net:pmtu.sh pass pass pass pass pass pass same
net:psock_snd.sh fail fail fail fail fail fail same
net:reuseaddr_conflict pass pass pass pass pass pass same
net:reuseport_addr_any.sh fail fail fail fail fail pass diff
net:reuseport_bpf pass pass pass pass pass pass same
net:reuseport_bpf_cpu pass pass pass pass pass pass same
net:reuseport_bpf_numa fail fail fail fail fail fail same
net:reuseport_dualstack pass pass pass pass pass pass same
net:rtnetlink.sh skip skip skip skip skip skip same
net:run_afpackettests pass pass pass pass pass pass same
net:run_netsocktests pass pass pass pass pass pass same
net:rxtimestamp.sh pass pass pass pass pass pass same
net:so_txtime.sh fail fail fail fail fail fail same
net:test_bpf.sh pass pass pass pass pass pass same
net:test_vxlan_fdb_changelink.sh pass pass pass pass pass pass same
net:tls pass pass pass pass pass pass same
net:traceroute.sh pass pass pass pass pass pass same
net:txtimestamp.sh fail fail fail fail fail fail same
net:udpgro.sh pass pass pass pass pass pass same
net:udpgro_bench.sh pass pass pass pass pass pass same
net:udpgro_fwd.sh fail fail fail fail fail fail same
net:udpgso.sh pass pass pass pass pass pass same
net:udpgso_bench.sh skip skip skip skip skip skip same
net:veth.sh pass pass pass pass pass pass same
net:vrf-xfrm-tests.sh pass pass pass pass pass pass same
net:xfrm_policy.sh skip skip skip skip skip skip same
netfilter:conntrack_icmp_related.sh skip skip skip same
netfilter:conntrack_tcp_unreplied.sh skip skip skip same
netfilter:ipvs.sh skip skip skip same
netfilter:nft_flowtable.sh skip skip skip same
netfilter:nft_meta.sh skip skip skip same
netfilter:nft_nat.sh skip skip skip same
netfilter:nft_queue.sh skip skip skip same
netfilter:nft_trans_stress.sh skip skip skip same
nsfs:owner pass pass pass same
nsfs:pidns pass pass pass same
pstore:pstore_post_reboot_tests skip skip skip same
pstore:pstore_tests fail fail fail same
ptrace:peeksiginfo pass pass pass same
ptrace:vmaccess fail fail fail same
rseq:basic_percpu_ops_test pass pass pass same
rseq:basic_test pass pass pass same
rseq:param_test pass pass pass same
rseq:param_test_benchmark pass pass pass same
rseq:param_test_compare_twice pass pass pass same
rseq:run_param_test.sh fail fail fail same
rtc:rtctest pass pass pass same
sgx:test_sgx fail fail fail same
sigaltstack:sas pass pass pass same
size:get_size pass pass pass same
splice:default_file_splice_read.sh pass pass pass same
static_keys:test_static_keys.sh skip skip skip same
sync:sync_test skip skip skip same
sysctl:sysctl.sh skip skip skip same
tc-testing:tdc.sh fail fail fail same
timens:clock_nanosleep pass pass pass same
timens:exec pass pass pass same
timens:procfs pass pass pass same
timens:timens pass pass pass same
timens:timer pass pass pass same
timens:timerfd pass pass pass same
timers:inconsistency-check fail fail fail same
timers:mqueue-lat pass pass pass same
timers:nanosleep pass pass pass same
timers:nsleep-lat fail fail fail same
timers:posix_timers pass pass pass same
timers:raw_skew fail fail fail same
timers:rtcpie pass pass pass same
timers:set-timer-lat fail fail fail same
timers:threadtest pass pass pass same
tpm2:test_smoke.sh fail fail fail same
tpm2:test_space.sh fail fail fail same
user:test_user_copy.sh skip skip skip same
vm:run_vmtests fail fail fail same
x86:amx_64 fail fail fail same
x86:check_initial_reg_state_64 pass pass pass same
x86:corrupt_xstate_header_64 pass pass pass same
x86:fsgsbase_64 pass pass pass same
x86:fsgsbase_restore_64 pass pass pass same
x86:ioperm_64 pass pass pass same
x86:iopl_64 pass pass pass same
x86:mov_ss_trap_64 pass pass pass same
x86:mpx-mini-test_64 fail fail fail same
x86:protection_keys_64 pass pass pass same
x86:sigaltstack_64 pass pass pass same
x86:sigreturn_64 pass pass pass same
x86:single_step_syscall_64 pass pass pass same
x86:syscall_nt_64 pass pass pass same
x86:sysret_rip_64 pass pass pass same
x86:sysret_ss_attrs_64 pass pass pass same
x86:test_mremap_vdso_64 pass pass pass same
x86:test_vdso_64 pass pass pass same
x86:test_vsyscall_64 pass pass pass same
zram:zram.sh pass pass pass same

However, the passing net:reuseport_addr_any.sh test on the reference kernel when used in the installed form (see section below) suggests that the passing result for the patched kernel is not related to the change in any way.

Installed selftests

A series of 2 test runs were conducted on the reference LTS 8.6 RT kernel ciqlts8_6-rt (5d362bf39d935ad7de47fa83661d2965e54ae013) with the tests proven to be unstable before omitted: bpf:test_progs, bpf:test_sockmap.

kselftests–source-installed–ciqlts8_6-rt–run1.log
kselftests–source-installed–ciqlts8_6-rt–run2.log

It was found that the kvm:hardware_disable_test was flappy. Additionally, multiple tests behaved differently when run in this mode compared to the tests run with make.

xonsh ktests.xsh table \
kselftests--source--ciqlts8_6-rt--run1.log \
kselftests--source--ciqlts8_6-rt--run2.log \
kselftests--source-installed--ciqlts8_6-rt--run2.log \
kselftests--source-installed--ciqlts8_6-rt--run1.log \
--where "Summary = 'diff'" \
--omit-tests ipc:msgque net:gro.sh bpf:test_progs bpf:test_sockmap kvm:hardware_disable_test
Column File
-------- ----------------------------------------------------
Status0 kselftests--source--ciqlts8_6-rt--run1.log
Status1 kselftests--source--ciqlts8_6-rt--run2.log
Status2 kselftests--source-installed--ciqlts8_6-rt--run2.log
Status3 kselftests--source-installed--ciqlts8_6-rt--run1.log
TestCase Status0 Status1 Status2 Status3 Summary
bpf:test_doc_build.sh pass pass fail fail diff
bpf:test_lwt_ip_encap.sh pass pass fail fail diff
bpf:test_lwt_seg6local.sh pass pass fail fail diff
bpf:test_xdping.sh pass pass fail fail diff
firmware:fw_run_tests.sh skip skip fail fail diff
net:reuseport_addr_any.sh fail fail fail pass diff
rseq:basic_percpu_ops_test pass pass fail fail diff
rseq:basic_test pass pass fail fail diff
rseq:param_test pass pass fail fail diff
rseq:param_test_benchmark pass pass fail fail diff
rseq:param_test_compare_twice pass pass fail fail diff

The reasons were investigated cursorily and they ranged from conditional "skipping" of some tests (eg. bpf:test_lwt_seg6local.sh) which showed as passing when invoked with make to what seems like an erroneous installation (rseq).

The full picture is provided at https://docs.google.com/spreadsheets/d/1tUwJ2rV57cYZXh7momPtraSjZcHDjMYHLeHA3DYWrUU/edit?pli=1&gid=0#gid=0&range=E:E.

These results show that the tests ran directly from kernel source and the tests ran with run_kselftest.sh after installation are not interchangable in a straightforward manner.

Additional tests: none

Following the guidelines from the precedent #41.

Footnotes

1GHSA-pf87-6c9q-jvm4

jira VULN-205
cve CVE-2022-42896
commit-author Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
commit f937b75
l2cap_global_chan_by_psm shall not return fixed channels as they are not
meant to be connected by (S)PSM.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
(cherry picked from commit f937b75)
Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
@PlaidCat
PlaidCat requested review from PlaidCat, bmastbergen, gmkurtzer and gvrose8192 and removed request for gmkurtzerJanuary 28, 2025 14:59

@gvrose8192gvrose8192 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - Thanks

@PlaidCat
PlaidCat merged commit e1a9851 into ctrliq:ciqlts8_6-rtJan 28, 2025
github-actionsBot pushed a commit that referenced this pull request Aug 1, 2025
damon_migrate_pages() tries migration even if the target node is invalid. If users mistakenly make such invalid requests via
DAMOS_MIGRATE_{HOT,COLD} action, the below kernel BUG can happen.
[ 7831.883495] BUG: unable to handle page fault for address: 0000000000001f48
[ 7831.884160] #PF: supervisor read access in kernel mode
[ 7831.884681] #PF: error_code(0x0000) - not-present page
[ 7831.885203] PGD 0 P4D 0
[ 7831.885468] Oops: Oops: 0000 [#1] SMP PTI
[ 7831.885852] CPU: 31 UID: 0 PID: 94202 Comm: kdamond.0 Not tainted 6.16.0-rc5-mm-new-damon+ #93 PREEMPT(voluntary)
[ 7831.886913] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-4.el9 04/01/2014
[ 7831.887777] RIP: 0010:__alloc_frozen_pages_noprof (include/linux/mmzone.h:1724 include/linux/mmzone.h:1750 mm/page_alloc.c:4936 mm/page_alloc.c:5137)
[...]
[ 7831.895953] Call Trace:
[ 7831.896195] <TASK>
[ 7831.896397] __folio_alloc_noprof (mm/page_alloc.c:5183 mm/page_alloc.c:5192)
[ 7831.896787] migrate_pages_batch (mm/migrate.c:1189 mm/migrate.c:1851)
[ 7831.897228] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.897735] migrate_pages (mm/migrate.c:2078)
[ 7831.898141] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.898664] damon_migrate_folio_list (mm/damon/ops-common.c:321 mm/damon/ops-common.c:354)
[ 7831.899140] damon_migrate_pages (mm/damon/ops-common.c:405)
[...]
Add a target node validity check in damon_migrate_pages(). The validity
check is stolen from that of do_pages_move(), which is being used for the
move_pages() system call.
Link: https://lkml.kernel.org/r/20250720185822.1451-1-sj@kernel.org
Fixes: b51820e ("mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion")	[6.11.x]
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Honggyu Kim <honggyu.kim@sk.com>
Cc: Hyeongtak Ji <hyeongtak.ji@sk.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
github-actionsBot pushed a commit that referenced this pull request Aug 29, 2025
commit 7e6c313 upstream.
damon_migrate_pages() tries migration even if the target node is invalid.
If users mistakenly make such invalid requests via
DAMOS_MIGRATE_{HOT,COLD} action, the below kernel BUG can happen.
[ 7831.883495] BUG: unable to handle page fault for address: 0000000000001f48
[ 7831.884160] #PF: supervisor read access in kernel mode
[ 7831.884681] #PF: error_code(0x0000) - not-present page
[ 7831.885203] PGD 0 P4D 0
[ 7831.885468] Oops: Oops: 0000 [#1] SMP PTI
[ 7831.885852] CPU: 31 UID: 0 PID: 94202 Comm: kdamond.0 Not tainted 6.16.0-rc5-mm-new-damon+ #93 PREEMPT(voluntary)
[ 7831.886913] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-4.el9 04/01/2014
[ 7831.887777] RIP: 0010:__alloc_frozen_pages_noprof (include/linux/mmzone.h:1724 include/linux/mmzone.h:1750 mm/page_alloc.c:4936 mm/page_alloc.c:5137)
[...]
[ 7831.895953] Call Trace:
[ 7831.896195] <TASK>
[ 7831.896397] __folio_alloc_noprof (mm/page_alloc.c:5183 mm/page_alloc.c:5192)
[ 7831.896787] migrate_pages_batch (mm/migrate.c:1189 mm/migrate.c:1851)
[ 7831.897228] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.897735] migrate_pages (mm/migrate.c:2078)
[ 7831.898141] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.898664] damon_migrate_folio_list (mm/damon/ops-common.c:321 mm/damon/ops-common.c:354)
[ 7831.899140] damon_migrate_pages (mm/damon/ops-common.c:405)
[...]
Add a target node validity check in damon_migrate_pages(). The validity
check is stolen from that of do_pages_move(), which is being used for the
move_pages() system call.
Link: https://lkml.kernel.org/r/20250720185822.1451-1-sj@kernel.org
Fixes: b51820e ("mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion")	[6.11.x]
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Honggyu Kim <honggyu.kim@sk.com>
Cc: Hyeongtak Ji <hyeongtak.ji@sk.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
github-actionsBot pushed a commit that referenced this pull request Jan 3, 2026
[ Upstream commit 24e17a2 ]
The xfstests' test-case generic/073 leaves HFS+ volume
in corrupted state:
sudo ./check generic/073
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.17.0-rc1+ #4 SMP PREEMPT_DYNAMIC Wed Oct 1 15:02:44 PDT 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/073 _check_generic_filesystem: filesystem on /dev/loop51 is inconsistent
(see XFSTESTS-2/xfstests-dev/results//generic/073.full for details)
Ran: generic/073
Failures: generic/073
Failed 1 of 1 tests
sudo fsck.hfsplus -d /dev/loop51
** /dev/loop51
Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
Executing fsck_hfs (version 540.1-Linux).
** Checking non-journaled HFS Plus Volume.
The volume name is untitled
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
Invalid directory item count
(It should be 1 instead of 0)
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
Verify Status: VIStat = 0x0000, ABTStat = 0x0000 EBTStat = 0x0000
CBTStat = 0x0000 CatStat = 0x00004000
** Repairing volume.
** Rechecking volume.
** Checking non-journaled HFS Plus Volume.
The volume name is untitled
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume untitled was repaired successfully.
The test is doing these steps on final phase:
mv $SCRATCH_MNT/testdir_1/bar $SCRATCH_MNT/testdir_2/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir_1
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
So, we move file bar from testdir_1 into testdir_2 folder. It means that HFS+
logic decrements the number of entries in testdir_1 and increments number of
entries in testdir_2. Finally, we do fsync only for testdir_1 and foo but not
for testdir_2. As a result, this is the reason why fsck.hfsplus detects the
volume corruption afterwards.
This patch fixes the issue by means of adding the
hfsplus_cat_write_inode() call for old_dir and new_dir in
hfsplus_rename() after the successful ending of
hfsplus_rename_cat(). This method makes modification of in-core
inode objects for old_dir and new_dir but it doesn't save these
modifications in Catalog File's entries. It was expected that
hfsplus_write_inode() will save these modifications afterwards.
However, because generic/073 does fsync only for testdir_1 and foo
then testdir_2 modification hasn't beed saved into Catalog File's
entry and it was flushed without this modification. And it was
detected by fsck.hfsplus. Now, hfsplus_rename() stores in Catalog
File all modified entries and correct state of Catalog File will
be flushed during hfsplus_file_fsync() call. Finally, it makes
fsck.hfsplus happy.
sudo ./check generic/073
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.18.0-rc3+ #93 SMP PREEMPT_DYNAMIC Wed Nov 12 14:37:49 PST 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/073 32s ... 32s
Ran: generic/073
Passed all 1 tests
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cc: Yangtao Li <frank.li@vivo.com>
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20251112232522.814038-1-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
github-actionsBot pushed a commit that referenced this pull request Jan 8, 2026
[ Upstream commit 24e17a2 ]
The xfstests' test-case generic/073 leaves HFS+ volume
in corrupted state:
sudo ./check generic/073
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.17.0-rc1+ #4 SMP PREEMPT_DYNAMIC Wed Oct 1 15:02:44 PDT 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/073 _check_generic_filesystem: filesystem on /dev/loop51 is inconsistent
(see XFSTESTS-2/xfstests-dev/results//generic/073.full for details)
Ran: generic/073
Failures: generic/073
Failed 1 of 1 tests
sudo fsck.hfsplus -d /dev/loop51
** /dev/loop51
Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
Executing fsck_hfs (version 540.1-Linux).
** Checking non-journaled HFS Plus Volume.
The volume name is untitled
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
Invalid directory item count
(It should be 1 instead of 0)
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
Verify Status: VIStat = 0x0000, ABTStat = 0x0000 EBTStat = 0x0000
CBTStat = 0x0000 CatStat = 0x00004000
** Repairing volume.
** Rechecking volume.
** Checking non-journaled HFS Plus Volume.
The volume name is untitled
** Checking extents overflow file.
** Checking catalog file.
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume untitled was repaired successfully.
The test is doing these steps on final phase:
mv $SCRATCH_MNT/testdir_1/bar $SCRATCH_MNT/testdir_2/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/testdir_1
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
So, we move file bar from testdir_1 into testdir_2 folder. It means that HFS+
logic decrements the number of entries in testdir_1 and increments number of
entries in testdir_2. Finally, we do fsync only for testdir_1 and foo but not
for testdir_2. As a result, this is the reason why fsck.hfsplus detects the
volume corruption afterwards.
This patch fixes the issue by means of adding the
hfsplus_cat_write_inode() call for old_dir and new_dir in
hfsplus_rename() after the successful ending of
hfsplus_rename_cat(). This method makes modification of in-core
inode objects for old_dir and new_dir but it doesn't save these
modifications in Catalog File's entries. It was expected that
hfsplus_write_inode() will save these modifications afterwards.
However, because generic/073 does fsync only for testdir_1 and foo
then testdir_2 modification hasn't beed saved into Catalog File's
entry and it was flushed without this modification. And it was
detected by fsck.hfsplus. Now, hfsplus_rename() stores in Catalog
File all modified entries and correct state of Catalog File will
be flushed during hfsplus_file_fsync() call. Finally, it makes
fsck.hfsplus happy.
sudo ./check generic/073
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.18.0-rc3+ #93 SMP PREEMPT_DYNAMIC Wed Nov 12 14:37:49 PST 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/073 32s ... 32s
Ran: generic/073
Passed all 1 tests
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cc: Yangtao Li <frank.li@vivo.com>
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20251112232522.814038-1-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
github-actionsBot pushed a commit that referenced this pull request Aug 15, 2026
JIRA: https://redhat.atlassian.net/browse/RHEL-145695
CVE: CVE-2025-39700
commit 7e6c313
Author: SeongJae Park <sj@kernel.org>
Date: Sun Jul 20 11:58:22 2025 -0700
mm/damon/ops-common: ignore migration request to invalid nodes
damon_migrate_pages() tries migration even if the target node is invalid.
If users mistakenly make such invalid requests via
DAMOS_MIGRATE_{HOT,COLD} action, the below kernel BUG can happen.
[ 7831.883495] BUG: unable to handle page fault for address: 0000000000001f48
[ 7831.884160] #PF: supervisor read access in kernel mode
[ 7831.884681] #PF: error_code(0x0000) - not-present page
[ 7831.885203] PGD 0 P4D 0
[ 7831.885468] Oops: Oops: 0000 [#1] SMP PTI
[ 7831.885852] CPU: 31 UID: 0 PID: 94202 Comm: kdamond.0 Not tainted 6.16.0-rc5-mm-new-damon+ #93 PREEMPT(voluntary)
[ 7831.886913] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-4.el9 04/01/2014
[ 7831.887777] RIP: 0010:__alloc_frozen_pages_noprof (include/linux/mmzone.h:1724 include/linux/mmzone.h:1750 mm/page_alloc.c:4936 mm/page_alloc.c:5137)
[...]
[ 7831.895953] Call Trace:
[ 7831.896195] <TASK>
[ 7831.896397] __folio_alloc_noprof (mm/page_alloc.c:5183 mm/page_alloc.c:5192)
[ 7831.896787] migrate_pages_batch (mm/migrate.c:1189 mm/migrate.c:1851)
[ 7831.897228] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.897735] migrate_pages (mm/migrate.c:2078)
[ 7831.898141] ? __pfx_alloc_migration_target (mm/migrate.c:2137)
[ 7831.898664] damon_migrate_folio_list (mm/damon/ops-common.c:321 mm/damon/ops-common.c:354)
[ 7831.899140] damon_migrate_pages (mm/damon/ops-common.c:405)
[...]
Add a target node validity check in damon_migrate_pages(). The validity
check is stolen from that of do_pages_move(), which is being used for the
move_pages() system call.
Link: https://lkml.kernel.org/r/20250720185822.1451-1-sj@kernel.org
Fixes: b51820e ("mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion") [6.11.x]
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Honggyu Kim <honggyu.kim@sk.com>
Cc: Hyeongtak Ji <hyeongtak.ji@sk.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rafael Aquini <raquini@redhat.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@pvts-mat@gvrose8192@bmastbergen@PlaidCat