Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old .so before copying new one into place #333

Merged
merged 1 commit into from
Dec 16, 2021
Merged

Remove old .so before copying new one into place #333

merged 1 commit into from
Dec 16, 2021

Conversation

JamesGuthrie
Copy link
Contributor

This is a workaround for an issue on new M1 Macs, as outlined in 1.

The basic rundown is: Apple has recently added mandatory signing of
binaries and libraries, with associated automatic signing of
locally-compiled artifacts.

The signature verification uses a static in-kernel inode-based signature
cache. Once cached, the signature associated with an inode is not
updated.

This means that by "copying over" the shared library, the kernel
compares the outdated signature (from its static cache) to the new
shared library contents.

This workaround removes the existing .so, ensuring that a new inode is
used for the newly-compiled extension .so.

Fixes #328

This is a workaround for an issue on new M1 Macs, as outlined in [1].

The basic rundown is: Apple has recently added mandatory signing of
binaries and libraries, with associated automatic signing of
locally-compiled artifacts.

The signature verification uses a static in-kernel inode-based signature
cache. Once cached, the signature associated with an inode is not
updated.

This means that by "copying over" the shared library, the kernel
compares the outdated signature (from its static cache) to the new
shared library contents.

This workaround removes the existing .so, ensuring that a new inode is
used for the newly-compiled extension .so.

Fixes #328

[1]: https://developer.apple.com/documentation/security/updating_mac_software
Copy link
Contributor

@Hoverbear Hoverbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to resolve the issues I was facing!

// https://developer.apple.com/documentation/security/updating_mac_software
if dest.exists() {
handle_result!(
std::fs::remove_file(&dest),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rustfmt will clean this indentation up later.

@Hoverbear Hoverbear changed the base branch from master to develop December 16, 2021 19:44
@Hoverbear Hoverbear merged commit 7a55e3a into pgcentralfoundation:develop Dec 16, 2021
@JamesGuthrie JamesGuthrie deleted the fix-apple-so branch December 17, 2021 06:54
@Hoverbear Hoverbear mentioned this pull request Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems running recompiled extension on M1/Monterey combo
2 participants