TencentOS-kernel/net/xfrm
Ahmed S. Darwish 2c77cf1576 net: xfrm: Localize sequence counter per network namespace
[ Upstream commit e88add19f68191448427a6e4eb059664650a837f ]

A sequence counter write section must be serialized or its internal
state can get corrupted. The "xfrm_state_hash_generation" seqcount is
global, but its write serialization lock (net->xfrm.xfrm_state_lock) is
instantiated per network namespace. The write protection is thus
insufficient.

To provide full protection, localize the sequence counter per network
namespace instead. This should be safe as both the seqcount read and
write sections access data exclusively within the network namespace. It
also lays the foundation for transforming "xfrm_state_hash_generation"
data type from seqcount_t to seqcount_LOCKNAME_t in further commits.

Fixes: b65e3d7be06f ("xfrm: state: add sequence count to detect hash resizes")
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:06:58 +08:00
..
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_algo.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_device.c xfrm: Fix double ESP trailer insertion in IPsec crypto offload. 2021-03-16 16:30:55 +08:00
xfrm_hash.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_hash.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_inout.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_input.c xfrm: Fix oops in xfrm_replay_advance_bmp 2021-04-12 12:51:45 +08:00
xfrm_interface.c xfrm: interface: fix ipv4 pmtu check to honor ip header df 2021-05-20 16:06:58 +08:00
xfrm_ipcomp.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_output.c xfrm: fix a NULL-ptr deref in xfrm_local_error 2021-03-16 16:28:39 +08:00
xfrm_policy.c xfrm: Fix wraparound in xfrm_policy_addr_delta() 2021-04-12 12:51:46 +08:00
xfrm_proc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_replay.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_state.c net: xfrm: Localize sequence counter per network namespace 2021-05-20 16:06:58 +08:00
xfrm_sysctl.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xfrm_user.c xfrm: policy: match with both mark and mask on user interfaces 2021-03-16 16:32:49 +08:00