From: Paul Floyd Date: Fri, 3 Feb 2023 12:51:04 +0000 (+0100) Subject: FreeBSD: fix internal sysctlbyname X-Git-Tag: VALGRIND_3_21_0~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c80a467a93fd3e4be04b567fbaae6146b2b23de;p=thirdparty%2Fvalgrind.git 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 --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];