Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 114ec5bb authored by Eric Dumazet's avatar Eric Dumazet Committed by Chenbo Feng
Browse files

BACKPORT [UPSTREAM] net: add real socket cookies



Cherry-pick from 33cf7c90fe2f97afb1cadaa0cfb782cb9d1b9ee2. The socket
cookie is used to identify the socket in side xt_qtaguid module. Using
the socket cookie can release the socket reference count currently
holding by qtaguid when the socket is tagged.

A long standing problem in netlink socket dumps is the use
of kernel socket addresses as cookies.

1) It is a security concern.

2) Sockets can be reused quite quickly, so there is
   no guarantee a cookie is used once and identify
   a flow.

3) request sock, establish sock, and timewait socks
   for a given flow have different cookies.

Part of our effort to bring better TCP statistics requires
to switch to a different allocator.

In this patch, I chose to use a per network namespace 64bit generator,
and to use it only in the case a socket needs to be dumped to netlink.
(This might be refined later if needed)

Note that I tried to carry cookies from request sock, to establish sock,
then timewait sockets.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Eric Salo <salo@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarChenbo Feng <fengc@google.com>
Change-Id: Ib80b1eb1bf18b26df238808c4e495d53600348a8
parent b6fe6045
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment