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

Pledge tightening #39

Merged
merged 2 commits into from
Jan 13, 2023
Merged

Pledge tightening #39

merged 2 commits into from
Jan 13, 2023

Conversation

omar-polo
Copy link
Contributor

Hello,

This tightens pledge(2) usage on OpenBSD. First, it drops the "unix" promise by calling pledge after XOpenDisplay and then, when the initalization is done, drops "rpath" too. This greatly reduces the number of syscalls that remains available to the program during its main loop, without breaking it of course. I'm testing it with tiramisu on OpenBSD and seems to work just fine.

@phillbush phillbush merged commit f760d71 into phillbush:master Jan 13, 2023
@phillbush
Copy link
Owner

Merged!
Thanks for the PR!

I'm gonna bump the version to sync with the changes.

@omar-polo
Copy link
Contributor Author

Thanks!

Actually, hum, I have to apologize for sending the pr too soon. It seems that "sometimes" xnotify ends up re-opening the fonts (I'm not too into fonconfig but I guess that it may need to open other fonts at runtime) so the "rpath" pledge promise needs to be kept. i.e. the last commit should be reverted (the one adding the second pledge call.)

I'm sorry but I couldn't hit that in a couple of hours of usage, but it happened right now.

In the end, "stdio rpath" is still a very good (and strict) pledge policy, so not big loss :)

@phillbush
Copy link
Owner

Yeah, it has a fallback font system, in the case the font you configured has not the character being drawn (useful for CJK glyphs). So font files can be open after initialization.

@omar-polo
Copy link
Contributor Author

Thanks for reverting the commit and tagging a newer release and sorry again for the troubles!

(fwiw i think that I was fine until it tried to display a notification with an emoji that triggered the loading of another font and thus the pledge violation.)

@phillbush
Copy link
Owner

Thanks for reverting the commit and tagging a newer release and sorry again for the troubles!

np :)

@phillbush
Copy link
Owner

I had to remove pledge.
Imlib2 links libraries at run time, like libjpeg and librsvg, which requires more promises (like prot_exec and recvfd) than the ones previously used.
I need to check which promises to add and whether it is relevant to add them before re-adding pledge again.

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.

2 participants