Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mkcheck/mkcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ int RunTracer(const fs::path &output, pid_t root)
}
case SYS_vfork:
case SYS_fork:
case SYS_clone: {
case SYS_clone:
case SYS_clone3: {
// Try to wait for the exit event of this sycall before any others.
waitFor = state->IsExiting() ? -1 : pid;
break;
Expand Down
39 changes: 39 additions & 0 deletions mkcheck/syscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ static void sys_fcntl(Process *proc, const Args &args)
case F_OFD_SETLKW: {
break;
}
case F_SETPIPE_SZ:
case F_GETPIPE_SZ: {
break;
}
default: {
throw std::runtime_error(
"Unknown fnctl (cmd = " + std::to_string(cmd) + ")"
Expand Down Expand Up @@ -476,6 +480,25 @@ static void sys_renameat(Process *proc, const Args &args)
}
}

// -----------------------------------------------------------------------------
static void sys_symlinkat(Process *proc, const Args &args)
{
const int newdirfd = args[1];
const fs::path src = ReadString(args.PID, args[0]);
const fs::path dst = ReadString(args.PID, args[2]);

if (args.Return >= 0) {
const fs::path parent = proc->Normalise(newdirfd, dst.parent_path());
const fs::path srcPath = proc->Normalise(src, parent);
const fs::path dstPath = parent / dst.filename();

// configure seems to create links pointing to themselves, which we ignore.
if (srcPath != dstPath) {
proc->Link(srcPath, dstPath);
}
}
}

// -----------------------------------------------------------------------------
static void sys_unlinkat(Process *proc, const Args &args)
{
Expand Down Expand Up @@ -660,6 +683,16 @@ static const HandlerFn kHandlers[] =
/* 0x070 */ [SYS_setsid ] = sys_ignore,
/* 0x071 */ [SYS_setreuid ] = sys_ignore,
/* 0x073 */ [SYS_getgroups ] = sys_ignore,
/* 0x075 */ [SYS_setresuid ] = sys_ignore,
/* 0x076 */ [SYS_getresuid ] = sys_ignore,
/* 0x077 */ [SYS_setresgid ] = sys_ignore,
/* 0x078 */ [SYS_getresgid ] = sys_ignore,
/* 0x079 */ [SYS_getpgid ] = sys_ignore,
/* 0x07A */ [SYS_setfsuid ] = sys_ignore,
/* 0x07B */ [SYS_setfsgid ] = sys_ignore,
/* 0x07C */ [SYS_getsid ] = sys_ignore,
/* 0x07D */ [SYS_capget ] = sys_ignore,
/* 0x07E */ [SYS_capset ] = sys_ignore,
/* 0x07F */ [SYS_rt_sigpending ] = sys_ignore,
/* 0x083 */ [SYS_sigaltstack ] = sys_ignore,
/* 0x084 */ [SYS_utime ] = sys_utime,
Expand Down Expand Up @@ -703,6 +736,7 @@ static const HandlerFn kHandlers[] =
/* 0x106 */ [SYS_newfstatat ] = sys_newfstatat,
/* 0x107 */ [SYS_unlinkat ] = sys_unlinkat,
/* 0x108 */ [SYS_renameat ] = sys_renameat,
/* 0x10A */ [SYS_symlinkat ] = sys_symlinkat,
/* 0x10B */ [SYS_readlinkat ] = sys_readlinkat,
/* 0x10C */ [SYS_fchmodat ] = sys_ignore,
/* 0x10D */ [SYS_faccessat ] = sys_faccessat,
Expand All @@ -719,7 +753,12 @@ static const HandlerFn kHandlers[] =
/* 0x125 */ [SYS_pipe2 ] = sys_pipe2,
/* 0x12E */ [SYS_prlimit64 ] = sys_ignore,
/* 0x133 */ [SYS_sendmmsg ] = sys_ignore,
/* 0x13C */ [SYS_renameat2 ] = sys_ignore,
/* 0x13E */ [SYS_getrandom ] = sys_ignore,
/* 0x14C */ [SYS_statx ] = sys_ignore,
/* 0x14E */ [SYS_rseq ] = sys_ignore,
/* 0x1B3 */ [SYS_clone3 ] = sys_ignore,
/* 0x1B7 */ [SYS_faccessat2 ] = sys_ignore,
};

// -----------------------------------------------------------------------------
Expand Down