From: Paul Floyd Date: Fri, 30 May 2025 06:47:00 +0000 (+0200) Subject: FreeBSD syscalls: change two more warnings X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7208eb445f32eefb4397757f004e65882c9a4083;p=thirdparty%2Fvalgrind.git FreeBSD syscalls: change two more warnings sysctl gave me a hard time when I first started working on FreeBSD but that warning should only be without -q change the unhandled kenv warning to a VG_(unimplemented), which will terminate Valgrind rather than just print a warning. There are still a few aio warnings. Really they should be promoted to some kind of fully fledged warning (maybe a core warning). I'm not sure that it's worth the effort as I suspect that aio is not much used. --- diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 41b0cc38b..3f4b6ca71 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -2082,8 +2082,10 @@ PRE(sys___sysctl) if (ML_(safe_to_deref)((void*)(Addr)ARG4, sizeof(vki_size_t))) { PRE_MEM_WRITE("sysctl(oldp)", (Addr)ARG3, *(vki_size_t *)ARG4); } else { - VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n", - (void *)(Addr)ARG4); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad oldlenp address %p in sysctl\n", + (void *)(Addr)ARG4); + } SET_STATUS_Failure ( VKI_EFAULT ); } } else { @@ -3691,7 +3693,9 @@ PRE(sys_kenv) case VKI_KENV_DUMP: break; default: - VG_(dmsg)("Warning: Bad action %" FMT_REGWORD "u in kenv\n", ARG1); + VG_(message)(Vg_UserMsg, "unhandled kenv cmd %" FMT_REGWORD "u", ARG1); + VG_(unimplemented) ("unhandled kenv cmd"); + break; } } diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index eddde2f42..bae3d943b 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -1405,9 +1405,6 @@ int main(void) GO(SYS_kenv, "(KENV_DUMP) 4s 0m"); SY(SYS_kenv, x0+3, x0+2, x0+3, x0+4); FAIL; - GO(SYS_kenv, "(bogus) 4s 0m"); - SY(SYS_kenv, x0+20, x0+2, x0+3, x0+4); FAIL; - /* SYS_lchflags 391 */ GO(SYS_lchflags, "2s 1m"); SY(SYS_lchflags, x0+1, x0+2); FAIL; diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index d632beea4..2e6ca39b4 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -1481,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldlenp address 0x........ in sysctl --------------------------------------------------------- 202: SYS___sysctl (putnew) 4s 2m --------------------------------------------------------- @@ -2984,22 +2983,6 @@ Syscall param kenv(value) contains uninitialised byte(s) Syscall param kenv(len) contains uninitialised byte(s) ... ---------------------------------------------------------- -390: SYS_kenv (bogus) 4s 0m ---------------------------------------------------------- -Syscall param kenv(action) contains uninitialised byte(s) - ... - -Syscall param kenv(name) contains uninitialised byte(s) - ... - -Syscall param kenv(value) contains uninitialised byte(s) - ... - -Syscall param kenv(len) contains uninitialised byte(s) - ... - -Warning: Bad action 20 in kenv --------------------------------------------------------- 391: SYS_lchflags 2s 1m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 7a9af94e8..24c7caac0 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -1481,7 +1481,6 @@ Syscall param sysctl(oldlenp) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldlenp address 0x........ in sysctl --------------------------------------------------------- 202: SYS___sysctl (putnew) 4s 2m --------------------------------------------------------- @@ -2990,22 +2989,6 @@ Syscall param kenv(value) contains uninitialised byte(s) Syscall param kenv(len) contains uninitialised byte(s) ... ---------------------------------------------------------- -390: SYS_kenv (bogus) 4s 0m ---------------------------------------------------------- -Syscall param kenv(action) contains uninitialised byte(s) - ... - -Syscall param kenv(name) contains uninitialised byte(s) - ... - -Syscall param kenv(value) contains uninitialised byte(s) - ... - -Syscall param kenv(len) contains uninitialised byte(s) - ... - -Warning: Bad action 20 in kenv --------------------------------------------------------- 391: SYS_lchflags 2s 1m ---------------------------------------------------------