[PATCH] renameat2: add decoding support
Mike Frysinger
vapier at gentoo.org
Thu Aug 14 08:05:41 UTC 2014
Also update syscall tables to the point where they include renameat2.
* file.c (sys_renameat2): New function.
* pathtrace.c (pathtrace_match): Handle sys_renameat2.
* linux/syscall.h (sys_renameat2): New prototype.
* linux/aarch64/syscallent1.h: Add kcmp/finit_module/sched_setattr/
sched_getattr/renameat2.
* linux/alpha/syscallent.h: Add kcmp/finit_module.
* linux/arm/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/hppa/syscallent.h: Add sched_setattr/sched_getattr/utimes/renameat2.
* linux/i386/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Add getdents64/sched_setattr/sched_getattr/
renameat2.
* linux/mips/syscallent-o32.h: Add sched_setattr/sched_getattr/renameat2.
* linux/powerpc/syscallent.h: Fix finit_module/kcmp order. Add sched_setattr/
sched_getattr/renameat2.
* linux/s390/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Add sched_setattr/sched_getattr.
* xlat/rename_flags.in: New file.
---
file.c | 16 ++++++++++++++++
linux/aarch64/syscallent1.h | 5 +++++
linux/alpha/syscallent.h | 2 ++
linux/arm/syscallent.h | 3 +++
linux/hppa/syscallent.h | 4 ++++
linux/i386/syscallent.h | 6 +++---
linux/ia64/syscallent.h | 3 +++
linux/m68k/syscallent.h | 6 +++---
linux/microblaze/syscallent.h | 3 +++
linux/mips/syscallent-n32.h | 10 ++++++++--
linux/mips/syscallent-n64.h | 12 ++++++++++--
linux/mips/syscallent-o32.h | 6 ++++++
linux/powerpc/syscallent.h | 10 +++++-----
linux/s390/syscallent.h | 6 +++---
linux/s390x/syscallent.h | 6 +++---
linux/sparc/syscallent.h | 7 +++----
linux/syscall.h | 1 +
linux/x32/syscallent.h | 5 ++++-
linux/x86_64/syscallent.h | 3 +++
linux/xtensa/syscallent.h | 2 ++
pathtrace.c | 1 +
xlat/rename_flags.in | 2 ++
22 files changed, 93 insertions(+), 26 deletions(-)
create mode 100644 xlat/rename_flags.in
diff --git a/file.c b/file.c
index 360408f..18b0f9d 100644
--- a/file.c
+++ b/file.c
@@ -1780,6 +1780,22 @@ sys_renameat(struct tcb *tcp)
return 0;
}
+#include "xlat/rename_flags.h"
+
+int
+sys_renameat2(struct tcb *tcp)
+{
+ if (entering(tcp)) {
+ int ret = sys_renameat(tcp);
+ if (ret)
+ return ret;
+
+ tprints(", ");
+ printflags(rename_flags, tcp->u_arg[4], "RENAME_??");
+ }
+ return 0;
+}
+
int
sys_chown(struct tcb *tcp)
{
diff --git a/linux/aarch64/syscallent1.h b/linux/aarch64/syscallent1.h
index ef23db3..d1a9eae 100644
--- a/linux/aarch64/syscallent1.h
+++ b/linux/aarch64/syscallent1.h
@@ -258,6 +258,11 @@
{ 4, TN, sys_sendmmsg, "sendmmsg" }, /* 269 */
{ 6, 0, sys_process_vm_readv, "process_vm_readv" }, /* 270 */
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 271 */
+ { 5, 0, sys_kcmp, "kcmp" }, /* 272 */
+ { 3, TD, sys_finit_module, "finit_module" }, /* 273 */
+ { 3, 0, printargs, "sched_setattr" }, /* 274 */
+ { 4, 0, printargs, "sched_getattr" }, /* 275 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 276 */
/* Blank down to 1023 */
[272 ... 1023] = { },
diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h
index 581475c..408854e 100644
--- a/linux/alpha/syscallent.h
+++ b/linux/alpha/syscallent.h
@@ -532,3 +532,5 @@
{ 4, TN, sys_sendmmsg, "sendmmsg" }, /* 503 */
{ 6, 0, sys_process_vm_readv, "process_vm_readv" }, /* 504 */
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 505 */
+ { 5, 0, sys_kcmp, "kcmp" }, /* 506 */
+ { 3, TD, sys_finit_module, "finit_module" }, /* 507 */
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index 1656af6..e8aa3d0 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -408,6 +408,9 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 377 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 378 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 379 */
+ { 3, 0, printargs, "sched_setattr" }, /* 380 */
+ { 4, 0, printargs, "sched_getattr" }, /* 381 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 382 */
#ifdef __ARM_EABI__
# define ARM_LAST_ORDINARY_SYSCALL 379
#else
diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h
index 2548f46..4098f88 100644
--- a/linux/hppa/syscallent.h
+++ b/linux/hppa/syscallent.h
@@ -336,3 +336,7 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 331 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 332 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 333 */
+ { 3, 0, printargs, "sched_setattr" }, /* 334 */
+ { 4, 0, printargs, "sched_getattr" }, /* 335 */
+ { 2, TF, sys_utimes, "utimes" }, /* 336 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 337 */
diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h
index a8daacf..455485f 100644
--- a/linux/i386/syscallent.h
+++ b/linux/i386/syscallent.h
@@ -379,9 +379,9 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 348 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 349 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 350 */
- { 5, 0, NULL, NULL }, /* 351 */
- { 5, 0, NULL, NULL }, /* 352 */
- { 5, 0, NULL, NULL }, /* 353 */
+ { 3, 0, printargs, "sched_setattr" }, /* 351 */
+ { 4, 0, printargs, "sched_getattr" }, /* 352 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 353 */
{ 5, 0, NULL, NULL }, /* 354 */
{ 5, 0, NULL, NULL }, /* 355 */
{ 5, 0, NULL, NULL }, /* 356 */
diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h
index 9aeef0b..7c00602 100644
--- a/linux/ia64/syscallent.h
+++ b/linux/ia64/syscallent.h
@@ -1127,3 +1127,6 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 1333 */
{ 4, TN, sys_accept4, "accept4" }, /* 1334 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 1335 */
+ { 3, 0, printargs, "sched_setattr" }, /* 1336 */
+ { 4, 0, printargs, "sched_getattr" }, /* 1337 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 1338 */
diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h
index b227776..d0b88c9 100644
--- a/linux/m68k/syscallent.h
+++ b/linux/m68k/syscallent.h
@@ -375,9 +375,9 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 346 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 347 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 348 */
- { 5, 0, NULL, NULL }, /* 349 */
- { 5, 0, NULL, NULL }, /* 350 */
- { 5, 0, NULL, NULL }, /* 351 */
+ { 3, 0, printargs, "sched_setattr" }, /* 349 */
+ { 4, 0, printargs, "sched_getattr" }, /* 350 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 351 */
{ 5, 0, NULL, NULL }, /* 352 */
{ 5, 0, NULL, NULL }, /* 353 */
{ 5, 0, NULL, NULL }, /* 354 */
diff --git a/linux/microblaze/syscallent.h b/linux/microblaze/syscallent.h
index 5c5be55..f75978d 100644
--- a/linux/microblaze/syscallent.h
+++ b/linux/microblaze/syscallent.h
@@ -407,3 +407,6 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 378 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 379 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 380 */
+ { 3, 0, printargs, "sched_setattr" }, /* 381 */
+ { 4, 0, printargs, "sched_getattr" }, /* 382 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 383 */
diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h
index 4b0e6bc..4527df6 100644
--- a/linux/mips/syscallent-n32.h
+++ b/linux/mips/syscallent-n32.h
@@ -311,8 +311,11 @@
{ 2, TD, sys_setns, "setns" }, /* 6308 */
{ 6, 0, sys_process_vm_readv, "process_vm_readv" }, /* 6309 */
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 6310 */
- { 5, 0, sys_kcmp, "kcmp" }, /* 6311 */
- { 3, TD, sys_finit_module, "finit_module" }, /* 6312 */
+ { 5, 0, sys_kcmp, "kcmp" }, /* 6311 */
+ { 3, TD, sys_finit_module, "finit_module" }, /* 6312 */
+ { 3, 0, printargs, "sched_setattr" }, /* 6313 */
+ { 4, 0, printargs, "sched_getattr" }, /* 6314 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 6315 */
#else
{ 0, 0, printargs, "n32_read" }, /* 6000 */
{ 0, 0, printargs, "n32_write" }, /* 6001 */
@@ -627,4 +630,7 @@
{ 6, 0, printargs, "n32_process_vm_writev" }, /* 6310 */
{ 5, 0, printargs, "n32_kcmp" }, /* 6311 */
{ 3, TD, printargs, "n32_finit_module" }, /* 6312 */
+ { 3, 0, printargs, "n32_sched_setattr" }, /* 6313 */
+ { 4, 0, printargs, "n32_sched_getattr" }, /* 6314 */
+ { 5, TD|TF, printargs, "n32_renameat2" }, /* 6315 */
#endif
diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h
index 524f280..39f0a9a 100644
--- a/linux/mips/syscallent-n64.h
+++ b/linux/mips/syscallent-n64.h
@@ -308,6 +308,10 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 5305 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 5306 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 5307 */
+ { 3, TD, sys_getdents64, "getdents64" }, /* 5308 */
+ { 3, 0, printargs, "sched_setattr" }, /* 5309 */
+ { 4, 0, printargs, "sched_getattr" }, /* 5310 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 5311 */
#else
{ 0, 0, printargs, "n64_read" }, /* 5000 */
{ 0, 0, printargs, "n64_write" }, /* 5001 */
@@ -615,7 +619,11 @@
{ 2, TD, printargs, "n64_setns" }, /* 5303 */
{ 6, 0, printargs, "n64_process_vm_readv" }, /* 5304 */
{ 6, 0, printargs, "n64_process_vm_writev" }, /* 5305 */
- { 5, 0, printargs, "kcmp" }, /* 5306 */
- { 3, TD, printargs, "finit_module" }, /* 5307 */
+ { 5, 0, printargs, "n64_kcmp" }, /* 5306 */
+ { 3, TD, printargs, "n64_finit_module" }, /* 5307 */
+ { 3, TD, printargs, "n64_getdents64" }, /* 5308 */
+ { 3, 0, printargs, "n64_sched_setattr" }, /* 5309 */
+ { 4, 0, printargs, "n64_sched_getattr" }, /* 5310 */
+ { 5, TD|TF, printargs, "n64_renameat2" }, /* 5311 */
#endif
[5308 ... 5999] = { }, /* 5999 */ /* end of Linux N64 */
diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h
index a371fb1..0418132 100644
--- a/linux/mips/syscallent-o32.h
+++ b/linux/mips/syscallent-o32.h
@@ -349,6 +349,9 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 4346 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 4347 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 4348 */
+ { 3, 0, printargs, "sched_setattr" }, /* 4349 */
+ { 4, 0, printargs, "sched_getattr" }, /* 4350 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 4351 */
#else
{ 0, 0, printargs, "o32_syscall" }, /* 4000 */
{ 1, TP|SE, printargs, "o32_exit" }, /* 4001 */
@@ -699,5 +702,8 @@
{ 6, 0, printargs, "o32_process_vm_writev" }, /* 4346 */
{ 5, 0, printargs, "o32_kcmp" }, /* 4347 */
{ 3, TD, printargs, "o32_finit_module" }, /* 4348 */
+ { 3, 0, printargs, "o32_sched_setattr" }, /* 4349 */
+ { 4, 0, printargs, "o32_sched_getattr" }, /* 4350 */
+ { 5, TD|TF, printargs, "o32_renameat2" }, /* 4351 */
#endif
[4349 ... 4999] = { }, /* 4999 */ /* end of Linux o32 */
diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h
index 7d7825e..d6f516c 100644
--- a/linux/powerpc/syscallent.h
+++ b/linux/powerpc/syscallent.h
@@ -379,11 +379,11 @@
{ 2, TD, sys_setns, "setns" }, /* 350 */
{ 6, 0, sys_process_vm_readv, "process_vm_readv" }, /* 351 */
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 352 */
- { 5, 0, sys_kcmp, "kcmp" }, /* 353 */
- { 3, TD, sys_finit_module, "finit_module" }, /* 354 */
- { 5, 0, NULL, NULL }, /* 355 */
- { 5, 0, NULL, NULL }, /* 356 */
- { 5, 0, NULL, NULL }, /* 357 */
+ { 3, TD, sys_finit_module, "finit_module" }, /* 353 */
+ { 5, 0, sys_kcmp, "kcmp" }, /* 354 */
+ { 3, 0, printargs, "sched_setattr" }, /* 355 */
+ { 4, 0, printargs, "sched_getattr" }, /* 356 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 357 */
{ 5, 0, NULL, NULL }, /* 358 */
{ 5, 0, NULL, NULL }, /* 359 */
{ 5, 0, NULL, NULL }, /* 360 */
diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h
index 108e4c0..e319c08 100644
--- a/linux/s390/syscallent.h
+++ b/linux/s390/syscallent.h
@@ -373,9 +373,9 @@
{ 2, 0, printargs, "s390_runtime_instr" }, /* 342 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 343 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 344 */
- { 5, 0, NULL, NULL }, /* 345 */
- { 5, 0, NULL, NULL }, /* 346 */
- { 5, 0, NULL, NULL }, /* 347 */
+ { 3, 0, printargs, "sched_setattr" }, /* 345 */
+ { 4, 0, printargs, "sched_getattr" }, /* 346 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 347 */
{ 5, 0, NULL, NULL }, /* 348 */
{ 5, 0, NULL, NULL }, /* 349 */
{ 5, 0, NULL, NULL }, /* 350 */
diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h
index 3b93a80..bef3a6e 100644
--- a/linux/s390x/syscallent.h
+++ b/linux/s390x/syscallent.h
@@ -372,9 +372,9 @@
{ 2, 0, printargs, "s390_runtime_instr" }, /* 342 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 343 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 344 */
- { 5, 0, NULL, NULL }, /* 345 */
- { 5, 0, NULL, NULL }, /* 346 */
- { 5, 0, NULL, NULL }, /* 347 */
+ { 3, 0, printargs, "sched_setattr" }, /* 345 */
+ { 4, 0, printargs, "sched_getattr" }, /* 346 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 347 */
{ 5, 0, NULL, NULL }, /* 348 */
{ 5, 0, NULL, NULL }, /* 349 */
{ 5, 0, NULL, NULL }, /* 350 */
diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h
index e62e4e1..b3d84fa 100644
--- a/linux/sparc/syscallent.h
+++ b/linux/sparc/syscallent.h
@@ -341,10 +341,9 @@
{ 0, NF, printargs, "kern_features" }, /* 340 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 341 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 342 */
- { 5, 0, NULL, NULL }, /* 343 */
- { 5, 0, NULL, NULL }, /* 344 */
- { 5, 0, NULL, NULL }, /* 345 */
- { 5, 0, NULL, NULL }, /* 346 */
+ { 3, 0, printargs, "sched_setattr" }, /* 343 */
+ { 4, 0, printargs, "sched_getattr" }, /* 345 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 346 */
{ 5, 0, NULL, NULL }, /* 347 */
{ 5, 0, NULL, NULL }, /* 348 */
{ 5, 0, NULL, NULL }, /* 349 */
diff --git a/linux/syscall.h b/linux/syscall.h
index 38aa4bd..0e69598 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -207,6 +207,7 @@ int sys_recvmsg();
int sys_remap_file_pages();
int sys_removexattr();
int sys_renameat();
+int sys_renameat2();
int sys_request_key();
int sys_restart_syscall();
int sys_rt_sigaction();
diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h
index 7059cbf..a032698 100644
--- a/linux/x32/syscallent.h
+++ b/linux/x32/syscallent.h
@@ -312,8 +312,11 @@
{ 6, 0, printargs, "64:process_vm_writev" }, /* 311 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 312 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 313 */
+ { 3, 0, printargs, "sched_setattr" }, /* 314 */
+ { 4, 0, printargs, "sched_getattr" }, /* 315 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 316 */
- [314 ... 511] = {},
+ [317 ... 511] = {},
{ 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 512 */
{ 0, TS, sys_rt_sigreturn, "rt_sigreturn" }, /* 513 */
diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h
index 10c4eeb..59775d6 100644
--- a/linux/x86_64/syscallent.h
+++ b/linux/x86_64/syscallent.h
@@ -312,3 +312,6 @@
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 311 */
{ 5, 0, sys_kcmp, "kcmp" }, /* 312 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 313 */
+ { 3, 0, printargs, "sched_setattr" }, /* 314 */
+ { 4, 0, printargs, "sched_getattr" }, /* 315 */
+ { 5, TD|TF, sys_renameat2, "renameat2" }, /* 316 */
diff --git a/linux/xtensa/syscallent.h b/linux/xtensa/syscallent.h
index cc32cec..9666ce4 100644
--- a/linux/xtensa/syscallent.h
+++ b/linux/xtensa/syscallent.h
@@ -324,3 +324,5 @@
{ 5, 0, sys_kcmp, "kcmp" }, /* 331 */
{ 3, TD, sys_finit_module, "finit_module" }, /* 332 */
{ 4, TN, sys_accept4, "accept4" }, /* 333 */
+ { 3, 0, printargs, "sched_setattr" }, /* 334 */
+ { 4, 0, printargs, "sched_getattr" }, /* 335 */
diff --git a/pathtrace.c b/pathtrace.c
index 9fb99c4..ccfb3c2 100644
--- a/pathtrace.c
+++ b/pathtrace.c
@@ -211,6 +211,7 @@ pathtrace_match(struct tcb *tcp)
}
if (s->sys_func == sys_renameat ||
+ s->sys_func == sys_renameat2 ||
s->sys_func == sys_linkat)
{
/* fd, path, fd, path */
diff --git a/xlat/rename_flags.in b/xlat/rename_flags.in
new file mode 100644
index 0000000..324bded
--- /dev/null
+++ b/xlat/rename_flags.in
@@ -0,0 +1,2 @@
+RENAME_NOREPLACE
+RENAME_EXCHANGE
--
2.0.0
More information about the Strace-devel
mailing list