Blame SOURCES/0036-syscall.c-avoid-infinite-loop-in-subcalls-parsing.patch

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