From 297f14e99e82001e656ee5ed47f99dac8918fa95 Mon Sep 17 00:00:00 2001 From: Jafeer Uddin Date: Fri, 7 Sep 2018 12:00:15 -0400 Subject: [PATCH] PR23160,PR14690: fix syscalls that broke after adding CONTEXT->sregs in tapset/errno.stp --- tapset/linux/sysc_accept.stp | 1 + tapset/linux/sysc_accept4.stp | 1 + tapset/linux/sysc_bind.stp | 1 + tapset/linux/sysc_connect.stp | 1 + tapset/linux/sysc_epoll_create.stp | 4 ++-- tapset/linux/sysc_getpeername.stp | 1 + tapset/linux/sysc_getsockname.stp | 1 + tapset/linux/sysc_getsockopt.stp | 1 + tapset/linux/sysc_listen.stp | 1 + tapset/linux/sysc_msgctl.stp | 1 + tapset/linux/sysc_msgget.stp | 1 + tapset/linux/sysc_msgrcv.stp | 1 + tapset/linux/sysc_msgsnd.stp | 1 + tapset/linux/sysc_pipe.stp | 4 ++-- tapset/linux/sysc_recv.stp | 1 + tapset/linux/sysc_recvfrom.stp | 1 + tapset/linux/sysc_recvmsg.stp | 2 ++ tapset/linux/sysc_send.stp | 1 + tapset/linux/sysc_sendmmsg.stp | 1 + tapset/linux/sysc_sendmsg.stp | 2 ++ tapset/linux/sysc_sendto.stp | 1 + tapset/linux/sysc_setsockopt.stp | 1 + tapset/linux/sysc_shutdown.stp | 1 + tapset/linux/sysc_socket.stp | 1 + tapset/linux/sysc_socketpair.stp | 1 + tapset/linux/sysc_wait4.stp | 3 +-- 26 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tapset/linux/sysc_accept.stp b/tapset/linux/sysc_accept.stp index 59a8020d1..367787a50 100644 --- a/tapset/linux/sysc_accept.stp +++ b/tapset/linux/sysc_accept.stp @@ -238,6 +238,7 @@ probe __nd2_syscall.socketcall.accept.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_ACCEPT")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_accept4.stp b/tapset/linux/sysc_accept4.stp index 12b2bc769..822a8d53a 100644 --- a/tapset/linux/sysc_accept4.stp +++ b/tapset/linux/sysc_accept4.stp @@ -221,6 +221,7 @@ probe __nd2_syscall.socketcall.accept4.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_ACCEPT4")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_bind.stp b/tapset/linux/sysc_bind.stp index 1c9407c64..e123431b4 100644 --- a/tapset/linux/sysc_bind.stp +++ b/tapset/linux/sysc_bind.stp @@ -207,6 +207,7 @@ probe __nd2_syscall.socketcall.bind.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_BIND")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_connect.stp b/tapset/linux/sysc_connect.stp index b5efea347..261b87704 100644 --- a/tapset/linux/sysc_connect.stp +++ b/tapset/linux/sysc_connect.stp @@ -209,6 +209,7 @@ probe __nd2_syscall.socketcall.connect.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_CONNECT")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_epoll_create.stp b/tapset/linux/sysc_epoll_create.stp index eed2b335e..590d5b6b4 100644 --- a/tapset/linux/sysc_epoll_create.stp +++ b/tapset/linux/sysc_epoll_create.stp @@ -142,10 +142,10 @@ probe nd2_syscall.epoll_create.return = __nd2_syscall.epoll_create1.return !, } probe __nd2_syscall.epoll_create1.return = kprobe.function(@arch_syscall_prefix "sys_epoll_create1").return { - __set_syscall_pt_regs(pointer_arg(1)) + retstr = returnstr(1) + __set_syscall_pt_regs(@entry(pointer_arg(1))) flags = int_arg(1) name = (flags == 0) ? "epoll_create" : "epoll_create1"; - retstr = returnstr(1) } probe __nd2_syscall.epoll_create.return = kprobe.function(@arch_syscall_prefix "sys_epoll_create").return { diff --git a/tapset/linux/sysc_getpeername.stp b/tapset/linux/sysc_getpeername.stp index eb1e10ff6..6796076d3 100644 --- a/tapset/linux/sysc_getpeername.stp +++ b/tapset/linux/sysc_getpeername.stp @@ -210,6 +210,7 @@ probe __nd2_syscall.socketcall.getpeername.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_GETPEERNAME")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_getsockname.stp b/tapset/linux/sysc_getsockname.stp index 5ec286f1c..7e850d71c 100644 --- a/tapset/linux/sysc_getsockname.stp +++ b/tapset/linux/sysc_getsockname.stp @@ -211,6 +211,7 @@ probe __nd2_syscall.socketcall.getsockname.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_GETSOCKNAME")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_getsockopt.stp b/tapset/linux/sysc_getsockopt.stp index 431640cb8..767f586c9 100644 --- a/tapset/linux/sysc_getsockopt.stp +++ b/tapset/linux/sysc_getsockopt.stp @@ -233,6 +233,7 @@ probe __nd2_syscall.socketcall.getsockopt.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_GETSOCKOPT")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_listen.stp b/tapset/linux/sysc_listen.stp index c23ad11e5..8ed2fece5 100644 --- a/tapset/linux/sysc_listen.stp +++ b/tapset/linux/sysc_listen.stp @@ -198,6 +198,7 @@ probe __nd2_syscall.socketcall.listen.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_LISTEN")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_msgctl.stp b/tapset/linux/sysc_msgctl.stp index b47b76553..099421aa1 100644 --- a/tapset/linux/sysc_msgctl.stp +++ b/tapset/linux/sysc_msgctl.stp @@ -243,6 +243,7 @@ probe nd2_syscall.compat_sys_msgctl.return = __set_syscall_pt_regs(@entry(pointer_arg(1))) if ((uint_arg(1) & 0xffff) != @const("MSGCTL")) next; @_SYSCALL_MSGCTL_NAME + __set_syscall_pt_regs(0) retstr = returnstr(1) /* NB: not in the $regs */ } diff --git a/tapset/linux/sysc_msgget.stp b/tapset/linux/sysc_msgget.stp index 26e06454f..a3b01bd62 100644 --- a/tapset/linux/sysc_msgget.stp +++ b/tapset/linux/sysc_msgget.stp @@ -123,6 +123,7 @@ probe __nd2_syscall.compat_ipc.msgget.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if ((uint_arg(1) & 0xffff) != @const("MSGGET")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_msgrcv.stp b/tapset/linux/sysc_msgrcv.stp index 55dc1c6d4..d0c399cbb 100644 --- a/tapset/linux/sysc_msgrcv.stp +++ b/tapset/linux/sysc_msgrcv.stp @@ -306,6 +306,7 @@ probe nd2_syscall.compat_sys_msgrcv.return = __set_syscall_pt_regs(@entry(pointer_arg(1))) if ((uint_arg(1) & 0xffff) != @const("MSGRCV")) next; @_SYSCALL_MSGRCV_NAME + __set_syscall_pt_regs(0) retstr = returnstr(1) /* NB: not in the $regs */ } diff --git a/tapset/linux/sysc_msgsnd.stp b/tapset/linux/sysc_msgsnd.stp index e7b10bd9a..06562d100 100644 --- a/tapset/linux/sysc_msgsnd.stp +++ b/tapset/linux/sysc_msgsnd.stp @@ -261,6 +261,7 @@ probe nd2_syscall.compat_sys_msgsnd.return = __set_syscall_pt_regs(@entry(pointer_arg(1))) if ((uint_arg(1) & 0xffff) != @const("MSGSND")) next; @_SYSCALL_MSGSND_NAME + __set_syscall_pt_regs(0) retstr = returnstr(1) /* NB: not in the $regs */ } diff --git a/tapset/linux/sysc_pipe.stp b/tapset/linux/sysc_pipe.stp index edfc13947..71f6c5263 100644 --- a/tapset/linux/sysc_pipe.stp +++ b/tapset/linux/sysc_pipe.stp @@ -319,6 +319,7 @@ probe nd2_syscall.pipe.return = __nd2_syscall.pipe2.return ?, probe __nd2_syscall.pipe2.return = kprobe.function(@arch_syscall_prefix "sys_pipe2").return ? { name = "pipe2"; + retstr = returnstr(1) __set_syscall_pt_regs(@entry(pointer_arg(1))) fildes_uaddr = pointer_arg(1) if (fildes_uaddr == 0) { @@ -328,11 +329,11 @@ probe __nd2_syscall.pipe2.return = kprobe.function(@arch_syscall_prefix "sys_pip pipe0 = _fildes_index_u(fildes_uaddr, 0) pipe1 = _fildes_index_u(fildes_uaddr, 1) } - retstr = returnstr(1) } probe __nd2_syscall.pipe.return = kprobe.function(@arch_syscall_prefix "sys_pipe").return { name = "pipe" + retstr = returnstr(1) __set_syscall_pt_regs(@entry(pointer_arg(1))) fildes_uaddr = int_arg(1) if (fildes_uaddr == 0) { @@ -342,7 +343,6 @@ probe __nd2_syscall.pipe.return = kprobe.function(@arch_syscall_prefix "sys_pipe pipe0 = _fildes_index_u(fildes_uaddr, 0) pipe1 = _fildes_index_u(fildes_uaddr, 1) } - retstr = returnstr(1) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_recv.stp b/tapset/linux/sysc_recv.stp index ca4f1d75d..39a79ca13 100644 --- a/tapset/linux/sysc_recv.stp +++ b/tapset/linux/sysc_recv.stp @@ -220,6 +220,7 @@ probe __nd2_syscall.socketcall.recv.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_RECV")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_recvfrom.stp b/tapset/linux/sysc_recvfrom.stp index 10d8757a6..00688af04 100644 --- a/tapset/linux/sysc_recvfrom.stp +++ b/tapset/linux/sysc_recvfrom.stp @@ -238,6 +238,7 @@ probe __nd2_syscall.socketcall.recvfrom.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_RECVFROM")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_recvmsg.stp b/tapset/linux/sysc_recvmsg.stp index 28dacdd85..3ca24317a 100644 --- a/tapset/linux/sysc_recvmsg.stp +++ b/tapset/linux/sysc_recvmsg.stp @@ -209,6 +209,7 @@ probe __nd2_syscall.socketcall.recvmsg.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_RECVMSG")) next; + __set_syscall_pt_regs(0) } probe tp_syscall.recvmsg.return = __tp_syscall.recvmsg.return ?, @@ -326,6 +327,7 @@ probe nd2_syscall.compat_sys_recvmsg.return = __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_RECVMSG")) next; @_SYSCALL_RECVMSG_NAME + __set_syscall_pt_regs(0) retstr = returnstr(1) /* NB: not in the $regs */ } diff --git a/tapset/linux/sysc_send.stp b/tapset/linux/sysc_send.stp index 97aaab4b2..1fcbd17a7 100644 --- a/tapset/linux/sysc_send.stp +++ b/tapset/linux/sysc_send.stp @@ -222,6 +222,7 @@ probe __nd2_syscall.socketcall.send.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SEND")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_sendmmsg.stp b/tapset/linux/sysc_sendmmsg.stp index 8ec1d9eee..cbdca18ab 100644 --- a/tapset/linux/sysc_sendmmsg.stp +++ b/tapset/linux/sysc_sendmmsg.stp @@ -249,6 +249,7 @@ probe __nd2_syscall.compat_socketcall.sendmmsg.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SENDMMSG")) next; + __set_syscall_pt_regs(0) } probe __nd2_syscall.compat_sendmmsg.return = kprobe.function(@arch_syscall_prefix "compat_sys_sendmmsg").return ? diff --git a/tapset/linux/sysc_sendmsg.stp b/tapset/linux/sysc_sendmsg.stp index c610055d6..282556dd6 100644 --- a/tapset/linux/sysc_sendmsg.stp +++ b/tapset/linux/sysc_sendmsg.stp @@ -225,6 +225,7 @@ probe __nd2_syscall.socketcall.sendmsg.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SENDMSG")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ @@ -347,6 +348,7 @@ probe nd2_syscall.compat_sys_sendmsg.return = __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SENDMSG")) next; @_SYSCALL_SENDMSG_NAME + __set_syscall_pt_regs(0) retstr = returnstr(1) /* NB: not in the $regs */ } diff --git a/tapset/linux/sysc_sendto.stp b/tapset/linux/sysc_sendto.stp index 166414310..0c3dc119a 100644 --- a/tapset/linux/sysc_sendto.stp +++ b/tapset/linux/sysc_sendto.stp @@ -238,6 +238,7 @@ probe __nd2_syscall.socketcall.sendto.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SENDTO")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_setsockopt.stp b/tapset/linux/sysc_setsockopt.stp index 9a1e06591..0a9db6ba9 100644 --- a/tapset/linux/sysc_setsockopt.stp +++ b/tapset/linux/sysc_setsockopt.stp @@ -235,6 +235,7 @@ probe __nd2_syscall.socketcall.setsockopt.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SETSOCKOPT")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_shutdown.stp b/tapset/linux/sysc_shutdown.stp index 0f320735f..ccb4c65b3 100644 --- a/tapset/linux/sysc_shutdown.stp +++ b/tapset/linux/sysc_shutdown.stp @@ -204,6 +204,7 @@ probe __nd2_syscall.socketcall.shutdown.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SHUTDOWN")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_socket.stp b/tapset/linux/sysc_socket.stp index 8410c420d..58cffef59 100644 --- a/tapset/linux/sysc_socket.stp +++ b/tapset/linux/sysc_socket.stp @@ -215,6 +215,7 @@ probe __nd2_syscall.socketcall.socket.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SOCKET")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_socketpair.stp b/tapset/linux/sysc_socketpair.stp index baf863dc3..3518587f9 100644 --- a/tapset/linux/sysc_socketpair.stp +++ b/tapset/linux/sysc_socketpair.stp @@ -230,6 +230,7 @@ probe __nd2_syscall.socketcall.socketpair.return = { __set_syscall_pt_regs(@entry(pointer_arg(1))) if (int_arg(1) != @const("SYS_SOCKETPAIR")) next; + __set_syscall_pt_regs(0) } /* kernel 3.5+, but undesirable because it affects all syscalls */ diff --git a/tapset/linux/sysc_wait4.stp b/tapset/linux/sysc_wait4.stp index 3b9532fd9..38713eb95 100644 --- a/tapset/linux/sysc_wait4.stp +++ b/tapset/linux/sysc_wait4.stp @@ -151,6 +151,7 @@ probe nd2_syscall.wait4.return = kprobe.function(@arch_syscall_prefix "sys_wait4 kprobe.function(@arch_syscall_prefix "compat_sys_wait4").return ? { @_SYSCALL_WAIT4_NAME + retstr = returnstr(1) __set_syscall_pt_regs(@entry(pointer_arg(1))) status_uaddr = pointer_arg(2) @@ -160,8 +161,6 @@ probe nd2_syscall.wait4.return = kprobe.function(@arch_syscall_prefix "sys_wait4 status_str = "NULL" else status_str = _wait_status_str(user_int(status_uaddr)) - - retstr = returnstr(1) } probe tp_syscall.wait4.return = kernel.trace("sys_exit") -- 2.43.5