mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-06-08 06:05:57 -04:00
configure: require <linux/openat2.h>, not just SYS_openat2
The openat2 secure resolver in syscall.c needs struct open_how and RESOLVE_BENEATH from <linux/openat2.h>, not only the SYS_openat2 syscall number. Some setups expose the syscall number via glibc without the kernel header present, so probing SYS_openat2 alone still left the build broken (#905). Exercise the header and struct in the configure check so HAVE_OPENAT2 is defined only when both are actually usable.
This commit is contained in:
11
configure.ac
11
configure.ac
@@ -353,9 +353,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[return 0;]])],
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
AC_SUBST(NOEXECSTACK)
|
||||
|
||||
dnl We need both the SYS_openat2 syscall number and <linux/openat2.h> (for
|
||||
dnl struct open_how / RESOLVE_BENEATH); some setups have one without the other.
|
||||
AC_CACHE_CHECK([for openat2],rsync_cv_HAVE_OPENAT2,[
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <sys/syscall.h>]], [[int i = SYS_openat2]])
|
||||
AC_LANG_PROGRAM([[
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/openat2.h>
|
||||
]], [[
|
||||
struct open_how how;
|
||||
how.resolve = RESOLVE_BENEATH;
|
||||
return SYS_openat2 + (int)how.resolve;
|
||||
]])
|
||||
],
|
||||
[rsync_cv_HAVE_OPENAT2=yes], [rsync_cv_HAVE_OPENAT2=no])
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user