Blame SOURCES/rhbz1643997.0029-PR23860-bpf_interpret-NEG-should-not-fall-through-to.patch

132810
From 6adc7dbeccecff18357751b9eecfa232ee8a8172 Mon Sep 17 00:00:00 2001
132810
From: Serhei Makarov <smakarov@redhat.com>
132810
Date: Tue, 13 Nov 2018 11:42:46 -0500
132810
Subject: [PATCH 29/32] PR23860 bpf_interpret() :: NEG should not fall through
132810
 to DIV
132810
132810
---
132810
 stapbpf/bpfinterp.cxx | 26 ++++++++++++++++++--------
132810
 1 file changed, 18 insertions(+), 8 deletions(-)
132810
132810
diff --git a/stapbpf/bpfinterp.cxx b/stapbpf/bpfinterp.cxx
132810
index 13ac8ee71..2a90c24c9 100644
132810
--- a/stapbpf/bpfinterp.cxx
132810
+++ b/stapbpf/bpfinterp.cxx
132810
@@ -254,18 +254,23 @@ bpf_interpret(size_t ninsns, const struct bpf_insn insns[],
132810
 	case BPF_ALU64 | BPF_MOV | BPF_K:  dr = s1; break;
132810
 	case BPF_ALU64 | BPF_ARSH | BPF_X:
132810
 	case BPF_ALU64 | BPF_ARSH | BPF_K: dr = (int64_t)dr >> s1; break;
132810
-	case BPF_ALU64 | BPF_NEG:	   dr = -sr;
132810
-					   /* Fallthrough */
132810
+	case BPF_ALU64 | BPF_NEG:	   dr = -sr; break;
132810
 	case BPF_ALU64 | BPF_DIV | BPF_X:
132810
 	case BPF_ALU64 | BPF_DIV | BPF_K:
132810
 	  if (s1 == 0)
132810
-	    return 0;
132810
+            {
132810
+              // TODO: Signal a proper error.
132810
+              return 0;
132810
+            }
132810
 	  dr /= s1;
132810
 	  break;
132810
 	case BPF_ALU64 | BPF_MOD | BPF_X:
132810
 	case BPF_ALU64 | BPF_MOD | BPF_K:
132810
 	  if (s1 == 0)
132810
-	    return 0;
132810
+            {
132810
+              // TODO: Signal a proper error.
132810
+              return 0;
132810
+            }
132810
 	  dr %= s1;
132810
 	  break;
132810
 
132810
@@ -289,18 +294,23 @@ bpf_interpret(size_t ninsns, const struct bpf_insn insns[],
132810
 	case BPF_ALU | BPF_MOV | BPF_K:  dr = (uint32_t)s1; break;
132810
 	case BPF_ALU | BPF_ARSH | BPF_X:
132810
 	case BPF_ALU | BPF_ARSH | BPF_K: dr = (int32_t)dr >> s1; break;
132810
-	case BPF_ALU | BPF_NEG:		 dr = -(uint32_t)sr;
132810
-					 /* Fallthrough */
132810
+	case BPF_ALU | BPF_NEG:		 dr = -(uint32_t)sr; break;
132810
 	case BPF_ALU | BPF_DIV | BPF_X:
132810
 	case BPF_ALU | BPF_DIV | BPF_K:
132810
 	  if ((uint32_t)s1 == 0)
132810
-	    return 0;
132810
+            {
132810
+              // TODO: Signal a proper error.
132810
+              return 0;
132810
+            }
132810
 	  dr = (uint32_t)dr / (uint32_t)s1;
132810
 	  break;
132810
 	case BPF_ALU | BPF_MOD | BPF_X:
132810
 	case BPF_ALU | BPF_MOD | BPF_K:
132810
 	  if ((uint32_t)s1 == 0)
132810
-	    return 0;
132810
+            {
132810
+              // TODO: Signal a proper error.
132810
+              return 0;
132810
+            }
132810
 	  dr = (uint32_t)dr % (uint32_t)s1;
132810
 	  break;
132810
 
132810
-- 
132810
2.14.5
132810