util: Make files opened via `fsbridge::fopen()` not inheritable by child processes #36668

issue hebasto opened this issue on October 26, 2026
  1. hebasto commented at 3:11 PM on October 26, 2026: member

    Files opened via fsbridge::fopen() are inherited by child processes, such as -*notify or -signer commands.

    They should not be, as a child has no business with the node's open files. On POSIX systems this can be achieved with O_CLOEXEC. On Windows, with the N mode flag (_O_NOINHERIT).

    On Windows, this manifests as a functional test that passes all its cases and then fails to clean up:

    PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ‘D:\a\temp\test_runner₿🏃20261026_100424\feature_versionbits_warning_0\node0\regtest\debug.log’
    

    Previously reported in #28529 and #27352.

  2. hebasto referenced this in commit 87410b3683 on Oct 26, 2026
  3. SirECMG commented at 9:19 PM on October 27, 2026: none

    Hi @hebasto,

    I would like to help contribute to this issue. I have read your comments on adding the O_CLOEXEC (POSIX) and _O_NOINHERIT). And have added the modes in src/util/fs.cpp.

    I have tested it in Linux(OpenSUSE distro), but still need to test it in OSX and Windows. But just wanted to check with you to see if the implementation of the PR is headed in the right direction.

    #36677: link to potential fix


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-30 15:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me