lkml.org 
[lkml]   [2002]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH]: mmap packet socket information leak (trivial)
From
   From: Gianni Tedesco <gianni@ecsc.co.uk>
Date: 29 May 2002 12:58:55 +0100

Here is a quick patch which blanks the mmap() packet socket buffer areas
before using them. Previously you would get uninitialised data inbetween
the data structures where they are TPACKET_ALIGNED().

...

diff -urN linux.orig/net/packet/af_packet.c linux/net/packet/af_packet.c
--- linux.orig/net/packet/af_packet.c Wed May 29 12:30:10 2002
+++ linux/net/packet/af_packet.c Wed May 29 12:29:10 2002

The following seems simpler and is what I checked into my
tree.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.539 -> 1.540
# net/packet/af_packet.c 1.9 -> 1.10
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/07 davem@nuts.ninka.net 1.540
# AF_PACKET: Clear out packet-mmap pages.
# --------------------------------------------
#
diff -Nru a/net/packet/af_packet.c b/net/packet/af_packet.c
--- a/net/packet/af_packet.c Fri Jun 7 02:53:22 2002
+++ b/net/packet/af_packet.c Fri Jun 7 02:53:22 2002
@@ -1662,7 +1662,7 @@
pg_vec[i] = __get_free_pages(GFP_KERNEL, order);
if (!pg_vec[i])
goto out_free_pgvec;
-
+ memset((void *)(pg_vec[i]), 0, PAGE_SIZE << order);
pend = virt_to_page(pg_vec[i] + (PAGE_SIZE << order) - 1);
for (page = virt_to_page(pg_vec[i]); page <= pend; page++)
SetPageReserved(page);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:22    [W:0.061 / U:1.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site