Skip to content

Commit

Permalink
Add clone3.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoiret authored and oxr463 committed Jun 3, 2023
1 parent 4d432a5 commit 5f780cb
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/syscall/sysnums-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,5 @@ static const Sysnum sysnums_arm[] = {
[ 382 ] = PR_renameat2,
[ 397 ] = PR_statx,
[ 412 ] = PR_utimensat_time64,
[ 435 ] = PR_clone3,
};
1 change: 1 addition & 0 deletions src/syscall/sysnums-arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,5 @@ static const Sysnum sysnums_arm64[] = {
[ 275 ] = PR_sched_getattr,
[ 276 ] = PR_renameat2,
[ 291 ] = PR_statx,
[ 435 ] = PR_clone3,
};
1 change: 1 addition & 0 deletions src/syscall/sysnums-i386.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,5 @@ static const Sysnum sysnums_i386[] = {
[ 353 ] = PR_renameat2,
[ 383 ] = PR_statx,
[ 412 ] = PR_utimensat_time64,
[ 435 ] = PR_clone3,
};
1 change: 1 addition & 0 deletions src/syscall/sysnums-sh4.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,5 @@ static const Sysnum sysnums_sh4[] = {
[ 369 ] = PR_sched_setattr,
[ 370 ] = PR_sched_getattr,
[ 371 ] = PR_renameat2,
[ 435 ] = PR_clone3,
};
1 change: 1 addition & 0 deletions src/syscall/sysnums-x32.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ static const Sysnum sysnums_x32[] = {
[ 315 ] = PR_sched_getattr,
[ 316 ] = PR_renameat2,
[ 332 ] = PR_statx,
[ 435 ] = PR_clone3,
[ 439 ] = PR_faccessat2,
[ 512 ] = PR_rt_sigaction,
[ 513 ] = PR_rt_sigreturn,
Expand Down
1 change: 1 addition & 0 deletions src/syscall/sysnums-x86_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,6 @@ static const Sysnum sysnums_x86_64[] = {
[ 315 ] = PR_sched_getattr,
[ 316 ] = PR_renameat2,
[ 332 ] = PR_statx,
[ 435 ] = PR_clone3,
[ 439 ] = PR_faccessat2,
};
1 change: 1 addition & 0 deletions src/syscall/sysnums.list
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SYSNUM(clock_gettime)
SYSNUM(clock_nanosleep)
SYSNUM(clock_settime)
SYSNUM(clone)
SYSNUM(clone3)
SYSNUM(close)
SYSNUM(connect)
SYSNUM(creat)
Expand Down
4 changes: 4 additions & 0 deletions src/tracee/tracee.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ int new_child(Tracee *parent, word_t clone_flags)
status = fetch_regs(parent);
if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone)
clone_flags = peek_reg(parent, CURRENT, SYSARG_1);
else if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone3)
// Look at the first word of the clone_args structure, which
// contains the usual clone flags.
clone_flags = peek_word(parent, peek_reg(parent, CURRENT, SYSARG_1));

/* Get the pid of the parent's new child. */
status = ptrace(PTRACE_GETEVENTMSG, parent->pid, NULL, &pid);
Expand Down

0 comments on commit 5f780cb

Please sign in to comment.