Skip to content

Commit 5f780cb

Browse files
jpoiretoxr463
authored andcommitted
Add clone3.
1 parent 4d432a5 commit 5f780cb

File tree

8 files changed

+11
-0
lines changed

8 files changed

+11
-0
lines changed

src/syscall/sysnums-arm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,5 @@ static const Sysnum sysnums_arm[] = {
341341
[ 382 ] = PR_renameat2,
342342
[ 397 ] = PR_statx,
343343
[ 412 ] = PR_utimensat_time64,
344+
[ 435 ] = PR_clone3,
344345
};

src/syscall/sysnums-arm64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ static const Sysnum sysnums_arm64[] = {
264264
[ 275 ] = PR_sched_getattr,
265265
[ 276 ] = PR_renameat2,
266266
[ 291 ] = PR_statx,
267+
[ 435 ] = PR_clone3,
267268
};

src/syscall/sysnums-i386.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,5 @@ static const Sysnum sysnums_i386[] = {
353353
[ 353 ] = PR_renameat2,
354354
[ 383 ] = PR_statx,
355355
[ 412 ] = PR_utimensat_time64,
356+
[ 435 ] = PR_clone3,
356357
};

src/syscall/sysnums-sh4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,5 @@ static const Sysnum sysnums_sh4[] = {
344344
[ 369 ] = PR_sched_setattr,
345345
[ 370 ] = PR_sched_getattr,
346346
[ 371 ] = PR_renameat2,
347+
[ 435 ] = PR_clone3,
347348
};

src/syscall/sysnums-x32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ static const Sysnum sysnums_x32[] = {
277277
[ 315 ] = PR_sched_getattr,
278278
[ 316 ] = PR_renameat2,
279279
[ 332 ] = PR_statx,
280+
[ 435 ] = PR_clone3,
280281
[ 439 ] = PR_faccessat2,
281282
[ 512 ] = PR_rt_sigaction,
282283
[ 513 ] = PR_rt_sigreturn,

src/syscall/sysnums-x86_64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,5 +319,6 @@ static const Sysnum sysnums_x86_64[] = {
319319
[ 315 ] = PR_sched_getattr,
320320
[ 316 ] = PR_renameat2,
321321
[ 332 ] = PR_statx,
322+
[ 435 ] = PR_clone3,
322323
[ 439 ] = PR_faccessat2,
323324
};

src/syscall/sysnums.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ SYSNUM(clock_gettime)
3838
SYSNUM(clock_nanosleep)
3939
SYSNUM(clock_settime)
4040
SYSNUM(clone)
41+
SYSNUM(clone3)
4142
SYSNUM(close)
4243
SYSNUM(connect)
4344
SYSNUM(creat)

src/tracee/tracee.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ int new_child(Tracee *parent, word_t clone_flags)
403403
status = fetch_regs(parent);
404404
if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone)
405405
clone_flags = peek_reg(parent, CURRENT, SYSARG_1);
406+
else if (status >= 0 && get_sysnum(parent, CURRENT) == PR_clone3)
407+
// Look at the first word of the clone_args structure, which
408+
// contains the usual clone flags.
409+
clone_flags = peek_word(parent, peek_reg(parent, CURRENT, SYSARG_1));
406410

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

0 commit comments

Comments
 (0)