|
From: Paul F. <pa...@so...> - 2023-02-03 12:52:17
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4c80a467a93fd3e4be04b567fbaae6146b2b23de commit 4c80a467a93fd3e4be04b567fbaae6146b2b23de Author: Paul Floyd <pj...@wa...> Date: Fri Feb 3 13:51:04 2023 +0100 FreeBSD: fix internal sysctlbyname I used the libc interface rather than the syscall interface. The syscall also has the name length which libc adds. Diff: --- coregrind/m_libcproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c index 55bb7cbf97..592d69bf13 100644 --- a/coregrind/m_libcproc.c +++ b/coregrind/m_libcproc.c @@ -1200,8 +1200,9 @@ void VG_(do_atfork_child)(ThreadId tid) #if defined(VGO_freebsd) Int VG_(sysctlbyname)(const HChar *name, void *oldp, SizeT *oldlenp, const void *newp, SizeT newlen) { + vg_assert(name); #if (FREEBSD_VERS >= FREEBSD_12_2) - SysRes res = VG_(do_syscall5)(__NR___sysctlbyname, (UWord)name, (UWord)oldp, (UWord)oldlenp, (UWord)newp, (UWord)newlen); + SysRes res = VG_(do_syscall6)(__NR___sysctlbyname, (RegWord)name, VG_(strlen)(name), (RegWord)oldp, (RegWord)oldlenp, (RegWord)newp, (RegWord)newlen); return sr_isError(res) ? -1 : sr_Res(res); #else Int oid[2]; |