Subject: Re: [PATCH 2/10] Fix leaking of kernel heap addresses in net/

From: Stephen Hemminger <[email-masked]>
Date: Thu, 11 Nov 2010 17:17:54 -0800

On Thu, 11 Nov 2010 20:06:59 -0500
Dan Rosenberg <[email-masked]> wrote:

> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index 08ffe9e..5960ad7 100644
> --- a/net/can/bcm.c
> +++ b/net/can/bcm.c
> @@ -165,9 +165,16 @@ static int bcm_proc_show(struct seq_file *m, void *v)
>  	struct bcm_sock *bo = bcm_sk(sk);
>  	struct bcm_op *op;
>  
> -	seq_printf(m, ">>> socket %p", sk->sk_socket);
> -	seq_printf(m, " / sk %p", sk);
> -	seq_printf(m, " / bo %p", bo);
> +	/* Only expose kernel addresses to privileged readers */
> +	if (capable(CAP_NET_ADMIN))
> +		seq_printf(m, ">>> socket %p", sk->sk_socket);
> +		seq_printf(m, " / sk %p", sk);
> +		seq_printf(m, " / bo %p", bo);
> +	else
> +		seq_printf(m, ">>> socket %lu", sock_i_ino(sk));
> +		seq_printf(m, " / sk %d", 0);
> +		seq_printf(m, " / bo %d", 0);
> +

Printing different data based on security state seems like an ABI
nightmare.

--