From ebc73366045855c6cf5069ae6841d3a887bd0ba0 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Fri, 30 May 2025 08:31:48 +0200 Subject: [PATCH] FreeBSD sigprocmask syscall: do not print warnings when -q is set Equivalent to bug504904 and bug504909 --- coregrind/m_syswrap/syswrap-freebsd.c | 22 +++++++++++++------- memcheck/tests/freebsd/scalar.stderr.exp | 3 --- memcheck/tests/freebsd/scalar.stderr.exp-x86 | 3 --- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 8fcfe1090..41b0cc38b 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -3197,13 +3197,17 @@ PRE(sys_sigprocmask) if (ARG2 != 0 && !ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n", (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if (ARG3 != 0 && !ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(vki_sigset_t))) { - VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } else { SET_STATUS_from_SysRes(VG_(do_sys_sigprocmask)(tid, ARG1 /*how*/, @@ -3922,14 +3926,18 @@ PRE(sys_sigaction) if (ARG2 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG2, sizeof(struct vki_sigaction))) { - VG_(umsg)("Warning: bad act handler address %p in sigaction()\n", - (void *)(Addr)ARG2); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad act handler address %p in sigaction()\n", + (void *)(Addr)ARG2); + } SET_STATUS_Failure ( VKI_EFAULT ); } else if ((ARG3 != 0 && ! ML_(safe_to_deref)((void *)(Addr)ARG3, sizeof(struct vki_sigaction)))) { - VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n", - (void *)(Addr)ARG3); + if (VG_(clo_verbosity) >= 1) { + VG_(umsg)("Warning: bad oact handler address %p in sigaction()\n", + (void *)(Addr)ARG3); + } SET_STATUS_Failure ( VKI_EFAULT ); } else { if (ARG2 != 0) { diff --git a/memcheck/tests/freebsd/scalar.stderr.exp b/memcheck/tests/freebsd/scalar.stderr.exp index 24b7ba2bb..d632beea4 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp +++ b/memcheck/tests/freebsd/scalar.stderr.exp @@ -2429,7 +2429,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldset address 0x........ in sigprocmask --------------------------------------------------------- 340: SYS_sigprocmask 3s 2m --------------------------------------------------------- @@ -2450,7 +2449,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad set handler address 0x........ in sigprocmask --------------------------------------------------------- 341: SYS_sigsuspend 1s 1m --------------------------------------------------------- @@ -3227,7 +3225,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: bad act handler address 0x........ in sigaction() --------------------------------------------------------- 417: SYS_sigreturn 1s 1m --------------------------------------------------------- diff --git a/memcheck/tests/freebsd/scalar.stderr.exp-x86 b/memcheck/tests/freebsd/scalar.stderr.exp-x86 index 788dfbd7c..7a9af94e8 100644 --- a/memcheck/tests/freebsd/scalar.stderr.exp-x86 +++ b/memcheck/tests/freebsd/scalar.stderr.exp-x86 @@ -2435,7 +2435,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad oldset address 0x........ in sigprocmask --------------------------------------------------------- 340: SYS_sigprocmask 3s 2m --------------------------------------------------------- @@ -2456,7 +2455,6 @@ Syscall param sigprocmask(oset) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: Bad set handler address 0x........ in sigprocmask --------------------------------------------------------- 341: SYS_sigsuspend 1s 1m --------------------------------------------------------- @@ -3236,7 +3234,6 @@ Syscall param sigaction(oact) points to unaddressable byte(s) ... Address 0x........ is not stack'd, malloc'd or (recently) free'd -Warning: bad act handler address 0x........ in sigaction() --------------------------------------------------------- 417: SYS_sigreturn 1s 1m --------------------------------------------------------- -- 2.47.2