1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

sapi/phpdbg: Update of userfaultfd workflow. (#13955)

unpriviliged_userfaultfd is set to 0 by default. Since Linux 5.11
handling memory ranges from the user-space is allowed with the
`UFFD_USER_MODE_ONLY` fd open mode flag.
This commit is contained in:
David CARLIER
2024-04-30 19:33:19 +01:00
committed by GitHub
parent 5359392717
commit 8d67f23eb2

View File

@@ -1472,7 +1472,14 @@ void phpdbg_setup_watchpoints(void) {
PHPDBG_G(watch_tmp) = NULL;
#ifdef HAVE_USERFAULTFD_WRITEFAULT
PHPDBG_G(watch_userfaultfd) = syscall(SYS_userfaultfd, O_CLOEXEC);
int flags = O_CLOEXEC;
#ifdef UFFD_USER_MODE_ONLY
// unpriviliged userfaultfd are disabled by default,
// with this flag it allows ranges from the user space
// being reported.
flags |= UFFD_USER_MODE_ONLY;
#endif
PHPDBG_G(watch_userfaultfd) = syscall(SYS_userfaultfd, flags);
if (PHPDBG_G(watch_userfaultfd) < 0) {
PHPDBG_G(watch_userfaultfd) = 0;
} else {