lkml.org 
[lkml]   [2014]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] bpf: fix a false positive kmemcheck warning
This patch fixes false positive kmemcheck warning in bpf.

When we try to write the variable len, the compiler generates a code that
reads the 32-bit word, modifies the bits belonging to "len" and writes the
32-bit word back. The reading of the word results in kmemcheck warning due
to reading uninitialized memory. This patch fixes it by avoiding using bit
fields when kmemcheck is enabled.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
include/linux/filter.h | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6/include/linux/filter.h
===================================================================
--- linux-2.6.orig/include/linux/filter.h 2014-09-04 23:04:26.000000000 +0200
+++ linux-2.6/include/linux/filter.h 2014-09-04 23:43:05.000000000 +0200
@@ -325,8 +325,13 @@ struct sock;
struct seccomp_data;

struct bpf_prog {
+#ifdef CONFIG_KMEMCHECK
+ bool jited;
+ u32 len;
+#else
u32 jited:1, /* Is our filter JIT'ed? */
len:31; /* Number of filter blocks */
+#endif
struct sock_fprog_kern *orig_prog; /* Original BPF program */
unsigned int (*bpf_func)(const struct sk_buff *skb,
const struct bpf_insn *filter);

\
 
 \ /
  Last update: 2014-09-05 18:41    [W:0.049 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site