{
  "threat_severity" : "Moderate",
  "public_date" : "2024-03-01T00:00:00Z",
  "bugzilla" : {
    "description" : "kernel: ipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry",
    "id" : "2267513",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2267513"
  },
  "cvss3" : {
    "cvss3_base_score" : "5.8",
    "cvss3_scoring_vector" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:H",
    "status" : "verified"
  },
  "cwe" : "CWE-362",
  "details" : [ "In the Linux kernel, the following vulnerability has been resolved:\nipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry\ndo_mq_timedreceive calls wq_sleep with a stack local address.  The\nsender (do_mq_timedsend) uses this address to later call pipelined_send.\nThis leads to a very hard to trigger race where a do_mq_timedreceive\ncall might return and leave do_mq_timedsend to rely on an invalid\naddress, causing the following crash:\nRIP: 0010:wake_q_add_safe+0x13/0x60\nCall Trace:\n__x64_sys_mq_timedsend+0x2a9/0x490\ndo_syscall_64+0x80/0x680\nentry_SYSCALL_64_after_hwframe+0x44/0xa9\nRIP: 0033:0x7f5928e40343\nThe race occurs as:\n1. do_mq_timedreceive calls wq_sleep with the address of `struct\next_wait_queue` on function stack (aliased as `ewq_addr` here) - it\nholds a valid `struct ext_wait_queue *` as long as the stack has not\nbeen overwritten.\n2. `ewq_addr` gets added to info->e_wait_q[RECV].list in wq_add, and\ndo_mq_timedsend receives it via wq_get_first_waiter(info, RECV) to call\n__pipelined_op.\n3. Sender calls __pipelined_op::smp_store_release(&this->state,\nSTATE_READY).  Here is where the race window begins.  (`this` is\n`ewq_addr`.)\n4. If the receiver wakes up now in do_mq_timedreceive::wq_sleep, it\nwill see `state == STATE_READY` and break.\n5. do_mq_timedreceive returns, and `ewq_addr` is no longer guaranteed\nto be a `struct ext_wait_queue *` since it was on do_mq_timedreceive's\nstack.  (Although the address may not get overwritten until another\nfunction happens to touch it, which means it can persist around for an\nindefinite time.)\n6. do_mq_timedsend::__pipelined_op() still believes `ewq_addr` is a\n`struct ext_wait_queue *`, and uses it to find a task_struct to pass to\nthe wake_q_add_safe call.  In the lucky case where nothing has\noverwritten `ewq_addr` yet, `ewq_addr->task` is the right task_struct.\nIn the unlucky case, __pipelined_op::wake_q_add_safe gets handed a\nbogus address as the receiver's task_struct causing the crash.\ndo_mq_timedsend::__pipelined_op() should not dereference `this` after\nsetting STATE_READY, as the receiver counterpart is now free to return.\nChange __pipelined_op to call wake_q_add_safe on the receiver's\ntask_struct returned by get_task_struct, instead of dereferencing `this`\nwhich sits on the receiver's stack.\nAs Manfred pointed out, the race potentially also exists in\nipc/msg.c::expunge_all and ipc/sem.c::wake_up_sem_queue_prepare.  Fix\nthose in the same way.", "A flaw was found in the Linux kernel’s IPC system. This flaw allows an attacker to use a specially crafted program to cause a rare race condition, leading to a denial of service." ],
  "statement" : "Red Hat Enterprise Linux 9 is not affected by this vulnerability.",
  "affected_release" : [ {
    "product_name" : "Red Hat Enterprise Linux 8",
    "release_date" : "2024-07-08T00:00:00Z",
    "advisory" : "RHSA-2024:4352",
    "cpe" : "cpe:/a:redhat:enterprise_linux:8::nfv",
    "package" : "kernel-rt-0:4.18.0-553.8.1.rt7.349.el8_10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "release_date" : "2024-07-02T00:00:00Z",
    "advisory" : "RHSA-2024:4211",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8",
    "package" : "kernel-0:4.18.0-553.8.1.el8_10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.6 Advanced Mission Critical Update Support",
    "release_date" : "2024-08-21T00:00:00Z",
    "advisory" : "RHSA-2024:5692",
    "cpe" : "cpe:/o:redhat:rhel_aus:8.6",
    "package" : "kernel-0:4.18.0-372.119.1.el8_6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.6 Telecommunications Update Service",
    "release_date" : "2024-08-21T00:00:00Z",
    "advisory" : "RHSA-2024:5692",
    "cpe" : "cpe:/o:redhat:rhel_tus:8.6",
    "package" : "kernel-0:4.18.0-372.119.1.el8_6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.6 Update Services for SAP Solutions",
    "release_date" : "2024-08-21T00:00:00Z",
    "advisory" : "RHSA-2024:5692",
    "cpe" : "cpe:/o:redhat:rhel_e4s:8.6",
    "package" : "kernel-0:4.18.0-372.119.1.el8_6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8.8 Extended Update Support",
    "release_date" : "2024-09-03T00:00:00Z",
    "advisory" : "RHSA-2024:6206",
    "cpe" : "cpe:/o:redhat:rhel_eus:8.8",
    "package" : "kernel-0:4.18.0-477.70.1.el8_8"
  } ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 6",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Out of support scope",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2021-47069\nhttps://nvd.nist.gov/vuln/detail/CVE-2021-47069\nhttps://lore.kernel.org/linux-cve-announce/2024030141-CVE-2021-47069-5797@gregkh/T/#u" ],
  "name" : "CVE-2021-47069",
  "mitigation" : {
    "value" : "Red Hat has investigated whether a possible mitigation exists for this issue, and has not been able to identify a practical example. Please update the affected package as soon as possible.",
    "lang" : "en:us"
  },
  "csaw" : false
}