All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/17] net: netns refcount tracking series
@ 2021-12-07  0:51 Eric Dumazet
  2021-12-07  0:51 ` [PATCH net-next 01/17] net: add networking namespace refcount tracker Eric Dumazet
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: Eric Dumazet @ 2021-12-07  0:51 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski; +Cc: netdev, Eric Dumazet, Eric Dumazet

From: Eric Dumazet <edumazet@google.com>

We have 100+ syzbot reports about netns being dismantled too soon,
still unresolved as of today.

We think a missing get_net() or an extra put_net() is the root cause.

In order to find the bug(s), and be able to spot future ones,
this patch adds CONFIG_NET_NS_REFCNT_TRACKER and new helpers
to precisely pair all put_net() with corresponding get_net().

To use these helpers, each data structure owning a refcount
should also use a "netns_tracker" to pair the get() and put().

Small sections of codes where the get()/put() are in sight
do not need to have a tracker, because they are short lived,
but in theory it is also possible to declare an on-stack tracker.

Eric Dumazet (17):
  net: add networking namespace refcount tracker
  net: add netns refcount tracker to struct sock
  net: add netns refcount tracker to struct seq_net_private
  net: sched: add netns refcount tracker to struct tcf_exts
  netfilter: nfnetlink: add netns refcount tracker to struct
    nfulnl_instance
  l2tp: add netns refcount tracker to l2tp_dfs_seq_data
  ppp: add netns refcount tracker
  netfilter: nf_nat_masquerade: add netns refcount tracker to
    masq_dev_work
  SUNRPC: add netns refcount tracker to struct svc_xprt
  SUNRPC: add netns refcount tracker to struct gss_auth
  SUNRPC: add netns refcount tracker to struct rpc_xprt
  net: initialize init_net earlier
  net: add netns refcount tracker to struct nsproxy
  vfs: add netns refcount tracker to struct fs_context
  audit: add netns refcount tracker to struct audit_net
  audit: add netns refcount tracker to struct audit_reply
  audit: add netns refcount tracker to struct audit_netlink_list

 drivers/net/ppp/ppp_generic.c     |  5 ++--
 fs/afs/mntpt.c                    |  5 ++--
 fs/fs_context.c                   |  7 +++---
 fs/nfs/fs_context.c               |  5 ++--
 fs/nfs/namespace.c                |  5 ++--
 fs/proc/proc_net.c                | 19 ++++++++++++---
 include/linux/fs_context.h        |  2 ++
 include/linux/netdevice.h         |  9 +------
 include/linux/nsproxy.h           |  2 ++
 include/linux/seq_file_net.h      |  3 ++-
 include/linux/sunrpc/svc_xprt.h   |  1 +
 include/linux/sunrpc/xprt.h       |  1 +
 include/net/net_namespace.h       | 40 +++++++++++++++++++++++++++++++
 include/net/net_trackers.h        | 18 ++++++++++++++
 include/net/pkt_cls.h             |  8 +++++--
 include/net/sock.h                |  2 ++
 init/main.c                       |  2 ++
 kernel/audit.c                    | 14 +++++++----
 kernel/audit.h                    |  2 ++
 kernel/auditfilter.c              |  3 ++-
 kernel/nsproxy.c                  |  5 ++--
 net/Kconfig.debug                 |  9 +++++++
 net/core/dev.c                    |  3 +--
 net/core/net_namespace.c          | 24 ++++++++-----------
 net/core/sock.c                   |  6 ++---
 net/l2tp/l2tp_debugfs.c           |  9 +++----
 net/netfilter/nf_nat_masquerade.c |  4 +++-
 net/netfilter/nfnetlink_log.c     |  5 ++--
 net/sunrpc/auth_gss/auth_gss.c    | 10 ++++----
 net/sunrpc/svc_xprt.c             |  4 ++--
 net/sunrpc/xprt.c                 |  4 ++--
 31 files changed, 169 insertions(+), 67 deletions(-)
 create mode 100644 include/net/net_trackers.h

-- 
2.34.1.400.ga245620fadb-goog


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-12-09 20:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07  0:51 [PATCH net-next 00/17] net: netns refcount tracking series Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 01/17] net: add networking namespace refcount tracker Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 02/17] net: add netns refcount tracker to struct sock Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 03/17] net: add netns refcount tracker to struct seq_net_private Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 04/17] net: sched: add netns refcount tracker to struct tcf_exts Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 05/17] netfilter: nfnetlink: add netns refcount tracker to struct nfulnl_instance Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 06/17] l2tp: add netns refcount tracker to l2tp_dfs_seq_data Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 07/17] ppp: add netns refcount tracker Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 08/17] netfilter: nf_nat_masquerade: add netns refcount tracker to masq_dev_work Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 09/17] SUNRPC: add netns refcount tracker to struct svc_xprt Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 10/17] SUNRPC: add netns refcount tracker to struct gss_auth Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 11/17] SUNRPC: add netns refcount tracker to struct rpc_xprt Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 12/17] net: initialize init_net earlier Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 13/17] net: add netns refcount tracker to struct nsproxy Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 14/17] vfs: add netns refcount tracker to struct fs_context Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 15/17] audit: add netns refcount tracker to struct audit_net Eric Dumazet
2021-12-07 14:40   ` Jakub Kicinski
2021-12-07  0:51 ` [PATCH net-next 16/17] audit: add netns refcount tracker to struct audit_reply Eric Dumazet
2021-12-07  0:51 ` [PATCH net-next 17/17] audit: add netns refcount tracker to struct audit_netlink_list Eric Dumazet
2021-12-09 20:03 ` [PATCH net-next 00/17] net: netns refcount tracking series Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.