linux/net/rxrpc
David Howells 5d5fe8bcd3 rxrpc: Fix data-race warning and potential load/store tearing
Fix the following:

        BUG: KCSAN: data-race in rxrpc_peer_keepalive_worker / rxrpc_send_data_packet

which is reporting an issue with the reads and writes to ->last_tx_at in:

        conn->peer->last_tx_at = ktime_get_seconds();

and:

        keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME;

The lockless accesses to these to values aren't actually a problem as the
read only needs an approximate time of last transmission for the purposes
of deciding whether or not the transmission of a keepalive packet is
warranted yet.

Also, as ->last_tx_at is a 64-bit value, tearing can occur on a 32-bit
arch.

Fix both of these by switching to an unsigned int for ->last_tx_at and only
storing the LSW of the time64_t.  It can then be reconstructed at need
provided no more than 68 years has elapsed since the last transmission.

Fixes: ace45bec6d ("rxrpc: Fix firewall route keepalive")
Reported-by: syzbot+6182afad5045e6703b3d@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/695e7cfb.050a0220.1c677c.036b.GAE@google.com/
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/1107124.1768903985@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-01-21 19:59:29 -08:00
..
af_rxrpc.c net: Convert proto_ops connect() callbacks to use sockaddr_unsized 2025-11-04 19:10:32 -08:00
ar-internal.h rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
call_accept.c rxrpc: Fix to use conn aborts for conn-wide failures 2025-07-17 07:50:48 -07:00
call_event.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
call_object.c rxrpc: Fix notification vs call-release vs recvmsg 2025-07-17 07:50:48 -07:00
call_state.c rxrpc: Move client call connection to the I/O thread 2023-01-06 09:43:33 +00:00
conn_client.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
conn_event.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
conn_object.c rxrpc: rxgk: Implement connection rekeying 2025-04-14 17:36:42 -07:00
conn_service.c rxrpc_find_service_conn_rcu: fix the usage of read_seqbegin_or_lock() 2023-12-24 15:22:49 +00:00
input.c rxrpc: peer->mtu_lock is redundant 2025-02-21 15:06:29 -08:00
input_rack.c rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985] 2024-12-09 13:48:33 -08:00
insecure.c rxrpc: Fix return from none_validate_challenge() 2025-05-29 12:03:21 +02:00
io_thread.c rxrpc: Fix to use conn aborts for conn-wide failures 2025-07-17 07:50:48 -07:00
Kconfig rxrpc: rxgk: Provide infrastructure and key derivation 2025-04-14 17:36:41 -07:00
key.c rxrpc: Add YFS RxGK (GSSAPI) security class 2025-04-14 17:36:41 -07:00
local_event.c rxrpc: Truncate UTS_RELEASE for rxrpc version 2023-05-30 10:01:06 +02:00
local_object.c rxrpc: Don't use received skbuff timestamps 2024-12-09 13:48:29 -08:00
Makefile rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI) 2025-04-14 17:36:42 -07:00
misc.c rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899) 2024-12-09 13:48:25 -08:00
net_ns.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
oob.c rxrpc: Allow the app to store private data on peer structs 2025-04-14 17:36:42 -07:00
output.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
peer_event.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
peer_object.c rxrpc: Fix irq-disabled in local_bh_enable() 2025-07-17 07:50:48 -07:00
proc.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
protocol.h rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI) 2025-04-14 17:36:42 -07:00
recvmsg.c rxrpc: Fix recvmsg() unconditional requeue 2026-01-19 10:07:06 -08:00
rtt.c rxrpc: Manage RTT per-call rather than per-peer 2024-12-09 13:48:32 -08:00
rxgk.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
rxgk_app.c rxrpc: Fix untrusted unsigned subtract 2025-09-14 13:05:22 -07:00
rxgk_common.h rxrpc: Fix unhandled errors in rxgk_verify_packet_integrity() 2025-09-14 13:05:22 -07:00
rxgk_kdf.c rxrpc: rxgk: Provide infrastructure and key derivation 2025-04-14 17:36:41 -07:00
rxkad.c rxrpc: Fix data-race warning and potential load/store tearing 2026-01-21 19:59:29 -08:00
rxperf.c net: Convert proto_ops bind() callbacks to use sockaddr_unsized 2025-11-04 19:10:32 -08:00
security.c rxrpc: Fix to use conn aborts for conn-wide failures 2025-07-17 07:50:48 -07:00
sendmsg.c rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE 2025-04-14 17:36:41 -07:00
server_key.c rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE 2025-04-14 17:36:41 -07:00
skbuff.c rxrpc: Use consume_skb() rather than kfree_skb_reason() 2023-02-07 23:11:20 +00:00
sysctl.c rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899) 2024-12-09 13:48:25 -08:00
txbuf.c rxrpc: Remove deadcode 2025-04-24 17:03:45 -07:00
utils.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00