Skip to content

Simplify UFFDIO_WRITEPROTECT_MODE_WP Autoconf check #13564

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

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions sapi/phpdbg/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ if test "$PHP_PHPDBG" != "no"; then
AC_MSG_RESULT([disabled])
fi

AC_CACHE_CHECK([for userfaultfd faulting on write-protected memory support], ac_cv_phpdbg_userfaultfd_writefault, AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/userfaultfd.h>
#ifndef UFFDIO_WRITEPROTECT_MODE_WP
# error userfaults on write-protected memory not supported
#endif
]])], [ac_cv_phpdbg_userfaultfd_writefault=yes], [ac_cv_phpdbg_userfaultfd_writefault=no]))
if test "$ac_cv_phpdbg_userfaultfd_writefault" = "yes"; then
AC_CHECK_DECL([UFFDIO_WRITEPROTECT_MODE_WP], [
Copy link
Member

Choose a reason for hiding this comment

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

Does this work for macros? The manual for AC_CHECK_DECL talks about symbol (a function, variable, or constant).

Copy link
Member

Choose a reason for hiding this comment

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

Ah wait, I get it: This macro actually tests whether it is valid to use symbol as an r-value. So this should indeed be fine.

if test "$enable_zts" != "yes"; then
CFLAGS_SAVE="$CFLAGS"
LIBS_SAVE="$LIBS"
Expand All @@ -73,7 +67,7 @@ if test "$PHP_PHPDBG" != "no"; then
else
AC_DEFINE(HAVE_USERFAULTFD_WRITEFAULT, 1, [Whether faulting on write-protected memory support can be compiled for userfaultfd])
fi
fi
],,[#include <linux/userfaultfd.h>])

PHP_SUBST(PHPDBG_EXTRA_LIBS)

Expand Down