From c2cf5def6e307c1045e03f908ec9055866ec9c4a Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 12 May 2019 22:45:45 +0000 Subject: [PATCH] Implement and use new parsers of poll syscall * poll.c (SYS_FUNC(poll)): Remove. [HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_OLD_TIME64_SYSCALLS] (do_poll): New function. [HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(poll_time32)): Likewise. [HAVE_ARCH_OLD_TIME64_SYSCALLS] (SYS_FUNC(poll_time64)): Likewise. * pathtrace.c (pathtrace_match_set): Replace SEN_poll with SEN_poll_time32 and SEN_poll_time64. * linux/aarch64/syscallent.h: Replace SEN(poll) with SEN(poll_time64). * linux/alpha/syscallent.h: Likewise. * linux/ia64/syscallent.h: Likewise. * linux/mips/syscallent-n64.h: Likewise. * linux/powerpc64/syscallent.h: Likewise. * linux/s390x/syscallent.h: Likewise. * linux/sh64/syscallent.h: Likewise. * linux/sparc64/syscallent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/syscallent.h: Likewise. * linux/arm/syscallent.h: Replace SEN(poll) with SEN(poll_time32). * linux/avr32/syscallent.h: Likewise. * linux/bfin/syscallent.h: Likewise. * linux/hppa/syscallent.h: Likewise. * linux/i386/syscallent.h: Likewise. * linux/m68k/syscallent.h: Likewise. * linux/microblaze/syscallent.h: Likewise. * linux/mips/syscallent-n32.h: Likewise. * linux/mips/syscallent-o32.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/s390/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/sparc/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. --- linux/aarch64/syscallent.h | 2 +- linux/alpha/syscallent.h | 2 +- linux/arm/syscallent.h | 2 +- linux/avr32/syscallent.h | 2 +- linux/bfin/syscallent.h | 2 +- linux/hppa/syscallent.h | 2 +- linux/i386/syscallent.h | 2 +- linux/ia64/syscallent.h | 2 +- linux/m68k/syscallent.h | 2 +- linux/microblaze/syscallent.h | 2 +- linux/mips/syscallent-n32.h | 2 +- linux/mips/syscallent-n64.h | 2 +- linux/mips/syscallent-o32.h | 2 +- linux/powerpc/syscallent.h | 2 +- linux/powerpc64/syscallent.h | 2 +- linux/s390/syscallent.h | 2 +- linux/s390x/syscallent.h | 2 +- linux/sh/syscallent.h | 2 +- linux/sh64/syscallent.h | 2 +- linux/sparc/syscallent.h | 2 +- linux/sparc64/syscallent.h | 2 +- linux/x32/syscallent.h | 2 +- linux/x86_64/syscallent.h | 2 +- linux/xtensa/syscallent.h | 2 +- pathtrace.c | 3 ++- poll.c | 21 +++++++++++++++++++-- 26 files changed, 45 insertions(+), 27 deletions(-) diff --git a/linux/aarch64/syscallent.h b/linux/aarch64/syscallent.h index 6016a1d1..139674a6 100644 --- a/linux/aarch64/syscallent.h +++ b/linux/aarch64/syscallent.h @@ -66,7 +66,7 @@ [1065] = { 3, TD, SEN(getdents), "getdents" }, [1066] = { 3, TD|TF, SEN(futimesat), "futimesat" }, [1067] = { 5, TD, SEN(select), "select" }, -[1068] = { 3, TD, SEN(poll), "poll" }, +[1068] = { 3, TD, SEN(poll_time64), "poll" }, [1069] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, [1070] = { 2, TSFA, SEN(ustat), "ustat" }, [1071] = { 0, TP, SEN(vfork), "vfork" }, diff --git a/linux/alpha/syscallent.h b/linux/alpha/syscallent.h index d04789da..0d6e412d 100644 --- a/linux/alpha/syscallent.h +++ b/linux/alpha/syscallent.h @@ -101,7 +101,7 @@ [ 91] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 92] = { 3, TD, SEN(fcntl), "fcntl" }, [ 93] = { 5, TD, SEN(osf_select), "osf_select" }, -[ 94] = { 3, TD, SEN(poll), "poll" }, +[ 94] = { 3, TD, SEN(poll_time64), "poll" }, [ 95] = { 1, TD, SEN(fsync), "fsync" }, [ 96] = { 3, 0, SEN(setpriority), "setpriority" }, [ 97] = { 3, TN, SEN(socket), "socket" }, diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h index 52a8eebc..d99edd77 100644 --- a/linux/arm/syscallent.h +++ b/linux/arm/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 5, 0, SEN(vm86), "vm86" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h index 40f235c9..93d2b98c 100644 --- a/linux/avr32/syscallent.h +++ b/linux/avr32/syscallent.h @@ -150,7 +150,7 @@ [141] = { 1, 0, SEN(sched_get_priority_min), "sched_get_priority_min"}, [142] = { 2, 0, SEN(sched_rr_get_interval), "sched_rr_get_interval" }, [143] = { 2, 0, SEN(nanosleep), "nanosleep" }, -[144] = { 3, TD, SEN(poll), "poll" }, +[144] = { 3, TD, SEN(poll_time32), "poll" }, [145] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [146] = { 3, 0, SEN(setresgid), "setresgid" }, [147] = { 3, 0, SEN(getresgid), "getresgid" }, diff --git a/linux/bfin/syscallent.h b/linux/bfin/syscallent.h index 885b109b..0ecd05d4 100644 --- a/linux/bfin/syscallent.h +++ b/linux/bfin/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 5, 0, SEN(vm86), "vm86" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h index f5b119ca..6131681f 100644 --- a/linux/hppa/syscallent.h +++ b/linux/hppa/syscallent.h @@ -171,7 +171,7 @@ [165] = { 3, 0, SEN(getresuid), "getresuid" }, [166] = { 2, TS, SEN(sigaltstack), "sigaltstack" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid), "setresgid" }, [171] = { 3, 0, SEN(getresgid), "getresgid" }, diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h index 73e19db2..77523ec7 100644 --- a/linux/i386/syscallent.h +++ b/linux/i386/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 5, 0, SEN(vm86), "vm86" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h index 27ffad7e..992aa720 100644 --- a/linux/ia64/syscallent.h +++ b/linux/ia64/syscallent.h @@ -73,7 +73,7 @@ [1024 + 63] = { 2, 0, SEN(gettimeofday), "gettimeofday" }, [1024 + 64] = { 2, 0, SEN(settimeofday), "settimeofday" }, [1024 + 65] = { 5, TD, SEN(select), "select" }, -[1024 + 66] = { 3, TD, SEN(poll), "poll" }, +[1024 + 66] = { 3, TD, SEN(poll_time64), "poll" }, [1024 + 67] = { 2, TF, SEN(symlink), "symlink" }, [1024 + 68] = { 3, TF, SEN(readlink), "readlink" }, [1024 + 69] = { 1, TF, SEN(uselib), "uselib" }, diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h index 8fd41e55..7a2125c4 100644 --- a/linux/m68k/syscallent.h +++ b/linux/m68k/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 0, PU|NF, SEN(getpagesize), "getpagesize" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/microblaze/syscallent.h b/linux/microblaze/syscallent.h index d09258af..b5ba9eb5 100644 --- a/linux/microblaze/syscallent.h +++ b/linux/microblaze/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 5, 0, SEN(vm86), "vm86" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h index 96d2bc8c..d8812591 100644 --- a/linux/mips/syscallent-n32.h +++ b/linux/mips/syscallent-n32.h @@ -14,7 +14,7 @@ [6004] = { 2, TF|TST|TSTA, SEN(stat64), "stat" }, [6005] = { 2, TD|TFST|TSTA, SEN(fstat64), "fstat" }, [6006] = { 2, TF|TLST|TSTA, SEN(lstat64), "lstat" }, -[6007] = { 3, TD, SEN(poll), "poll" }, +[6007] = { 3, TD, SEN(poll_time32), "poll" }, [6008] = { 3, TD, SEN(lseek), "lseek" }, [6009] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [6010] = { 3, TM|SI, SEN(mprotect), "mprotect" }, diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h index 6b9d4f41..cbeda8d5 100644 --- a/linux/mips/syscallent-n64.h +++ b/linux/mips/syscallent-n64.h @@ -14,7 +14,7 @@ [5004] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, [5005] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [5006] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" }, -[5007] = { 3, TD, SEN(poll), "poll" }, +[5007] = { 3, TD, SEN(poll_time64), "poll" }, [5008] = { 3, TD, SEN(lseek), "lseek" }, [5009] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [5010] = { 3, TM|SI, SEN(mprotect), "mprotect" }, diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h index bd9b8003..bc1d1925 100644 --- a/linux/mips/syscallent-o32.h +++ b/linux/mips/syscallent-o32.h @@ -196,7 +196,7 @@ [4185] = { 3, 0, SEN(setresuid), "setresuid" }, [4186] = { 3, 0, SEN(getresuid), "getresuid" }, [4187] = { 5, 0, SEN(query_module), "query_module" }, -[4188] = { 3, TD, SEN(poll), "poll" }, +[4188] = { 3, TD, SEN(poll_time32), "poll" }, [4189] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [4190] = { 3, 0, SEN(setresgid), "setresgid" }, [4191] = { 3, 0, SEN(getresgid), "getresgid" }, diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h index 88769407..9f9cac5b 100644 --- a/linux/powerpc/syscallent.h +++ b/linux/powerpc/syscallent.h @@ -174,7 +174,7 @@ [164] = { 3, 0, SEN(setresuid), "setresuid" }, [165] = { 3, 0, SEN(getresuid), "getresuid" }, [166] = { 5, 0, SEN(query_module), "query_module" }, -[167] = { 3, TD, SEN(poll), "poll" }, +[167] = { 3, TD, SEN(poll_time32), "poll" }, [168] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [169] = { 3, 0, SEN(setresgid), "setresgid" }, [170] = { 3, 0, SEN(getresgid), "getresgid" }, diff --git a/linux/powerpc64/syscallent.h b/linux/powerpc64/syscallent.h index 46883302..3160c7e2 100644 --- a/linux/powerpc64/syscallent.h +++ b/linux/powerpc64/syscallent.h @@ -174,7 +174,7 @@ [164] = { 3, 0, SEN(setresuid), "setresuid" }, [165] = { 3, 0, SEN(getresuid), "getresuid" }, [166] = { 5, 0, SEN(query_module), "query_module" }, -[167] = { 3, TD, SEN(poll), "poll" }, +[167] = { 3, TD, SEN(poll_time64), "poll" }, [168] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [169] = { 3, 0, SEN(setresgid), "setresgid" }, [170] = { 3, 0, SEN(getresgid), "getresgid" }, diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h index 4f87ab31..9d4ddec0 100644 --- a/linux/s390/syscallent.h +++ b/linux/s390/syscallent.h @@ -177,7 +177,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h index f0e1a06e..e7fed9ff 100644 --- a/linux/s390x/syscallent.h +++ b/linux/s390x/syscallent.h @@ -167,7 +167,7 @@ [163] = { 5, TM|SI, SEN(mremap), "mremap" }, [164 ... 166] = { }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time64), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170 ... 171] = { }, [172] = { 5, 0, SEN(prctl), "prctl" }, diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h index d234eb67..2b74868b 100644 --- a/linux/sh/syscallent.h +++ b/linux/sh/syscallent.h @@ -177,7 +177,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { 5, 0, SEN(vm86), "vm86" }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time32), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/sh64/syscallent.h b/linux/sh64/syscallent.h index 38236e30..82340a34 100644 --- a/linux/sh64/syscallent.h +++ b/linux/sh64/syscallent.h @@ -175,7 +175,7 @@ [165] = { 3, 0, SEN(getresuid16), "getresuid" }, [166] = { }, [167] = { 5, 0, SEN(query_module), "query_module" }, -[168] = { 3, TD, SEN(poll), "poll" }, +[168] = { 3, TD, SEN(poll_time64), "poll" }, [169] = { 3, 0, SEN(nfsservctl), "nfsservctl" }, [170] = { 3, 0, SEN(setresgid16), "setresgid" }, [171] = { 3, 0, SEN(getresgid16), "getresgid" }, diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h index 1d476d98..0366c34c 100644 --- a/linux/sparc/syscallent.h +++ b/linux/sparc/syscallent.h @@ -158,7 +158,7 @@ [150] = { 3, TN, SEN(getsockname), "getsockname" }, [151] = { 0, TD, SEN(inotify_init), "inotify_init" }, [152] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" }, -[153] = { 3, TD, SEN(poll), "poll" }, +[153] = { 3, TD, SEN(poll_time32), "poll" }, [154] = { 3, TD, SEN(getdents64), "getdents64" }, [155] = { 3, TD, SEN(fcntl64), "fcntl64" }, [156] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" }, diff --git a/linux/sparc64/syscallent.h b/linux/sparc64/syscallent.h index fc01b539..289b30f4 100644 --- a/linux/sparc64/syscallent.h +++ b/linux/sparc64/syscallent.h @@ -156,7 +156,7 @@ [150] = { 3, TN, SEN(getsockname), "getsockname" }, [151] = { 0, TD, SEN(inotify_init), "inotify_init" }, [152] = { 3, TD|TF, SEN(inotify_add_watch), "inotify_add_watch" }, -[153] = { 3, TD, SEN(poll), "poll" }, +[153] = { 3, TD, SEN(poll_time64), "poll" }, [154] = { 3, TD, SEN(getdents64), "getdents64" }, [155] = { }, [156] = { 2, TD, SEN(inotify_rm_watch), "inotify_rm_watch" }, diff --git a/linux/x32/syscallent.h b/linux/x32/syscallent.h index be7a0eda..a2b2b23c 100644 --- a/linux/x32/syscallent.h +++ b/linux/x32/syscallent.h @@ -12,7 +12,7 @@ [ 4] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, [ 5] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 6] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" }, -[ 7] = { 3, TD, SEN(poll), "poll" }, +[ 7] = { 3, TD, SEN(poll_time64), "poll" }, [ 8] = { 3, TD, SEN(lseek), "lseek" }, [ 9] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [ 10] = { 3, TM|SI, SEN(mprotect), "mprotect" }, diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h index 2e2d6108..4b880af5 100644 --- a/linux/x86_64/syscallent.h +++ b/linux/x86_64/syscallent.h @@ -12,7 +12,7 @@ [ 4] = { 2, TF|TST|TSTA, SEN(stat), "stat" }, [ 5] = { 2, TD|TFST|TSTA, SEN(fstat), "fstat" }, [ 6] = { 2, TF|TLST|TSTA, SEN(lstat), "lstat" }, -[ 7] = { 3, TD, SEN(poll), "poll" }, +[ 7] = { 3, TD, SEN(poll_time64), "poll" }, [ 8] = { 3, TD, SEN(lseek), "lseek" }, [ 9] = { 6, TD|TM|SI, SEN(mmap), "mmap" }, [ 10] = { 3, TM|SI, SEN(mprotect), "mprotect" }, diff --git a/linux/xtensa/syscallent.h b/linux/xtensa/syscallent.h index 6b13cd6b..2cfcefde 100644 --- a/linux/xtensa/syscallent.h +++ b/linux/xtensa/syscallent.h @@ -16,7 +16,7 @@ [ 13] = { 3, TD, SEN(write), "write" }, [ 14] = { 5, TD, SEN(select), "select" }, [ 15] = { 3, TD, SEN(lseek), "lseek" }, -[ 16] = { 3, TD, SEN(poll), "poll" }, +[ 16] = { 3, TD, SEN(poll_time32), "poll" }, [ 17] = { 5, TD, SEN(llseek), "_llseek" }, [ 18] = { 4, TD, SEN(epoll_wait), "epoll_wait" }, [ 19] = { 4, TD, SEN(epoll_ctl), "epoll_ctl" }, diff --git a/pathtrace.c b/pathtrace.c index 9810814d..15d6f328 100644 --- a/pathtrace.c +++ b/pathtrace.c @@ -287,7 +287,8 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set) case SEN_pselect6_time64: case SEN_select: return match_xselect_args(tcp, tcp->u_arg, set); - case SEN_poll: + case SEN_poll_time32: + case SEN_poll_time64: case SEN_ppoll_time32: case SEN_ppoll_time64: { diff --git a/poll.c b/poll.c index aa9dcc42..4cffaa7d 100644 --- a/poll.c +++ b/poll.c @@ -133,7 +133,9 @@ decode_poll_exiting(struct tcb *const tcp, const sprint_obj_by_addr_fn sprint_ts #undef end_outstr } -SYS_FUNC(poll) +#if HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_OLD_TIME64_SYSCALLS +static int +do_poll(struct tcb *const tcp, const sprint_obj_by_addr_fn sprint_ts) { if (entering(tcp)) { decode_poll_entering(tcp); @@ -141,9 +143,24 @@ SYS_FUNC(poll) return 0; } else { - return decode_poll_exiting(tcp, sprint_timespec, 0); + return decode_poll_exiting(tcp, sprint_ts, 0); } } +#endif /* HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_OLD_TIME64_SYSCALLS */ + +#if HAVE_ARCH_TIME32_SYSCALLS +SYS_FUNC(poll_time32) +{ + return do_poll(tcp, sprint_timespec32); +} +#endif + +#if HAVE_ARCH_OLD_TIME64_SYSCALLS +SYS_FUNC(poll_time64) +{ + return do_poll(tcp, sprint_timespec64); +} +#endif static int do_ppoll(struct tcb *const tcp, const print_obj_by_addr_fn print_ts, -- 2.40.0