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

Don't override kernel panic/oom handlers in userspace #139

merged 3 commits into from Jun 11, 2021


Copy link

Fixes hermit-os/kernel#43.

std's panic handler in userspace seems to do weird stuff that leads to page faults instead of a proper panic. This fixes the issue by renaming the kernel handler symbols making both coexist.

Copy link

Where do you know that this was the reason for hermit-os/kernel#43?

Copy link
Member Author

I experimented with using panic! in CpuFrequency::detect, as described in hermit-os/kernel#43.

Though I am not sure, what x86_64-unknown-hermit's std panic_handler does exactly to provoke the page fault/invalid opcode, making sure the kernel uses its own x86_64-unknown-hermit-kernel no_std panic_handler, does work for CpuFrequency::detect as well as RxQueues::get_next from hermit-os/kernel#209.

It is possible that is has to do with std's panic_handler calling core::intrinsics::abort, which emits ud2 instructions, but that's speculation. The instruction pointer in the invalid opcode exception handler does not make sense, so I can't confirm this.

Copy link

@stlankes stlankes left a comment

Choose a reason for hiding this comment

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

bors r+

Copy link

bors bot commented Jun 11, 2021

@bors bors bot merged commit 2191df0 into hermit-os:master Jun 11, 2021
bors bot added a commit to hermit-os/kernel that referenced this pull request Jun 11, 2021
215: Rename .cargo/config to config.toml r=stlankes a=mkroening

218: Strongly link panic and oom handlers r=stlankes a=mkroening

Depends on hermit-os/hermit-rs#139.

Having weak linkage on the handlers does no harm but is not necessary after the before mentioned PR.

Co-authored-by: Martin Kröning <>
@mkroening mkroening deleted the kernel-symbols branch September 29, 2021 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Rusty-hermit may experience Page Fault when panicking
2 participants