Bug 376870

Summary: unhandled amd64-darwin syscall: unix:446 (proc_rlimit_control)
Product: [Developer tools] valgrind Reporter: Hamish Moffatt <hamish+kde>
Component: memcheckAssignee: Paul Floyd <pjfloyd>
Status: REPORTED ---    
Severity: normal CC: pjfloyd, rhyskidd, tom
Priority: NOR    
Version First Reported In: 3.12.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Hamish Moffatt 2017-02-24 03:55:37 UTC
I am trying to run my app in memcheck on Mavericks/10.9. (It is actually running in a 10.9 virtual machine in Parallels 11, because the host is running Sierra/10.12 which is not supported yet.)

I got quite a few messages about an unhandled syscall:

--10283-- WARNING: unhandled amd64-darwin syscall: unix:446
--10283-- You may be able to write your own handler.
--10283-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--10283-- Nevertheless we consider this a bug.  Please report
--10283-- it at http://valgrind.org/support/bug_reports.html.

At the point when I expected my program to crash, I got:

eq_SyscallStatus:
  {78 0 43}
  {78 0 40}

valgrind: m_syswrap/syswrap-main.c:438 (Bool eq_SyscallStatus(UInt, SyscallStatus *, SyscallStatus *)): the 'impossible' happened.

host stacktrace:
==10283==    at 0x238042521: ???
==10283==    by 0x238042932: ???
==10283==    by 0x238042915: ???
==10283==    by 0x2380C13FE: ???
==10283==    by 0x2380C0989: ???
==10283==    by 0x2380BEDDB: ???
==10283==    by 0x2380BCCCD: ???
==10283==    by 0x2380CE1CC: ???

sched status:
  running_tid=1


and a stack trace.
Comment 1 Rhys Kidd 2017-04-30 20:15:46 UTC
Hello Hamish,

I've tagged this bug report with the macOS attributes.

The missing syscall is proc_rlimit_control(). That is one Valgrind needs to have support added for.

macOS 10.12 support is also improving in latest SVN trunk of Valgrind, if you're interested in testing the bleeding edge code.
Comment 2 Paul Floyd 2025-11-02 17:48:53 UTC
Not much info on this to be found on the web. So, XNU source it is. This is the kernel source with wrapped args

/*
 * Resource limit controls
 *      
 * uap->flavor available flavors:
 * 
 *     RLIMIT_WAKEUPS_MONITOR
 *     RLIMIT_CPU_USAGE_MONITOR
 *     RLIMIT_THREAD_CPULIMITS
 *     RLIMIT_FOOTPRINT_INTERVAL
 */
int
proc_rlimit_control(__unused struct proc *p, struct proc_rlimit_control_args *uap, __unused in
t32_t *retval)

The syscall interface seems to be

int proc_rlimit_control(pid_t pid, int flavor, void *arg);

"arg" looks like it can contain an integer or a struct, depending on the flavour.