450536 Powerpc: valgrind throws 'facility scv unavailable exception'
451626 Syscall param bpf(attr->raw_tracepoint.name) points to unaddressable byte(s)
451827 [ppc64le] VEX temporary storage exhausted with several vbpermq instructions
+451843 valgrind fails to start on a FreeBSD system which enforces W^X
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
freebsd_12=1200
AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
freebsd_12_2=1220
- AC_DEFINE([FREEBSD_13], 1300, [FREEBSD_VERS value for FreeBSD 13.x])
- freebsd_13=1300
+ AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
+ freebsd_13_0=1300
+ AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1+])
+ freebsd_13_1=1310
AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x])
freebsd_14=1400
esac
;;
13.*)
- AC_MSG_RESULT([FreeBSD 13.x (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13, [FreeBSD version])
- freebsd_vers=$freebsd_13
+ case "${kernel}" in
+ 13.0-*)
+ AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
+ AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
+ freebsd_vers=$freebsd_13_0
+ ;;
+ *)
+ AC_MSG_RESULT([FreeBSD 13.1+ (${kernel})])
+ AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
+ freebsd_vers=$freebsd_13_1
+ ;;
+ esac
;;
14.*)
AC_MSG_RESULT([FreeBSD 14.x (${kernel})])
if test "$VGCONF_OS" = "freebsd" ; then
-AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13)
+AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
else
/* --- auxv --- */
auxv = (struct auxv *)ptr;
*client_auxv = (UInt *)auxv;
-#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13)
+#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13_0)
int* pagesizes = NULL;
#endif
// case AT_CANARYLEN:
// case AT_EXECPATH:
// case AT_CANARY:
-#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13)
+#if defined(VGP_x86_freebsd) && (VGO_freebsd <= FREEBSD_13_0)
case AT_PAGESIZESLEN:
if (!VG_(is32on64)()) {
VG_(debugLog)(2, "initimg",
// case AT_TIMEKEEP:
break;
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
case AT_BSDFLAGS:
case AT_ARGC:
// case AT_ARGV:
VG_(exit)(1);
}
+#if defined(VGO_freebsd)
+ Int val;
+ SizeT len = sizeof(val);
//--------------------------------------------------------------
// FreeBSD check security.bsd.unprivileged_proc_debug sysctl
// This needs to be done before aspacemgr starts, otherwise that
// will fail with mysterious error codes
//--------------------------------------------------------------
-#if defined(VGO_freebsd)
- Int val;
- SizeT len = sizeof(val);
Int error = VG_(sysctlbyname)("security.bsd.unprivileged_proc_debug", &val, &len, 0, 0);
if (error != -1 && val != 1) {
VG_(debugLog)(0, "main", "Valgrind: FATAL:\n");
VG_(exit)(1);
}
+
+ //--------------------------------------------------------------
+ // FreeBSD also check for sysctl kern.elf64.allow_wx=0
+ // This is a sysctl that prevents applications from mmap'ing
+ // segments that are writeable and executable
+ //--------------------------------------------------------------
+#if defined(VGP_amd64_freebsd)
+ error = VG_(sysctlbyname)("kern.elf64.allow_wx", &val, &len, 0, 0);
+ if (error != -1 && val != 1) {
+ VG_(debugLog)(0, "main", "Valgrind: FATAL:\n");
+ VG_(debugLog)(0, "main", "sysctl kern.elf64.allow_wx sysctl is 0.\n");
+ VG_(debugLog)(0, "main", " Set this sysctl with\n");
+ VG_(debugLog)(0, "main", " 'sysctl kern.elf64.allow_wx sysctl=1'.\n");
+ // the below code doesn't work as I expected
+ // the proccontrol command doesn't cause sysctlbyname to get a modified value
+ // which means that valgrind will still detect allow_wx == 0 and exit here
+//#if (FREEBSD_VERS >= FREEBSD_13_1)
+// VG_(debugLog)(0, "main", " Or, alternatively, run valgrind with\n");
+// VG_(debugLog)(0, "main", " 'proccontrol -m wxmap -s enable valgrind [options] prog-and-args'\n");
+//#endif
+ VG_(debugLog)(0, "main", " Cannot continue.\n");
+
+ VG_(exit)(1);
+ }
+
+#endif
+
+ /* also 323bit version */
+#if defined(VGP_x86_freebsd)
+ error = VG_(sysctlbyname)("kern.elf32.allow_wx", &val, &len, 0, 0);
+ if (error != -1 && val != 1) {
+ VG_(debugLog)(0, "main", "Valgrind: FATAL:\n");
+ VG_(debugLog)(0, "main", "sysctl kern.elf32.allow_wx sysctl is 0.\n");
+ VG_(debugLog)(0, "main", " Set this sysctl with\n");
+ VG_(debugLog)(0, "main", " 'sysctl kern.elf32.allow_wx sysctl=1'.\n");
+//#if (FREEBSD_VERS >= FREEBSD_13_1)
+// VG_(debugLog)(0, "main", " Or, alternatively, run valgrind with\n");
+// VG_(debugLog)(0, "main", " 'proccontrol -m wxmap -s enable valgrind [options] prog-and-args'\n");
+//#endif
+ VG_(debugLog)(0, "main", " Cannot continue.\n");
+
+ VG_(exit)(1);
+ }
+#endif
#endif
if (do_stats) stats.nr++;
// Does this apply to macOS 10.14 and earlier?
-# if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13)
+# if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13_0)
if (VG_(is_valid_tid)(tid_if_known) &&
VG_(is_in_syscall)(tid_if_known) &&
i < max_n_ips) {
// unimpl __NR_copy_file_range 569
DECL_TEMPLATE(freebsd, sys___sysctlbyname) // 570
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// looks like close_range got backported
// to 12.2 leaving these 4 marked as UNIMPL in 12.2
// unimpl __NR_shm_open2 571
#endif
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// unimpl __NR_rpctls_syscall 576
DECL_TEMPLATE(freebsd, sys___specialfd) // 577
#endif // (FREEBSD_VERS >= FREEBSD_12_2)
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// SYS___realpathat 474
// from syscalls.master
// unimpl __NR_copy_file_range 569
BSDXY(__NR___sysctlbyname, sys___sysctlbyname), // 570
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// unimpl __NR_shm_open2 571
// unimpl __NR_shm_rename 572
// unimpl __NR_sigfastblock 573
// unimpl __NR_close_range 575
#endif
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
// unimpl __NR_rpctls_syscall 576
BSDX_(__NR___specialfd, sys___specialfd), // 577
// unimpl __NR_aio_writev 578
#endif
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
#define __NR_rpctls_syscall 576
#define __NR___specialfd 577
SY(SYS_thr_kill2, x0-1, x0-1, x0+9999); FAIL;
/* SYS_shm_open 482 */
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
GO(SYS_freebsd12_shm_open, "(SHM_ANON) 3s 0m");
SY(SYS_freebsd12_shm_open, x0+SHM_ANON, x0+2, x0+9); SUCC;
#else
SY(SYS_jail_remove, x0+1); FAIL;
/* SYS_closefrom 509 */
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
GO(SYS_freebsd12_closefrom, "1s 0m");
SY(SYS_freebsd12_closefrom, x0+100000); SUCC;
#else
{"AT_HWCAP2", 26},
// FreeBSD 12 and 11
// {"AT_COUNT", 27},
-#if (FREEBSD_VERS >= FREEBSD_13)
+#if (FREEBSD_VERS >= FREEBSD_13_0)
{"AT_BSDFLAGS", 27},
{"AT_ARGC", 28},
{"AT_ARGV", 29},