Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Properly track initialisation of registers for BPF_J...



details:   https://anonhg.NetBSD.org/src/rev/bb3f3fe477ea
branches:  trunk
changeset: 336160:bb3f3fe477ea
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Sat Feb 14 21:14:56 2015 +0000

description:
Properly track initialisation of registers for BPF_JMP instructions.

diffstat:

 sys/net/bpfjit.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 61a533533cc4 -r bb3f3fe477ea sys/net/bpfjit.c
--- a/sys/net/bpfjit.c  Sat Feb 14 20:39:09 2015 +0000
+++ b/sys/net/bpfjit.c  Sat Feb 14 21:14:56 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpfjit.c,v 1.40 2015/02/13 15:59:17 alnsn Exp $        */
+/*     $NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $        */
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include <sys/cdefs.h>
 #ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.40 2015/02/13 15:59:17 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $");
 #else
-__RCSID("$NetBSD: bpfjit.c,v 1.40 2015/02/13 15:59:17 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $");
 #endif
 
 #include <sys/types.h>
@@ -1419,8 +1419,12 @@
                        /* Initialize abc_length for ABC pass. */
                        insn_dat[i].u.jdata.abc_length = MAX_ABC_LENGTH;
 
-                       if (BPF_SRC(insns[i].code) == BPF_X)
+                       *initmask |= invalid & BJ_INIT_ABIT;
+
+                       if (BPF_SRC(insns[i].code) == BPF_X) {
                                *hints |= BJ_HINT_XREG;
+                               *initmask |= invalid & BJ_INIT_XBIT;
+                       }
 
                        if (BPF_OP(insns[i].code) == BPF_JA) {
                                jt = jf = insns[i].k;



Home | Main Index | Thread Index | Old Index