[php-src] master: sapi/phpdbg: Update of userfaultfd workflow. (#13955)

From: Date: Tue, 30 Apr 2024 18:33:27 +0000
Subject: [php-src] master: sapi/phpdbg: Update of userfaultfd workflow. (#13955)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-128270@lists.php.net to get a copy of this message
Author: David CARLIER (devnexen) Committer: GitHub (web-flow) Pusher: devnexen Date: 2024-04-30T19:33:19+01:00 Commit: https://github.com/php/php-src/commit/8d67f23eb236b6ba43c41aaef84f1016321565c4 Raw diff: https://github.com/php/php-src/commit/8d67f23eb236b6ba43c41aaef84f1016321565c4.diff 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. Changed paths: M sapi/phpdbg/phpdbg_watch.c Diff: diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index d3e4ca7d98c9b..757cf67e3fcd7 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -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 {

« previous php.cvs (#128270) next »