[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJevGzP5r6sPXpX=pSxPJWZQHjKKYekZpFTG9xEq50pMg@mail.gmail.com>
Date: Tue, 18 Jan 2022 00:40:56 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Congyu Liu <liu3101@...due.edu>
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,
Wang Hai <wanghai38@...wei.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
jiapeng.chong@...ux.alibaba.com, netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: 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