I mixed up a bit the syscall wrapper versioning.
Also for some reason the syscall has been backported to FreeBSD 12.2
but not the CLOEXEC flag. So I had to modify the testcase for that.
strchrnul \
memrchr \
strndup \
+ close_range
])
# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
[test x$ac_cv_func_memfd_create = xyes])
AM_CONDITIONAL([HAVE_GETADDRINFO],
[test x$ac_cv_func_getaddrinfo = xyes])
+AM_CONDITIONAL([HAVE_CLOSE_RANGE],
+ [test x$ac_cv_func_close_range = xyes])
if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
PRE_MEM_WRITE("__realpathat(buf)", (Addr)ARG3, ARG4);
}
+POST(sys___realpathat)
+{
+ POST_MEM_WRITE((Addr)ARG3, ARG4);
+}
+
+#endif
+
+#if (FREEBSD_VERS >= FREEBSD_12_2)
+
// SYS_sys_close_range 575
// int close_range(close_range(u_int lowfd, u_int highfd, int flags);
PRE(sys_close_range)
&& fd != VG_(xml_output_sink).fd)
ML_(record_fd_close)(fd);
}
+#endif
-POST(sys___realpathat)
-{
- POST_MEM_WRITE((Addr)ARG3, ARG4);
-}
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// SYS___specialfd 577
// syscalls.master
#define __NR_funlinkat 568
#define __NR_copy_file_range 569
#define __NR___sysctlbyname 570
+#if (FREEBSD_VERS >= FREEBSD_13_0)
#define __NR_shm_open2 571
#define __NR_shm_rename 572
#define __NR_sigfastblock 573
#define __NR___realpathat 574
+#endif
#define __NR_close_range 575
#endif
filter_scalar filter_realpathat filter_fstat filter_eventfd2
EXTRA_DIST = \
+ access.vgtest \
+ access.stderr.exp \
+ aligned_alloc.vgtest aligned_alloc.stderr.exp \
+ aligned_alloc_xml.vgtest aligned_alloc_xml.stderr.exp \
+ aligned_allocs_supp.vgtest \
+ aligned_allocs_supp.stderr.exp \
+ aligned_allocs_supp.supp \
capsicum.vgtest \
capsicum.stderr.exp \
chflags.vgtest\
chflags.stderr.exp \
chflags.stderr.exp-x86 \
+ chmod_chown.vgtest \
+ chmod_chown.stderr.exp \
close_range.vgtest close_range.stderr.exp \
+ eventfd1.vgtest \
+ eventfd1.stderr.exp eventfd1.stdout.exp \
+ eventfd2.vgtest \
+ eventfd2.stderr.exp \
extattr.vgtest \
extattr.stderr.exp \
get_set_login.vgtest \
file_locking_wait6.stderr.exp \
utimens.vgtest \
utimens.stderr.exp \
- access.vgtest \
- access.stderr.exp \
- chmod_chown.vgtest \
- chmod_chown.stderr.exp \
misc.vgtest \
misc.stderr.exp \
get_set_context.vgtest \
realpathat.stderr.exp \
scalar_13_plus.vgtest \
scalar_13_plus.stderr.exp \
- eventfd1.vgtest \
- eventfd1.stderr.exp eventfd1.stdout.exp \
- eventfd2.vgtest \
- eventfd2.stderr.exp \
errno_aligned_allocs.vgtest \
errno_aligned_allocs.stderr.exp \
setproctitle.vgtest \
memalign.vgtest memalign.stderr.exp \
bug470713.vgtest bug470713.stderr.exp \
bug470713.stdout.exp \
- aligned_allocs_supp.vgtest \
- aligned_allocs_supp.stderr.exp \
- aligned_allocs_supp.supp \
memalign_supp.vgtest memalign_supp.stderr.exp \
memalign_supp.supp \
- aligned_alloc.vgtest aligned_alloc.stderr.exp \
- aligned_alloc_xml.vgtest aligned_alloc_xml.stderr.exp \
delete_sized_mismatch.vgtest \
delete_sized_mismatch.stderr.exp \
delete_sized_mismatch_xml.vgtest \
delete_sized_mismatch_xml.stderr.exp
check_PROGRAMS = \
- close_range statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \
+ statfs pdfork_pdkill getfsstat inlinfo inlinfo_nested.so extattr \
sigwait chflags get_set_login revoke scalar capsicum getfh \
linkat scalar_fork scalar_thr_exit scalar_abort2 scalar_pdfork \
scalar_vfork stat file_locking_wait6 utimens access chmod_chown \
scalar_13_plus_CFLAGS = ${AM_CFLAGS} -g
endif
+if HAVE_CLOSE_RANGE
+check_PROGRAMS += close_range
+endif
+
scalar_CFLAGS = ${AM_CFLAGS} -g
aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
#include <fcntl.h>
#include <assert.h>
+/* It looks like close_range was initially implemented for FreeBSD 13
+ * but without CLOSE_RANGE_CLOEXEC
+ * That implementation got back ported to FreeBSD 12.2
+ * And then CLOSE_RANGE_CLOEXEC added to 13 but not backported
+ * so 12 has close_range but not CLOSE_RANGE_CLOEXEC */
+#if !defined(CLOSE_RANGE_CLOEXEC)
+#define CLOSE_RANGE_CLOEXEC 1
+#endif
+
int main(void)
{
struct rlimit rl;
Syscall param close_range(lowfd) contains uninitialised byte(s)
at 0x........: close_range (in /...libc...)
- by 0x........: main (close_range.c:74)
+ by 0x........: main (close_range.c:83)
Syscall param close_range(highfd) contains uninitialised byte(s)
at 0x........: close_range (in /...libc...)
- by 0x........: main (close_range.c:74)
+ by 0x........: main (close_range.c:83)
Syscall param close_range(flags) contains uninitialised byte(s)
at 0x........: close_range (in /...libc...)
- by 0x........: main (close_range.c:74)
+ by 0x........: main (close_range.c:83)