Implement decoding of preadv2 and pwritev2 syscalls

* io.c: Include "xlat/rwf_flags.h".
(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
New functions.
(SYS_FUNC(preadv)): Use do_preadv.
(SYS_FUNC(pwritev)): Use do_pwritev.
* linux/32/syscallent.h (preadv2, pwritev2): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
* xlat/rwf_flags.in: New file.
* NEWS: Mention parsers of new syscalls.
This commit is contained in:
Дмитрий Левин 2016-05-11 00:42:10 +00:00
parent ea7b9dbcbd
commit a6dd094287
22 changed files with 76 additions and 4 deletions

5
NEWS
View File

@ -10,8 +10,9 @@ Noteworthy changes in release ?.?? (????-??-??)
* Added decoding of bind, listen, and setsockopt direct syscalls on sparc. * Added decoding of bind, listen, and setsockopt direct syscalls on sparc.
* Implemented caching of netlink conversations to reduce amount of time * Implemented caching of netlink conversations to reduce amount of time
spent in decoding socket details in -yy mode. spent in decoding socket details in -yy mode.
* Implemented decoding of copy_file_range syscall. * Implemented decoding of copy_file_range, preadv2, and pwritev2 syscalls.
* Implemented dumping of preadv, pwritev, and vmsplice syscalls. * Implemented dumping of preadv, preadv2, pwritev, pwritev2, and vmsplice
syscalls.
* Updated lists of ioctl commands from Linux 4.5. * Updated lists of ioctl commands from Linux 4.5.
* Bug fixes * Bug fixes

36
io.c
View File

@ -207,7 +207,10 @@ print_lld_from_low_high_val(struct tcb *tcp, int arg)
#endif #endif
} }
SYS_FUNC(preadv) #include "xlat/rwf_flags.h"
static int
do_preadv(struct tcb *tcp, const int flags_arg)
{ {
if (entering(tcp)) { if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]); printfd(tcp, tcp->u_arg[0]);
@ -217,21 +220,50 @@ SYS_FUNC(preadv)
tcp->u_rval); tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[2]); tprintf(", %lu, ", tcp->u_arg[2]);
print_lld_from_low_high_val(tcp, 3); print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
}
} }
return 0; return 0;
} }
SYS_FUNC(pwritev) SYS_FUNC(preadv)
{
return do_preadv(tcp, -1);
}
SYS_FUNC(preadv2)
{
return do_preadv(tcp, 5);
}
static int
do_pwritev(struct tcb *tcp, const int flags_arg)
{ {
printfd(tcp, tcp->u_arg[0]); printfd(tcp, tcp->u_arg[0]);
tprints(", "); tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1); tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]); tprintf(", %lu, ", tcp->u_arg[2]);
print_lld_from_low_high_val(tcp, 3); print_lld_from_low_high_val(tcp, 3);
if (flags_arg >= 0) {
tprints(", ");
printflags(rwf_flags, tcp->u_arg[flags_arg], "RWF_???");
}
return RVAL_DECODED; return RVAL_DECODED;
} }
SYS_FUNC(pwritev)
{
return do_pwritev(tcp, -1);
}
SYS_FUNC(pwritev2)
{
return do_pwritev(tcp, 5);
}
#include "xlat/splice_flags.h" #include "xlat/splice_flags.h"
SYS_FUNC(tee) SYS_FUNC(tee)

View File

@ -276,6 +276,8 @@
[283] = { 2, 0, SEN(membarrier), "membarrier", }, [283] = { 2, 0, SEN(membarrier), "membarrier", },
[284] = { 3, TM, SEN(mlock2), "mlock2" }, [284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },
#undef sys_ARCH_mmap #undef sys_ARCH_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2 #undef ARCH_WANT_SYNC_FILE_RANGE2

View File

@ -269,3 +269,5 @@
[283] = { 2, 0, SEN(membarrier), "membarrier", }, [283] = { 2, 0, SEN(membarrier), "membarrier", },
[284] = { 3, TM, SEN(mlock2), "mlock2" }, [284] = { 3, TM, SEN(mlock2), "mlock2" },
[285] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [285] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[286] = { 6, TD, SEN(preadv2), "preadv2" },
[287] = { 6, TD, SEN(pwritev2), "pwritev2" },

View File

@ -416,6 +416,8 @@
[389] = { 2, 0, SEN(membarrier), "membarrier", }, [389] = { 2, 0, SEN(membarrier), "membarrier", },
[390] = { 3, TM, SEN(mlock2), "mlock2" }, [390] = { 3, TM, SEN(mlock2), "mlock2" },
[391] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [391] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[392] = { 6, TD, SEN(preadv2), "preadv2" },
[393] = { 6, TD, SEN(pwritev2), "pwritev2" },
#ifdef __ARM_EABI__ #ifdef __ARM_EABI__
# define ARM_FIRST_SHUFFLED_SYSCALL 400 # define ARM_FIRST_SHUFFLED_SYSCALL 400

View File

@ -349,3 +349,5 @@
[344] = { 1, TD, SEN(userfaultfd), "userfaultfd", }, [344] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
[345] = { 3, TM, SEN(mlock2), "mlock2" }, [345] = { 3, TM, SEN(mlock2), "mlock2" },
[346] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [346] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[347] = { 6, TD, SEN(preadv2), "preadv2" },
[348] = { 6, TD, SEN(pwritev2), "pwritev2" },

View File

@ -403,6 +403,8 @@
[375] = { 2, 0, SEN(membarrier), "membarrier", }, [375] = { 2, 0, SEN(membarrier), "membarrier", },
[376] = { 3, TM, SEN(mlock2), "mlock2" }, [376] = { 3, TM, SEN(mlock2), "mlock2" },
[377] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [377] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[378] = { 6, TD, SEN(preadv2), "preadv2" },
[379] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -364,3 +364,5 @@
[1345] = { 5, 0, SEN(kcmp), "kcmp" }, [1345] = { 5, 0, SEN(kcmp), "kcmp" },
[1346] = { 3, TM, SEN(mlock2), "mlock2" }, [1346] = { 3, TM, SEN(mlock2), "mlock2" },
[1347] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [1347] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[1348] = { 6, TD, SEN(preadv2), "preadv2" },
[1349] = { 6, TD, SEN(pwritev2), "pwritev2" },

View File

@ -402,6 +402,8 @@
[374] = { 2, 0, SEN(membarrier), "membarrier", }, [374] = { 2, 0, SEN(membarrier), "membarrier", },
[375] = { 3, TM, SEN(mlock2), "mlock2" }, [375] = { 3, TM, SEN(mlock2), "mlock2" },
[376] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [376] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[377] = { 6, TD, SEN(preadv2), "preadv2" },
[378] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -325,6 +325,8 @@
[6322] = { 2, 0, SEN(membarrier), "membarrier", }, [6322] = { 2, 0, SEN(membarrier), "membarrier", },
[6323] = { 3, TM, SEN(mlock2), "mlock2" }, [6323] = { 3, TM, SEN(mlock2), "mlock2" },
[6324] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [6324] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[6325] = { 6, TD, SEN(preadv2), "preadv2" },
[6326] = { 6, TD, SEN(pwritev2), "pwritev2" },
# define SYS_socket_subcall 6400 # define SYS_socket_subcall 6400
# include "subcall.h" # include "subcall.h"

View File

@ -321,6 +321,8 @@
[5318] = { 2, 0, SEN(membarrier), "membarrier", }, [5318] = { 2, 0, SEN(membarrier), "membarrier", },
[5319] = { 3, TM, SEN(mlock2), "mlock2" }, [5319] = { 3, TM, SEN(mlock2), "mlock2" },
[5320] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [5320] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[5321] = { 6, TD, SEN(preadv2), "preadv2" },
[5322] = { 6, TD, SEN(pwritev2), "pwritev2" },
# define SYS_socket_subcall 5400 # define SYS_socket_subcall 5400
# include "subcall.h" # include "subcall.h"

View File

@ -361,6 +361,8 @@
[4358] = { 2, 0, SEN(membarrier), "membarrier", }, [4358] = { 2, 0, SEN(membarrier), "membarrier", },
[4359] = { 3, TM, SEN(mlock2), "mlock2" }, [4359] = { 3, TM, SEN(mlock2), "mlock2" },
[4360] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [4360] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[4361] = { 6, TD, SEN(preadv2), "preadv2" },
[4362] = { 6, TD, SEN(pwritev2), "pwritev2" },
# define SYS_socket_subcall 4400 # define SYS_socket_subcall 4400
# include "subcall.h" # include "subcall.h"

View File

@ -406,6 +406,8 @@
[377] = { 3, TI, SEN(shmctl), "shmctl" }, [377] = { 3, TI, SEN(shmctl), "shmctl" },
[378] = { 3, TM, SEN(mlock2), "mlock2" }, [378] = { 3, TM, SEN(mlock2), "mlock2" },
[379] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [379] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[380] = { 6, TD, SEN(preadv2), "preadv2" },
[381] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -401,6 +401,8 @@
[377] = { 3, TI, SEN(shmctl), "shmctl" }, [377] = { 3, TI, SEN(shmctl), "shmctl" },
[378] = { 3, TM, SEN(mlock2), "mlock2" }, [378] = { 3, TM, SEN(mlock2), "mlock2" },
[379] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [379] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[380] = { 6, TD, SEN(preadv2), "preadv2" },
[381] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -404,6 +404,8 @@
[373] = { 2, TN, SEN(shutdown), "shutdown" }, [373] = { 2, TN, SEN(shutdown), "shutdown" },
[374] = { 3, TM, SEN(mlock2), "mlock2" }, [374] = { 3, TM, SEN(mlock2), "mlock2" },
[375] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [375] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[376] = { 6, TD, SEN(preadv2), "preadv2" },
[377] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -388,6 +388,8 @@
[373] = { 2, TN, SEN(shutdown), "shutdown" }, [373] = { 2, TN, SEN(shutdown), "shutdown" },
[374] = { 3, TM, SEN(mlock2), "mlock2" }, [374] = { 3, TM, SEN(mlock2), "mlock2" },
[375] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [375] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[376] = { 6, TD, SEN(preadv2), "preadv2" },
[377] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -356,6 +356,8 @@
[355] = { 5, TN, SEN(setsockopt), "setsockopt" }, [355] = { 5, TN, SEN(setsockopt), "setsockopt" },
[356] = { 3, TM, SEN(mlock2), "mlock2" }, [356] = { 3, TM, SEN(mlock2), "mlock2" },
[357] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [357] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[358] = { 6, TD, SEN(preadv2), "preadv2" },
[359] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -354,6 +354,8 @@
[355] = { 5, TN, SEN(setsockopt), "setsockopt" }, [355] = { 5, TN, SEN(setsockopt), "setsockopt" },
[356] = { 3, TM, SEN(mlock2), "mlock2" }, [356] = { 3, TM, SEN(mlock2), "mlock2" },
[357] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [357] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[358] = { 6, TD, SEN(preadv2), "preadv2" },
[359] = { 6, TD, SEN(pwritev2), "pwritev2" },
#define SYS_socket_subcall 400 #define SYS_socket_subcall 400
#include "subcall.h" #include "subcall.h"

View File

@ -325,6 +325,8 @@
[324] = { 2, 0, SEN(membarrier), "membarrier", }, [324] = { 2, 0, SEN(membarrier), "membarrier", },
[325] = { 3, TM, SEN(mlock2), "mlock2" }, [325] = { 3, TM, SEN(mlock2), "mlock2" },
[326] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [326] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[327] = { 6, TD, SEN(printargs), "64:preadv2" },
[328] = { 6, TD, SEN(printargs), "64:pwritev2" },
[327 ... 511] = { }, [327 ... 511] = { },
/* /*
* x32-specific system call numbers start at 512 to avoid cache impact * x32-specific system call numbers start at 512 to avoid cache impact

View File

@ -325,3 +325,5 @@
[324] = { 2, 0, SEN(membarrier), "membarrier", }, [324] = { 2, 0, SEN(membarrier), "membarrier", },
[325] = { 3, TM, SEN(mlock2), "mlock2" }, [325] = { 3, TM, SEN(mlock2), "mlock2" },
[326] = { 6, TD, SEN(copy_file_range), "copy_file_range" }, [326] = { 6, TD, SEN(copy_file_range), "copy_file_range" },
[327] = { 6, TD, SEN(preadv2), "preadv2" },
[328] = { 6, TD, SEN(pwritev2), "pwritev2" },

View File

@ -686,6 +686,7 @@ dumpio(struct tcb *tcp)
return; return;
case SEN_readv: case SEN_readv:
case SEN_preadv: case SEN_preadv:
case SEN_preadv2:
dumpiov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1], dumpiov_upto(tcp, tcp->u_arg[2], tcp->u_arg[1],
tcp->u_rval); tcp->u_rval);
return; return;
@ -707,6 +708,7 @@ dumpio(struct tcb *tcp)
break; break;
case SEN_writev: case SEN_writev:
case SEN_pwritev: case SEN_pwritev:
case SEN_pwritev2:
case SEN_vmsplice: case SEN_vmsplice:
dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
break; break;

1
xlat/rwf_flags.in Normal file
View File

@ -0,0 +1 @@
RWF_HIPRI 1