{
  "threat_severity" : "Moderate",
  "public_date" : "2024-05-21T00:00:00Z",
  "bugzilla" : {
    "description" : "kernel: sched/psi: Fix use-after-free in ep_remove_wait_queue()",
    "id" : "2282615",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2282615"
  },
  "cvss3" : {
    "cvss3_base_score" : "7.0",
    "cvss3_scoring_vector" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
    "status" : "verified"
  },
  "cwe" : "CWE-416",
  "details" : [ "In the Linux kernel, the following vulnerability has been resolved:\nsched/psi: Fix use-after-free in ep_remove_wait_queue()\nIf a non-root cgroup gets removed when there is a thread that registered\ntrigger and is polling on a pressure file within the cgroup, the polling\nwaitqueue gets freed in the following path:\ndo_rmdir\ncgroup_rmdir\nkernfs_drain_open_files\ncgroup_file_release\ncgroup_pressure_release\npsi_trigger_destroy\nHowever, the polling thread still has a reference to the pressure file and\nwill access the freed waitqueue when the file is closed or upon exit:\nfput\nep_eventpoll_release\nep_free\nep_remove_wait_queue\nremove_wait_queue\nThis results in use-after-free as pasted below.\nThe fundamental problem here is that cgroup_file_release() (and\nconsequently waitqueue's lifetime) is not tied to the file's real lifetime.\nUsing wake_up_pollfree() here might be less than ideal, but it is in line\nwith the comment at commit 42288cb44c4b (\"wait: add wake_up_pollfree()\")\nsince the waitqueue's lifetime is not tied to file's one and can be\nconsidered as another special case. While this would be fixable by somehow\nmaking cgroup_file_release() be tied to the fput(), it would require\nsizable refactoring at cgroups or higher layer which might be more\njustifiable if we identify more cases like this.\nBUG: KASAN: use-after-free in _raw_spin_lock_irqsave+0x60/0xc0\nWrite of size 4 at addr ffff88810e625328 by task a.out/4404\nCPU: 19 PID: 4404 Comm: a.out Not tainted 6.2.0-rc6 #38\nHardware name: Amazon EC2 c5a.8xlarge/, BIOS 1.0 10/16/2017\nCall Trace:\n<TASK>\ndump_stack_lvl+0x73/0xa0\nprint_report+0x16c/0x4e0\nkasan_report+0xc3/0xf0\nkasan_check_range+0x2d2/0x310\n_raw_spin_lock_irqsave+0x60/0xc0\nremove_wait_queue+0x1a/0xa0\nep_free+0x12c/0x170\nep_eventpoll_release+0x26/0x30\n__fput+0x202/0x400\ntask_work_run+0x11d/0x170\ndo_exit+0x495/0x1130\ndo_group_exit+0x100/0x100\nget_signal+0xd67/0xde0\narch_do_signal_or_restart+0x2a/0x2b0\nexit_to_user_mode_prepare+0x94/0x100\nsyscall_exit_to_user_mode+0x20/0x40\ndo_syscall_64+0x52/0x90\nentry_SYSCALL_64_after_hwframe+0x63/0xcd\n</TASK>\nAllocated by task 4404:\nkasan_set_track+0x3d/0x60\n__kasan_kmalloc+0x85/0x90\npsi_trigger_create+0x113/0x3e0\npressure_write+0x146/0x2e0\ncgroup_file_write+0x11c/0x250\nkernfs_fop_write_iter+0x186/0x220\nvfs_write+0x3d8/0x5c0\nksys_write+0x90/0x110\ndo_syscall_64+0x43/0x90\nentry_SYSCALL_64_after_hwframe+0x63/0xcd\nFreed by task 4407:\nkasan_set_track+0x3d/0x60\nkasan_save_free_info+0x27/0x40\n____kasan_slab_free+0x11d/0x170\nslab_free_freelist_hook+0x87/0x150\n__kmem_cache_free+0xcb/0x180\npsi_trigger_destroy+0x2e8/0x310\ncgroup_file_release+0x4f/0xb0\nkernfs_drain_open_files+0x165/0x1f0\nkernfs_drain+0x162/0x1a0\n__kernfs_remove+0x1fb/0x310\nkernfs_remove_by_name_ns+0x95/0xe0\ncgroup_addrm_files+0x67f/0x700\ncgroup_destroy_locked+0x283/0x3c0\ncgroup_rmdir+0x29/0x100\nkernfs_iop_rmdir+0xd1/0x140\nvfs_rmdir+0xfe/0x240\ndo_rmdir+0x13d/0x280\n__x64_sys_rmdir+0x2c/0x30\ndo_syscall_64+0x43/0x90\nentry_SYSCALL_64_after_hwframe+0x63/0xcd" ],
  "affected_release" : [ {
    "product_name" : "Red Hat Enterprise Linux 8",
    "release_date" : "2024-08-08T00:00:00Z",
    "advisory" : "RHSA-2024:5102",
    "cpe" : "cpe:/a:redhat:enterprise_linux:8::nfv",
    "package" : "kernel-rt-0:4.18.0-553.16.1.rt7.357.el8_10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "release_date" : "2024-08-08T00:00:00Z",
    "advisory" : "RHSA-2024:5101",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8",
    "package" : "kernel-0:4.18.0-553.16.1.el8_10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "release_date" : "2023-11-07T00:00:00Z",
    "advisory" : "RHSA-2023:6583",
    "cpe" : "cpe:/a:redhat:enterprise_linux:9",
    "package" : "kernel-0:5.14.0-362.8.1.el9_3"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "release_date" : "2023-11-07T00:00:00Z",
    "advisory" : "RHSA-2023:6583",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9",
    "package" : "kernel-0:5.14.0-362.8.1.el9_3"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9.2 Extended Update Support",
    "release_date" : "2024-07-24T00:00:00Z",
    "advisory" : "RHSA-2024:4823",
    "cpe" : "cpe:/a:redhat:rhel_eus:9.2",
    "package" : "kernel-0:5.14.0-284.75.1.el9_2"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9.2 Extended Update Support",
    "release_date" : "2024-07-24T00:00:00Z",
    "advisory" : "RHSA-2024:4831",
    "cpe" : "cpe:/a:redhat:rhel_eus:9.2::nfv",
    "package" : "kernel-rt-0:5.14.0-284.75.1.rt14.360.el9_2"
  } ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 6",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2023-52707\nhttps://nvd.nist.gov/vuln/detail/CVE-2023-52707\nhttps://lore.kernel.org/linux-cve-announce/2024052158-CVE-2023-52707-e048@gregkh/T" ],
  "name" : "CVE-2023-52707",
  "csaw" : false
}