Skip to content

Prefer userfaultfd over mprotect+SIGSEGV signal handling on linux for phpdbg watchpoints #7551

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

Closed
wants to merge 1 commit into from

Conversation

bwoebi
Copy link
Member

@bwoebi bwoebi commented Oct 3, 2021

Not sure whether that's a good idea, especially unsure whether config.m4 check for userfault handling is fine. The problem with a classical "program" check where we run userfaultfd() and an ioctl() is that userfaultfd(2) may error if the user building phpdbg is not permitted to use the syscall (like it may be the case in docker - or as unprivileged user on a hardened system).

This also is much more compatible with gdb for debugging purposes (I intend on improving stability and memory leaks here in future commits...). In general, this approach seems also to be strongly recommended in Linux over the classical mprotect+SIGSEGV handling (https://www.kernel.org/doc/Documentation/vm/userfaultfd.txt).

@bwoebi bwoebi requested a review from krakjoe October 3, 2021 22:56
@bwoebi bwoebi force-pushed the phpdbg_userfaultfd branch from 849843d to 8d463e1 Compare October 3, 2021 22:57
@bwoebi bwoebi force-pushed the phpdbg_userfaultfd branch from 8d463e1 to 7adbc7a Compare October 4, 2021 13:11
@krakjoe krakjoe added the Feature label Oct 7, 2021
@krakjoe
Copy link
Member

krakjoe commented Oct 7, 2021 via email

@bwoebi bwoebi closed this in ad9c10b Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants