-
Notifications
You must be signed in to change notification settings - Fork 105
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
gitstatus failed to initialize on FreeBSD 13 #262
Comments
I believe this has something to do with the new W^X memory mapping policy for user processes in FreeBSD 13. |
Thanks for letting me know. If you can tell me what I need to change and give me a reasonable explanation why it needs to be done, I'll do that. Otherwise it's unlikely I'll do anything about this issue. |
I'm not familiar with how this build system works, but running |
Does that command have negative side effects? Why is it necessary? |
FreeBSD 13 has changed how it's memory mapping rules work, by default it's no longer possible for a page in memory to be set as both writable and executable. Code that tries to do this will abort, with a message along the lines of The elfctl command sets a flag on the binary that gives it an exception to that rule. Alternative seems to be rewrite your code to not write and execute to the same page, which would likely have a bad performance hit. This all applies to OpenBSD as well, but I have no idea what the mitigation would be for that OS. More details: https://ximalas.info/2021/04/15/freebsd-13-and-wx-memory-mapping-policy-for-user-processes/ |
Thanks for the explanation. gitstatusd doesn't requir memory to be executable and writable at the same time. It doesn't invoke mmap, doesn't employ JIT, or anything like that. It's a fairly boring binary, no fancy stuff at all. Maybe there is a compiler flag that causes this issue, or maybe a compiler flag can resolve it? FWIW, you can build gitstatusd by cloning the repo and running |
Just tried this, build -w still aborts. Did a bit of research, looks like it’s an upstream thing with gcc. |
Compiling with clang fixes the issue. I've release v1.5.3 with the fix. Please give it a try. git -C /usr/home/arladmin/powerlevel10k pull && exec zsh |
Confirmed! |
Thanks for verifying! |
`exec_new_vmspace: mapping stack size 0x20000000 prot 0x7 failed mach error 2 errno 13
[powerlevel10k] fetching gitstatusd .. -exec_new_vmspace: mapping stack size 0x20000000 prot 0x7 failed mach error 2 errno 13
[ERROR]: gitstatus failed to initialize.
Zsh log (/tmp/gitstatus.POWERLEVEL9K.1001.38079.1631055372.1.xtrace.log):
Daemon log (/tmp/gitstatus.POWERLEVEL9K.1001.38079.1631055372.1.daemon.log):
System information:
The text was updated successfully, but these errors were encountered: