GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Prevent segfaults by adding macOS weaklinking for mkfifoat and mknodat system calls added in macOS 13 Ventura · Issue #97897 · python/cpython

Prevent segfaults by adding macOS weaklinking for mkfifoat and mknodat system calls added in macOS 13 Ventura #97897

New issue
Copy link
New issue
Copy link
Closed
Closed
Prevent segfaults by adding macOS weaklinking for mkfifoat and mknodat system calls added in macOS 13 Ventura#97897
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeOS-macrelease-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@ned-deily
ned-deily
opened on Oct 5, 2022
Issue body actions

macOS 13 Ventura adds support for the POSIX mkfifoat and mknodat system calls which are used in the Python os module via posixmodule.c when available on the OS. In order to continue to support building Python on a newer macOS version to also run on older systems, we need to add weaklinking support for them in posixmodule.c as was done for other similar system calls added in recent macOS releases.

Unfortunately, while macOS 13 has not yet been released as of this moment, Apple has pushed out a new version of the Command Line Tools for macOS 12 Monterey, Command Line Tools beta 3 for Xcode 14.1, which changes the default macOS SDK version to MacOSX13.0. When building on macOS 12 with the macOS 13 SDK, posixmodule compiles support for mkfifoat and mknodat which will cause Python segfaults when attempting to use the dir_fd option of os.mkfifo() or os.mknod() on macOS 12 (or older). An easily overlooked symptom of the problem is the following set of warning messages during compilation:

./Modules/posixmodule.c:10627:22: warning: 'mkfifoat' is only available on macOS 13.0 or newer [-Wunguarded-availability-new]
            result = mkfifoat(dir_fd, path->narrow, mode);
                     ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h:394:9: note: 'mkfifoat' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 12.6.0
int     mkfifoat(int, const char *, mode_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0));
        ^
./Modules/posixmodule.c:10627:22: note: enclose 'mkfifoat' in a __builtin_available check to silence this warning
            result = mkfifoat(dir_fd, path->narrow, mode);
                     ^~~~~~~~
./Modules/posixmodule.c:10679:22: warning: 'mknodat' is only available on macOS 13.0 or newer [-Wunguarded-availability-new]
            result = mknodat(dir_fd, path->narrow, mode, device);
                     ^~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h:395:9: note: 'mknodat' has been marked as being introduced in macOS 13.0 here, but the deployment target is macOS 12.6.0
int     mknodat(int, const char *, mode_t, dev_t) __API_AVAILABLE(macos(13.0), ios(16.0), tvos(16.0), watchos(9.0));
        ^
./Modules/posixmodule.c:10679:22: note: enclose 'mknodat' in a __builtin_available check to silence this warning
            result = mknodat(dir_fd, path->narrow, mode, device);
                     ^~~~~~~

One workaround is to force use of the macOS 12 SDK:

SDKROOT=$(xcrun --show-sdk-path --sdk macosx12.3) ./configure ...

Activity

Next
  1. ned-deily
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    OS-mac
    needs backport to 3.10
    3.11only security fixesonly security fixes
    3.10 (EOL)end of lifeend of life
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    3.12only security fixesonly security fixes
    needs backport to 3.11only security fixesonly security fixes
    on Oct 5, 2022
  2. ned-deily commented on Oct 5, 2022

    @ned-deily
    ned-deily
    on Oct 5, 2022
    MemberAuthor
    More actions

    Since this could potentially cause segfaults on 3.9, perhaps a 3.9 backport should be considered (@ambv ?). (We do not support this kind of macOS weaklinking on 3.8 and earlier systems.)

  3. ned-deily
    added a commit that references this issue on Oct 5, 2022

    pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    1dba762
  4. miss-islington
    added a commit that references this issue on Oct 6, 2022

    pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    395d22d
  5. ned-deily
    added a commit that references this issue on Oct 6, 2022

    gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (G…

    6d0a019
  6. miss-islington
    added 2 commits that reference this issue on Oct 6, 2022

    pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    989a5a6

    pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    3e1b032
  7. ned-deily
    added
    release-blocker
    on Oct 6, 2022
  8. 2 remaining items

  9. ezio-melotti
    moved this to Todo in Release and Deferred blockers 🚫on Oct 6, 2022
  10. ned-deily commented on Oct 6, 2022

    @ned-deily
    ned-deily
    on Oct 6, 2022
    MemberAuthor
    More actions

    Marking as release blocker for @pablogsal's review with regard to 3.11.0.

  11. ned-deily
    removed
    needs backport to 3.10
    needs backport to 3.11only security fixesonly security fixes
    on Oct 6, 2022
  12. carljm
    added a commit that references this issue on Oct 6, 2022

    Merge branch 'main' into dictwatch

    7938d6f
  13. ambv
    added 3 commits that reference this issue on Oct 6, 2022

    [3.11] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS …

    6057030

    [3.10] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS …

    3d89ac2

    [3.9] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    77796d0
  14. ned-deily commented on Oct 7, 2022

    @ned-deily
    ned-deily
    on Oct 7, 2022
    MemberAuthor
    More actions

    Backports to all current branches have been merged.

  15. ned-deily
    closed this as completedon Oct 7, 2022
  16. Repository owner moved this from Todo to Done in Release and Deferred blockers 🚫on Oct 7, 2022
  17. carljm
    added a commit that references this issue on Oct 8, 2022

    Merge branch 'main' into typewatch

    1af2a98
  18. mpage
    added a commit that references this issue on Oct 11, 2022

    pythongh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 1…

    79fbf97
  19. pablogsal
    added a commit that references this issue on Oct 22, 2022

    [3.11] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS …

    84fd4a5
  20. rt121212121
    added a commit that references this issue on May 11, 2023

    Update MacOS for building the installer using Python 3.9.16.

    d3465e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeOS-macrelease-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or errortype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

    Projects

    • Release and Deferred blockers 🚫
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.