https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127753

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:936b982b9edf19ce66a42f6a5f3e4a50b160facc

commit r17-5282-g936b982b9edf19ce66a42f6a5f3e4a50b160facc
Author: Jerry DeLisle <[email protected]>
Date:   Mon Oct 5 11:06:08 2026 -0700

    libgfortran: [PR127753] caf_shmem: do not leak the shared memory object

    When the supervisor was stopped by a signal, for example by a timeout or
    ^C, it exited without unlinking the shared memory object, so the object
    was left behind in /dev/shm.

    The supervisor now passes the descriptor of the object to the images and
    removes its name right after creating it, so that the object goes away
    with the last process however the program ends.  The mapping is excluded
    from core dumps, because the kernel dumps an unlinked object like
    anonymous memory, which would write out the whole pool.

    Assisted-by: Claude Opus 5.5

            PR libfortran/127753

    libgfortran/ChangeLog:

            * caf/shmem/shared_memory.c (ENV_FD): New.
            (shared_memory_init): Pass the descriptor to the images through
            ENV_FD and unlink the object.  Use the inherited descriptor in an
            image.  Exclude the mapping from core dumps.
            (shared_memory_cleanup): Do not unlink an unlinked object.

Reply via email to