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