CVE-2022-49783

In the Linux kernel, the following vulnerability has been resolved:

x86/fpu: Drop fpregs lock before inheriting FPU permissions

Mike Galbraith reported the following against an old fork of preempt-rt
but the same issue also applies to the current preempt-rt tree.

   BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46
   in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: systemd
   preempt_count: 1, expected: 0
   RCU nest depth: 0, expected: 0
   Preemption disabled at:
   fpu_clone
   CPU: 6 PID: 1 Comm: systemd Tainted: G            E       (unreleased)
   Call Trace:
    <TASK>
    dump_stack_lvl
    ? fpu_clone
    __might_resched
    rt_spin_lock
    fpu_clone
    ? copy_thread
    ? copy_process
    ? shmem_alloc_inode
    ? kmem_cache_alloc
    ? kernel_clone
    ? __do_sys_clone
    ? do_syscall_64
    ? __x64_sys_rt_sigprocmask
    ? syscall_exit_to_user_mode
    ? do_syscall_64
    ? syscall_exit_to_user_mode
    ? do_syscall_64
    ? syscall_exit_to_user_mode
    ? do_syscall_64
    ? exc_page_fault
    ? entry_SYSCALL_64_after_hwframe
    </TASK>

Mike says:

  The splat comes from fpu_inherit_perms() being called under fpregs_lock(),
  and us reaching the spin_lock_irq() therein due to fpu_state_size_dynamic()
  returning true despite static key __fpu_state_size_dynamic having never
  been enabled.

Mike's assessment looks correct. fpregs_lock on a PREEMPT_RT kernel disables
preemption so calling spin_lock_irq() in fpu_inherit_perms() is unsafe. This
problem exists since commit

  9e798e9aa14c ("x86/fpu: Prepare fpu_clone() for dynamically enabled features").

Even though the original bug report should not have enabled the paths at
all, the bug still exists.

fpregs_lock is necessary when editing the FPU registers or a task's FP
state but it is not necessary for fpu_inherit_perms(). The only write
of any FP state in fpu_inherit_perms() is for the new child which is
not running yet and cannot context switch or be borrowed by a kernel
thread yet. Hence, fpregs_lock is not protecting anything in the new
child until clone() completes and can be dropped earlier. The siglock
still needs to be acquired by fpu_inherit_perms() as the read of the
parent's permissions has to be serialised.

  [ bp: Cleanup splat. ]
ProviderTypeBase ScoreAtk. VectorAtk. ComplexityPriv. RequiredVector
NISTNIST
UNKNOWN
---
LinuxCNA
---
---
Awaiting analysis
This vulnerability is currently awaiting analysis.
Base Score
CVSS 3.x
EPSS Score
Percentile: 3%
Debian logo
Debian Releases
Debian Product
Codename
linux
bullseye
5.10.223-1
not-affected
bullseye (security)
5.10.234-1
fixed
bookworm
6.1.129-1
fixed
bookworm (security)
6.1.135-1
fixed
trixie
6.12.22-1
fixed
sid
6.12.25-1
fixed
Ubuntu logo
Ubuntu Releases
Ubuntu Product
Codename
linux
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
xenial
needs-triage
trusty
needs-triage
linux-allwinner-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-aws
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
xenial
needs-triage
trusty
needs-triage
linux-aws-5.0
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-aws-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-aws-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-aws-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-aws-5.3
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-aws-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-aws-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-aws-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-aws-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-aws-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-aws-fips
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
linux-aws-hwe
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
xenial
needs-triage
linux-azure
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
bionic
ignored
xenial
needs-triage
trusty
needs-triage
linux-azure-4.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-azure-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-azure-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-azure-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-azure-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-azure-5.3
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-azure-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-azure-6.11
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-azure-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-azure-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-azure-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-azure-edge
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-azure-fde
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
ignored
linux-azure-fde-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-azure-fde-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-azure-fde-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-azure-fips
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
linux-azure-nvidia
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-bluefield
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-fips
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
xenial
needs-triage
linux-gcp
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
bionic
ignored
xenial
needs-triage
linux-gcp-4.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-gcp-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-gcp-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-gcp-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-gcp-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-gcp-5.3
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-gcp-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-gcp-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-gcp-6.11
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-gcp-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-gcp-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-gcp-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-gcp-fips
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
linux-gke
plucky
dne
oracular
dne
noble
needs-triage
jammy
needs-triage
focal
ignored
linux-gke-4.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-gke-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-gke-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-gkeop
plucky
dne
oracular
dne
noble
needs-triage
jammy
needs-triage
focal
ignored
linux-gkeop-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-gkeop-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-hwe
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
xenial
needs-triage
linux-hwe-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-hwe-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-hwe-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-hwe-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-hwe-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-hwe-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-hwe-6.11
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-hwe-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-hwe-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-hwe-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-hwe-edge
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
xenial
ignored
linux-ibm
plucky
dne
oracular
dne
noble
needs-triage
jammy
needs-triage
focal
needs-triage
linux-ibm-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-ibm-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-intel-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-intel-iot-realtime
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-intel-iotg
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-intel-iotg-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-iot
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-kvm
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
xenial
needs-triage
linux-lowlatency
plucky
dne
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
dne
linux-lowlatency-hwe-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-lowlatency-hwe-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.11
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-lowlatency-hwe-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-lowlatency-hwe-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-lts-xenial
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
trusty
needs-triage
linux-nvidia
plucky
dne
oracular
dne
noble
needs-triage
jammy
needs-triage
focal
dne
linux-nvidia-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-nvidia-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-nvidia-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-nvidia-lowlatency
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-nvidia-tegra
plucky
dne
oracular
dne
noble
needs-triage
jammy
needs-triage
focal
dne
linux-nvidia-tegra-igx
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-oem
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-oem-5.10
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oem-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oem-5.14
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oem-5.17
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-oem-5.6
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oem-6.0
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-oem-6.1
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-oem-6.11
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-oem-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-oem-6.8
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-oracle
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
bionic
needs-triage
xenial
needs-triage
linux-oracle-5.0
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oracle-5.13
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oracle-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-oracle-5.3
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
ignored
linux-oracle-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-oracle-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-oracle-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-oracle-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-raspi
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
needs-triage
linux-raspi-5.4
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
dne
bionic
needs-triage
linux-raspi-realtime
plucky
dne
oracular
dne
noble
needs-triage
jammy
dne
focal
dne
linux-raspi2
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-realtime
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
needs-triage
focal
dne
linux-riscv
plucky
needs-triage
oracular
needs-triage
noble
needs-triage
jammy
ignored
focal
ignored
linux-riscv-5.11
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-riscv-5.15
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
needs-triage
linux-riscv-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-riscv-5.8
plucky
dne
oracular
dne
noble
dne
jammy
dne
focal
ignored
linux-riscv-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-riscv-6.8
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
dne
linux-starfive-5.19
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-starfive-6.2
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-starfive-6.5
plucky
dne
oracular
dne
noble
dne
jammy
ignored
focal
dne
linux-xilinx-zynqmp
plucky
dne
oracular
dne
noble
dne
jammy
needs-triage
focal
needs-triage