Netdev List
 help / color / mirror / Atom feed
* [PATCH net v4 0/5] amt: relay tunnel lifetime, validation and request-path hardening
@ 2026-10-13 17:54 Omar Ramadan
  2026-10-13 17:54 ` [PATCH net v4 1/5] amt: fix use-after-free when a Membership Update re-arms a freed tunnel Omar Ramadan
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Omar Ramadan @ 2026-10-13 17:54 UTC (permalink / raw)
  To: Taehee Yoo, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Simon Horman

Five fixes to the AMT relay data and control paths, found while adding an
IPv6 outer transport (that feature follows for net-next, rebased on this).
All are independent of the IPv6 work and belong in net with stable in mind.

1/5 closes the gc_wq re-arm use-after-free and makes device-stop teardown
safe for lockless RCU readers. 2/5 rejects gateway Query/Data from 0.0.0.0
before a relay is learned. 3/5 requires exactly four bytes for the IPv4
input attributes, avoiding silent truncation of larger payloads. 4/5 makes
pre-Query report drops visible and stops counting forwarded reports as
drops. 5/5 keys relay tunnels on the (address, port) endpoint, authenticates
Updates before allocating tunnel state, and closes the report-group and
post-stop creation races found in review of v3.

Each patch carries a Fixes: tag. The exact tip builds warning-free with
GCC and Clang, W=1, with IPv6 enabled and disabled. A KASAN + lockdep +
PROVE_RCU kernel passes amt.sh 6/6 with no splats. The full-table control
(max_tunnels=1) gives the same result as v3.

v4:
- 1/5: unlink tunnels in place with list_del_rcu() and defer their free
  with kfree_rcu(); do not splice onto a stack head visible to RCU readers.
- 3/5: replace the IPv6-length special case with NLA_POLICY_EXACT_LEN for
  LOCAL_IP and DISCOVERY_IP. REMOTE_IP is output-only and is unchanged.
- 4/5: return directly after a successful Membership Update, use
  DEV_STATS_INC() for tx counters, and clarify the debug message.
- 5/5: fold v3's endpoint-keying patch into the authenticated-allocation
  patch, so no intermediate commit allocates unauthenticated port-keyed
  tunnels; retain four secret generations (180s floor > 125s QQIC);
  withhold Queries at both tunnel limits and silently drop refused
  Requests; re-check dead under the tunnel lock before report handling;
  reject creation after device stop.
- Rewrap the comments reported by NIPA at 80 columns.

v3: https://lore.kernel.org/netdev/20261012125943.558629-1-omar@blockcast.net/
v2: https://lore.kernel.org/netdev/20261009201455.1904698-1-omar@blockcast.net/
v1: https://lore.kernel.org/netdev/20261008003606.3666617-1-omar@blockcast.net/

Omar Ramadan (5):
  amt: fix use-after-free when a Membership Update re-arms a freed
    tunnel
  amt: reject a gateway Query or Data from 0.0.0.0 before a relay is
    learned
  amt: require an exact IPv4-sized IFLA_AMT_{LOCAL,DISCOVERY}_IP
  amt: make pre-query report drops visible
  amt: harden relay tunnel lifetime and request admission

 drivers/net/amt.c | 389 +++++++++++++++++++++++++++++++++++-----------
 include/net/amt.h |  27 +++-
 2 files changed, 317 insertions(+), 99 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH net v4 0/5] amt: relay tunnel lifetime, validation and request-path hardening
@ 2026-10-15 22:06 Omar Ramadan
  2026-10-15 22:06 ` [PATCH net v4 1/5] amt: fix use-after-free when a Membership Update re-arms a freed tunnel Omar Ramadan
  0 siblings, 1 reply; 13+ messages in thread
From: Omar Ramadan @ 2026-10-15 22:06 UTC (permalink / raw)
  To: Taehee Yoo, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Simon Horman

This series hardens AMT relay tunnel lifetime, validates gateway input, and
keeps unauthenticated Requests from consuming relay state. The fixes were
found while reviewing the AMT IPv6 outer transport work; that work is not
included here.

The first patch closes the gc_wq re-arm use-after-free and makes device-stop
teardown safe for RCU readers and concurrent delayed work. The second rejects
Queries and Data from 0.0.0.0 before relay discovery. The third requires
exactly four bytes for IPv4 netlink address attributes. The fourth makes
pre-Query drops visible, avoids counting successful reports as drops, and uses
concurrent-safe TX statistics. The fifth keeps Requests stateless, authenticates
Membership Updates before allocation, keys state by address and port, bounds
per-source admission, and closes group-worker and post-stop teardown races.

v4 changes:
- Add dead-state checks and RCU protection for group and source timer workers;
  retain exactly-once device-reference release on group timer exits.
- Revalidate deferred gateway Queries against the current relay address.
- Use DEV_STATS_INC() for all AMT TX error and drop counters.
- Fold endpoint keying into authenticated allocation and keep four secret
  generations, with silent refusal at global or per-source limits.
- Document the Request-only timer lifetime in the intermediate patch and wrap
  the new comments for the netdev linter.

Validation: GCC W=1 object builds with IPv6 enabled and disabled, Clang W=1
object build, and a KASAN + lockdep + PROVE_RCU AMT selftest soak. The KASAN
guest passed discovery, IPv4/IPv6 forwarding, query egress, and completed the
IPv4 torture run; the IPv6 torture run was still active when the session was
interrupted.

v3: https://lore.kernel.org/netdev/20261012125943.558629-1-omar@blockcast.net/
v2: https://lore.kernel.org/netdev/20261009201455.1904698-1-omar@blockcast.net/
v1: https://lore.kernel.org/netdev/20261008003606.3666617-1-omar@blockcast.net/

Assisted-by: LLM

Omar Ramadan (5):
  amt: fix use-after-free when a Membership Update re-arms a freed
    tunnel
  amt: reject a gateway Query or Data from 0.0.0.0 before a relay is
    learned
  amt: require an exact IPv4-sized IFLA_AMT_{LOCAL,DISCOVERY}_IP
  amt: make pre-query report drops visible
  amt: harden relay authentication and teardown

 drivers/net/amt.c | 477 ++++++++++++++++++++++++++++++++++------------
 include/net/amt.h |  28 ++-
 2 files changed, 376 insertions(+), 129 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-10-15 23:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 17:54 [PATCH net v4 0/5] amt: relay tunnel lifetime, validation and request-path hardening Omar Ramadan
2026-10-13 17:54 ` [PATCH net v4 1/5] amt: fix use-after-free when a Membership Update re-arms a freed tunnel Omar Ramadan
2026-10-15 17:55   ` netdev-bot+sashiko
2026-10-13 17:54 ` [PATCH net v4 2/5] amt: reject a gateway Query or Data from 0.0.0.0 before a relay is learned Omar Ramadan
2026-10-15 17:55   ` netdev-bot+sashiko
2026-10-13 17:54 ` [PATCH net v4 3/5] amt: require an exact IPv4-sized IFLA_AMT_{LOCAL,DISCOVERY}_IP Omar Ramadan
2026-10-13 17:54 ` [PATCH net v4 4/5] amt: make pre-query report drops visible Omar Ramadan
2026-10-15 17:55   ` netdev-bot+sashiko
2026-10-13 17:54 ` [PATCH net v4 5/5] amt: harden relay tunnel lifetime and request admission Omar Ramadan
2026-10-15 17:55   ` netdev-bot+sashiko
2026-10-13 17:59 ` [PATCH net v4 0/5] amt: relay tunnel lifetime, validation and request-path hardening netdev-bot+sinfo
2026-10-15 23:22 ` Omar Ramadan
  -- strict thread matches above, loose matches on Subject: below --
2026-10-15 22:06 Omar Ramadan
2026-10-15 22:06 ` [PATCH net v4 1/5] amt: fix use-after-free when a Membership Update re-arms a freed tunnel Omar Ramadan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox