CWE
416
Advisory Published
Updated

REDHAT-BUG-1523481: Use After Free

First published: Fri Dec 08 2017(Updated: )

A flaw was found in the Linux kernels handling of fork failure when dealing with event messages in the userfaultfd code. Failure to fork correctly can lead to a situation where a fork event will be removed from an already freed list of events with userfaultfd_ctx_put(). The userfault events are part of the slab cache, and the secondary free could only free other event list objects as the free mechanism uses the underlying kmem_cache_* implementation making generic use-after-free style attacks less effective. While technically a use after free style flaw, at this time Red Hat Product security believes this flaw to be difficult to exploit but this may change in the future. From the commit: When reading the event from the uffd, we put it on a temporary fork_event list to detect if we can still access it after releasing and retaking the event_wqh.lock. If fork aborts and removes the event from the fork_event all is fine as long as we're still in the userfault read context and fork_event head is still alive. We've [forgotten] to put the event allocated in the fork kernel stack, back from fork_event list-head to the event_wqh head, before returning from userfaultfd_ctx_read, because the fork_event head lifetime is limited to the userfaultfd_ctx_read stack lifetime. Forgetting to move the event back to its event_wqh place then results in __remove_wait_queue(&amp;ctx-&gt;event_wqh, &amp;ewq-&gt;wq); in userfaultfd_event_wait_completion to remove it from a head that has been already freed from the reader stack. This could only happen if resolve_userfault_fork failed (for example if there are no file descriptors available to allocate the fork uffd). If it succeeded it was put back correctly. Furthermore, after find_userfault_evt receives a fork event, the forked userfault context in fork_nctx and uwq-&gt;msg.arg.reserved.reserved1 can be released by the fork thread as soon as the event_wqh.lock is released. Taking a reference on the fork_nctx before dropping the lock prevents an use after free in resolve_userfault_fork(). If the fork side aborted and it already released everything, we still try to succeed resolve_userfault_fork(), if possible. -- end --- References: <a href="https://marc.info/?t=150351212000001&amp;r=1&amp;w=2">https://marc.info/?t=150351212000001&amp;r=1&amp;w=2</a> An upstream patch: <a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=384632e67e0829deb8015ee6ad916b180049d252">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=384632e67e0829deb8015ee6ad916b180049d252</a>

Affected SoftwareAffected VersionHow to fix
Red Hat Linux

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the severity of REDHAT-BUG-1523481?

    The severity of REDHAT-BUG-1523481 is classified as moderate due to potential impacts on userfaultfd functionalities.

  • How do I fix REDHAT-BUG-1523481?

    The fix for REDHAT-BUG-1523481 involves updating the Linux kernel to the latest patched version provided by Red Hat.

  • What causes the issue in REDHAT-BUG-1523481?

    REDHAT-BUG-1523481 is caused by improper handling of fork failures in the userfaultfd code leading to potential instability.

  • Which versions of Red Hat Linux Kernel are affected by REDHAT-BUG-1523481?

    REDHAT-BUG-1523481 affects specific versions of the Red Hat Linux Kernel that implement the userfaultfd functionality.

  • Is there a workaround for REDHAT-BUG-1523481?

    Currently, there are no known workarounds for REDHAT-BUG-1523481, and updating the kernel is recommended.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203