From nobody@FreeBSD.org  Thu Jul 14 00:48:38 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1526E106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jul 2011 00:48:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id C11448FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jul 2011 00:48:37 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6E0mbHo081960
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jul 2011 00:48:37 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p6E0mbiT081959;
	Thu, 14 Jul 2011 00:48:37 GMT
	(envelope-from nobody)
Message-Id: <201107140048.p6E0mbiT081959@red.freebsd.org>
Date: Thu, 14 Jul 2011 00:48:37 GMT
From: Guy Harris <guy@alum.mit.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bpf_filter() can leak kernel stack contents
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         158880
>Category:       kern
>Synopsis:       [bpf] bpf_filter() can leak kernel stack contents
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 14 00:50:08 UTC 2011
>Closed-Date:    Fri Feb 14 17:19:08 CET 2014
>Last-Modified:  Fri Feb 14 17:19:08 CET 2014
>Originator:     Guy Harris
>Release:        Any
>Organization:
>Environment:
N/A (problem found by looking at OpenBSD's source repository)
>Description:
    http://seclists.org/fulldisclosure/2010/Nov/89

That's Linux's BPF interpreter, but the same problem exists with the *BSD BPF interpreter:

    http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/bpf_filter.c.diff?r1=1.21;r2=1.22

    http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/bpf_filter.c?rev=1.22;content-type=text%2Fx-cvsweb-markup

>How-To-Repeat:
A little more work, as BSD's BPF interpreter isn't supported on arbitrary
sockets, just on BPF devices, but you could probably try to cook something
interesting up.
>Fix:
Add a bzero() or memset(..., 0, ...) to zero out the men array early in
bpf_filter().

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jul 14 01:54:35 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158880 
Responsible-Changed-From-To: freebsd-net->mp@FreeBSD.org 
Responsible-Changed-By: mp 
Responsible-Changed-When: Thu Jul 14 16:36:38 UTC 2011 
Responsible-Changed-Why:  
I'll take this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158880 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/158880: commit references a PR
Date: Thu, 14 Jul 2011 21:06:34 +0000 (UTC)

 Author: mp
 Date: Thu Jul 14 21:06:22 2011
 New Revision: 224044
 URL: http://svn.freebsd.org/changeset/base/224044
 
 Log:
   Clear the filter memory area before using it. Leaving it uninitialized may
   leak previous kernel stack contents through a malicioius BPF filter.
   
   PR:		kern/158880
   Submitted by:	Guy Harris
   Obtained from:	OpenBSD
   MFC after:	1 week
 
 Modified:
   head/sys/net/bpf_filter.c
 
 Modified: head/sys/net/bpf_filter.c
 ==============================================================================
 --- head/sys/net/bpf_filter.c	Thu Jul 14 21:02:15 2011	(r224043)
 +++ head/sys/net/bpf_filter.c	Thu Jul 14 21:06:22 2011	(r224044)
 @@ -177,6 +177,8 @@ bpf_filter(const struct bpf_insn *pc, u_
  	bpf_u_int32 k;
  	u_int32_t mem[BPF_MEMWORDS];
  
 +	bzero(mem, sizeof(mem));
 +
  	if (pc == NULL)
  		/*
  		 * No filter means accept all.
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: mp 
State-Changed-When: Thu Jul 14 21:22:29 UTC 2011 
State-Changed-Why:  
Patch committed to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158880 
Responsible-Changed-From-To: mp@FreeBSD.org->mp 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Thu Jul 14 22:41:22 UTC 2011 
Responsible-Changed-Why:  
Fix responsible 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158880 
State-Changed-From-To: patched->closed 
State-Changed-By: brueffer 
State-Changed-When: Fri Feb 14 17:18:34 CET 2014 
State-Changed-Why:  
This was committed and merged to stable => finally close it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158880 
>Unformatted:
