|
|
35b686 |
From 522ad3a0e73148dadd2480cd9cec84d9112b2e57 Mon Sep 17 00:00:00 2001
|
|
|
35b686 |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
35b686 |
Date: Tue, 4 Sep 2018 14:48:13 +0200
|
|
|
35b686 |
Subject: [PATCH] syscall.c: avoid infinite loop in subcalls parsing
|
|
|
35b686 |
|
|
|
35b686 |
clang complains about it, so it might be a good reason to refactor it
|
|
|
35b686 |
into something more linear.
|
|
|
35b686 |
|
|
|
35b686 |
* syscall.c (syscall_entering_decode): Put syscall subcall decoding
|
|
|
35b686 |
before ipc/socket subcall decoding, remove the loop.
|
|
|
35b686 |
---
|
|
|
35b686 |
syscall.c | 19 ++++++-------------
|
|
|
35b686 |
1 file changed, 6 insertions(+), 13 deletions(-)
|
|
|
35b686 |
|
|
|
35b686 |
diff --git a/syscall.c b/syscall.c
|
|
|
35b686 |
index bae7343..a67d744 100644
|
|
|
35b686 |
--- a/syscall.c
|
|
|
35b686 |
+++ b/syscall.c
|
|
|
35b686 |
@@ -579,11 +579,13 @@ syscall_entering_decode(struct tcb *tcp)
|
|
|
35b686 |
return res;
|
|
|
35b686 |
}
|
|
|
35b686 |
|
|
|
35b686 |
+# ifdef SYS_syscall_subcall
|
|
|
35b686 |
+ if (tcp_sysent(tcp)->sen == SEN_syscall)
|
|
|
35b686 |
+ decode_syscall_subcall(tcp);
|
|
|
35b686 |
+# endif
|
|
|
35b686 |
#if defined SYS_ipc_subcall \
|
|
|
35b686 |
- || defined SYS_socket_subcall \
|
|
|
35b686 |
- || defined SYS_syscall_subcall
|
|
|
35b686 |
- for (;;) {
|
|
|
35b686 |
- switch (tcp_sysent(tcp)->sen) {
|
|
|
35b686 |
+ || defined SYS_socket_subcall
|
|
|
35b686 |
+ switch (tcp_sysent(tcp)->sen) {
|
|
|
35b686 |
# ifdef SYS_ipc_subcall
|
|
|
35b686 |
case SEN_ipc:
|
|
|
35b686 |
decode_ipc_subcall(tcp);
|
|
|
35b686 |
@@ -594,15 +596,6 @@ syscall_entering_decode(struct tcb *tcp)
|
|
|
35b686 |
decode_socket_subcall(tcp);
|
|
|
35b686 |
break;
|
|
|
35b686 |
# endif
|
|
|
35b686 |
-# ifdef SYS_syscall_subcall
|
|
|
35b686 |
- case SEN_syscall:
|
|
|
35b686 |
- decode_syscall_subcall(tcp);
|
|
|
35b686 |
- if (tcp_sysent(tcp)->sen != SEN_syscall)
|
|
|
35b686 |
- continue;
|
|
|
35b686 |
- break;
|
|
|
35b686 |
-# endif
|
|
|
35b686 |
- }
|
|
|
35b686 |
- break;
|
|
|
35b686 |
}
|
|
|
35b686 |
#endif
|
|
|
35b686 |
|
|
|
35b686 |
--
|
|
|
35b686 |
2.1.4
|
|
|
35b686 |
|