From patchwork Fri Nov 12 01:07:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rosenberg X-Patchwork-Id: 70902 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 A60CDB7124 for ; Fri, 12 Nov 2010 12:08:39 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755688Ab0KLBIf (ORCPT ); Thu, 11 Nov 2010 20:08:35 -0500 Received: from mx1.vsecurity.com ([209.67.252.12]:60753 "EHLO mx1.vsecurity.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755068Ab0KLBIf (ORCPT ); Thu, 11 Nov 2010 20:08:35 -0500 Received: (qmail 34847 invoked from network); 12 Nov 2010 01:07:54 -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:54 -0000 Subject: [PATCH 5/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:09 -0500 Message-ID: <1289524029.5167.69.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/key/af_key.c b/net/key/af_key.c index d87c22d..977481a 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -3643,14 +3643,25 @@ static int pfkey_seq_show(struct seq_file *f, void *v) if (v == SEQ_START_TOKEN) seq_printf(f ,"sk RefCnt Rmem Wmem User Inode\n"); else - seq_printf(f ,"%p %-6d %-6u %-6u %-6u %-6lu\n", - s, - atomic_read(&s->sk_refcnt), - sk_rmem_alloc_get(s), - sk_wmem_alloc_get(s), - sock_i_uid(s), - sock_i_ino(s) - ); + /* Only expose kernel addresses to privileged readers */ + if (capable(CAP_NET_ADMIN)) + seq_printf(f, "%p %-6d %-6u %-6u %-6u %-6lu\n", + s, + atomic_read(&s->sk_refcnt), + sk_rmem_alloc_get(s), + sk_wmem_alloc_get(s), + sock_i_uid(s), + sock_i_ino(s) + ); + else + seq_printf(f, "%d %-6d %-6u %-6u %-6u %-6lu\n", + 0, + atomic_read(&s->sk_refcnt), + sk_rmem_alloc_get(s), + sk_wmem_alloc_get(s), + sock_i_uid(s), + sock_i_ino(s) + ); return 0; }