Bug 390269

Summary: unhandled amd64-darwin syscall: unix:464 (openat_nocancel)
Product: [Developer tools] valgrind Reporter: Chris Wilson <chris+kde>
Component: generalAssignee: Rhys Kidd <rhyskidd>
Status: RESOLVED FIXED    
Severity: normal CC: chris+kde, pjfloyd, rhyskidd
Priority: NOR    
Version: 3.14 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Chris Wilson 2018-02-11 14:40:45 UTC
Syscall trace, in case it helps:

SYSCALL[7333,1](unix:470) fstatat64(FIXME)(fd:4294967294, path:0x10539ca50(/var/folders/_k/v97x1css2x93xldm8cg7cw5w0000gn/T), ub:0x10539b7d8, flag:0x0)[sync] --> Success(0x0:0x0) 
SYSCALL[7333,1](unix:464) --7333-- WARNING: unhandled amd64-darwin syscall: unix:464
--7333-- You may be able to write your own handler.
--7333-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--7333-- Nevertheless we consider this a bug.  Please report
--7333-- it at http://valgrind.org/support/bug_reports.html.
 --> [pre-fail] Failure(0x4e) 
SYSCALL[7333,1](unix:397) sys_write ( 1, 0x103800800, 266 ) --> [async] ... 

I think this is caused by calling mkstemp(), but haven't attached a debugger to make sure.
Comment 1 Rhys Kidd 2018-02-11 20:15:42 UTC
Thanks for the report Chris -- that unix syscall is openat_nocancel() on recent macOS kernels.

Do you have a simple program that reproduces this bug report for you?
Comment 2 Chris Wilson 2018-02-12 14:24:06 UTC
Yes, it was mkstemp. This example:

int main(int argc, char** argv)
{
        char buffer[] = "boxbackup.recombinetemp.1.XXXXXX";
        if(mkstemp(buffer) < 0)
        {
                perror("mkstemp");
        }
        return 0;
}       

Outputs:

--7593-- WARNING: unhandled amd64-darwin syscall: unix:464
--7593-- You may be able to write your own handler.
--7593-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--7593-- Nevertheless we consider this a bug.  Please report
--7593-- it at http://valgrind.org/support/bug_reports.html.
mkstemp: Function not implemented
Comment 3 Paul Floyd 2023-11-20 13:00:32 UTC
Plus a few commits following the main one below

commit d79897e0aff3f5f3cf3e77760761ace3bb847d0f
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Mon Nov 20 12:59:12 2023 +0100

    Bug 390269 - unhandled amd64-darwin syscall: unix:464 (openat_nocancel)
    
    Copied from https://github.com/LouisBrunner/valgrind-macos.git
    
    Regtest to come shortly