From patchwork Fri Nov 12 01:07:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rosenberg X-Patchwork-Id: 70905 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 80D05B7139 for ; Fri, 12 Nov 2010 12:09:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757206Ab0KLBJ2 (ORCPT ); Thu, 11 Nov 2010 20:09:28 -0500 Received: from mx1.vsecurity.com ([209.67.252.12]:60818 "EHLO mx1.vsecurity.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755236Ab0KLBJ1 (ORCPT ); Thu, 11 Nov 2010 20:09:27 -0500 Received: (qmail 34916 invoked from network); 12 Nov 2010 01:07:58 -0000 Received: from unknown (HELO [10.0.2.186]) (drosenbe@[207.228.237.151]) (envelope-sender ) by mx1.vsecurity.com (qmail-ldap-1.03) with SMTP for ; 12 Nov 2010 01:07:58 -0000 Subject: [PATCH 7/10] Fix leaking of kernel heap addresses in net/ From: Dan Rosenberg To: "David S. Miller" , Oliver Hartkopp , Alexey Kuznetsov , Urs Thuermann , Hideaki YOSHIFUJI , Patrick McHardy , James Morris , Remi Denis-Courmont , "Pekka Savola (ipv6)" , Sridhar Samudrala , Vlad Yasevich , Tejun Heo , Eric Dumazet , Li Zefan , Joe Perches , Stephen Hemminger , Jamal Hadi Salim , "Eric W. Biederman" , Alexey Dobriyan , Jiri Pirko , Johannes Berg , Daniel Lezcano , Pavel Emelyanov , socketcan-core@lists.berlios.de, netdev@vger.kernel.org, linux-sctp@vger.kernel.org Date: Thu, 11 Nov 2010 20:07:16 -0500 Message-ID: <1289524036.5167.71.camel@dan> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 3616f27..3dbf2b5 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2635,17 +2635,31 @@ static int packet_seq_show(struct seq_file *seq, void *v) struct sock *s = sk_entry(v); const struct packet_sock *po = pkt_sk(s); - seq_printf(seq, - "%p %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n", - s, - atomic_read(&s->sk_refcnt), - s->sk_type, - ntohs(po->num), - po->ifindex, - po->running, - atomic_read(&s->sk_rmem_alloc), - sock_i_uid(s), - sock_i_ino(s)); + /* Only expose kernel addresses to privileged readers */ + if (capable(CAP_NET_ADMIN)) + seq_printf(seq, + "%p %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n", + s, + atomic_read(&s->sk_refcnt), + s->sk_type, + ntohs(po->num), + po->ifindex, + po->running, + atomic_read(&s->sk_rmem_alloc), + sock_i_uid(s), + sock_i_ino(s)); + else + seq_printf(seq, + "%d %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n", + 0, + atomic_read(&s->sk_refcnt), + s->sk_type, + ntohs(po->num), + po->ifindex, + po->running, + atomic_read(&s->sk_rmem_alloc), + sock_i_uid(s), + sock_i_ino(s)); } return 0;