[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <MWHPR2201MB1072C10AFC2C4C1AD68A4382D0589@MWHPR2201MB1072.namprd22.prod.outlook.com>
Date: Tue, 18 Jan 2022 18:53:46 +0000
From: "Liu, Congyu" <liu3101@...due.edu>
To: Eric Dumazet <edumazet@...gle.com>
CC: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Yajun Deng <yajun.deng@...ux.dev>,
Willem de Bruijn <willemb@...gle.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"rsanger@...d.net.nz" <rsanger@...d.net.nz>,
Wang Hai <wanghai38@...wei.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
"jiapeng.chong@...ux.alibaba.com" <jiapeng.chong@...ux.alibaba.com>,
netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: 回复: [PATCH net] net: fix information leakage in /proc/net/ptype
Thanks! That makes sense. I will send a V2 patch.
________________________________________
发件人: Eric Dumazet <edumazet@...gle.com>
发送时间: 2022年1月18日 3:40
收件人: Liu, Congyu
抄送: David Miller; Jakub Kicinski; Yajun Deng; Willem de Bruijn; Marc Kleine-Budde; rsanger@...d.net.nz; Wang Hai; Pablo Neira Ayuso; jiapeng.chong@...ux.alibaba.com; netdev; LKML
主题: Re: [PATCH net] net: fix information leakage in /proc/net/ptype
On Mon, Jan 17, 2022 at 11:01 PM Congyu Liu <liu3101@...due.edu> wrote:
>
> In one net namespace, after creating a packet socket without binding
> it to a device, users in other net namespaces can observe the new
> `packet_type` added by this packet socket by reading `/proc/net/ptype`
> file. I believe this is minor information leakage as packet socket is
> namespace aware.
>
> Add a function pointer in `packet_type` to retrieve the net namespace
> of corresponding packet socket. In `ptype_seq_show`, if this
> function pointer is not NULL, use it to determine if certain ptype
> should be shown.
>
> Signed-off-by: Congyu Liu <liu3101@...due.edu>
> ---
> include/linux/netdevice.h | 1 +
> net/core/net-procfs.c | 3 ++-
> net/packet/af_packet.c | 18 ++++++++++++++++++
> 3 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 3213c7227b59..72d3601850c5 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2548,6 +2548,7 @@ struct packet_type {
> struct net_device *);
> bool (*id_match)(struct packet_type *ptype,
> struct sock *sk);
> + struct net *(*get_net) (struct packet_type *ptype);
> void *af_packet_priv;
> struct list_head list;
> };
Patch looks fine, but the question is:
Can an af_packet socket created in netns A can be moved to netns B later ?
As the answer is probably no, it seems we could simply add a 'struct
net' pointer
in 'struct packet type', no need for a function.
Thanks.
Powered by blists - more mailing lists