| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/17 05:02 | flow | patch-triage |
3mArgs:null Results: {
"EnableConfigs": [
"AF_RXRPC"
],
"FocusSymbols": [
"rxrpc_encap_rcv",
"rxrpc_charge_async_queue",
"rxrpc_uncharge_async_queue",
"rxrpc_purge_data_queue",
"rxrpc_adjust_rcvbuf",
"rxrpc_input_call_packet",
"rxrpc_recvmsg"
],
"KMSANReasoning": "The patch series introduces asynchronous receive-memory accounting (rx_async_queue_bytes) and per-connection/per-call queue charge management for RxRPC, including `struct rxrpc_async_queue_charge` to handle split jumbo packets, rmem scheduling in UDP encap_rcv, and receive window bounding.\n\n- KMSAN Applicability: KMSAN detects reads of uninitialized memory and information leaks to user space. In this patch, all newly allocated structures (`struct rxrpc_async_queue_charge`) are allocated using `kzalloc()`, all local variables (such as `reason` in `rxrpc_encap_rcv()` and `slot` / `set_last` in `rxrpc_input_data_one()`) are explicitly initialized before use, and `sp-\u003edata.charge` is explicitly initialized prior to being accessed. No uninitialized memory or structure padding is exposed or copied to user space. Thus, there are no uninitialized memory risks that KMSAN would uniquely detect.\n\n- KASAN \u0026 Standard Sanitizers Applicability: The changes primarily involve reference counting (`charge-\u003eref`, connection refcounts), socket locking (`sk_receive_queue.lock`), atomic accounting (`rx_async_queue_bytes`), and skb queue lifecycle management. Potential bugs in these areas (such as use-after-free, double free, refcount underflow/leak, or locking deadlocks) are already covered by KASAN, refcount_t hardening, and LOCKDEP.\n\nTherefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false,
"Reasoning": "The patch introduces asynchronous receive-memory queue charging and bounds receive window accounting for RxRPC (AF_RXRPC). It adds refcounted accounting for split jumbo DATA packets, enforces socket receive buffer limits in the UDP encapsulation receive handler, and modifies packet reception, socket read, and queue purge paths. These changes alter core protocol memory tracking and refcounting in reachable network socket code, warranting fuzzing for potential leaks, underflows, or state corruption.",
"WorthFuzzing": true
} |
| 1/1 | 2026/10/17 05:02 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 32558b85243dfd8ba5a459ae7ad050597dd1e055\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sat Oct 17 05:02:50 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h\nindex 865f05fe37ab9..1f1f49eca8e11 100644\n--- a/net/rxrpc/ar-internal.h\n+++ b/net/rxrpc/ar-internal.h\n@@ -50,6 +50,7 @@ struct key_preparsed_payload;\n struct rxrpc_connection;\n struct rxrpc_txbuf;\n struct rxrpc_txqueue;\n+struct rxrpc_async_queue_charge;\n struct rxgk_context;\n \n /*\n@@ -222,6 +223,15 @@ struct rxrpc_host_header {\n \tu16\t\tserviceId;\t/* service ID */\n } __packed;\n \n+/*\n+ * Shared asynchronous receive-memory charge for split jumbo DATA packets.\n+ */\n+struct rxrpc_async_queue_charge {\n+\trefcount_t\t\tref;\n+\tlong\t\t\tsize;\n+\tbool\t\t\tcharged;\n+};\n+\n /*\n * RxRPC socket buffer private variables\n * - max 48 bytes (struct sk_buff::cb)\n@@ -233,6 +243,11 @@ struct rxrpc_skb_priv {\n \t\t\tu16\t\toffset;\t\t/* Offset of data */\n \t\t\tu16\t\tlen;\t\t/* Length of data */\n \t\t};\n+\t\tstruct {\n+\t\t\tu16\t\toffset;\n+\t\t\tu16\t\tlen;\n+\t\t\tstruct rxrpc_async_queue_charge *charge;\n+\t\t} data;\n \t\tstruct {\n \t\t\trxrpc_seq_t\tfirst_ack;\t/* First packet in acks table */\n \t\t\trxrpc_seq_t\tprev_ack;\t/* Highest seq seen */\n@@ -360,6 +375,7 @@ struct rxrpc_local {\n \tstruct sk_buff_head\trx_delay_queue;\t/* Delay injection queue */\n #endif\n \tstruct sk_buff_head\trx_queue;\t/* Received packets */\n+\tatomic_long_t\t\trx_async_queue_bytes;\t/* Outstanding async Rx bytes */\n \tstruct list_head\tconn_attend_q;\t/* Conns requiring immediate attention */\n \tstruct list_head\tcall_attend_q;\t/* Calls requiring immediate attention */\n \n@@ -1323,6 +1339,7 @@ void rxrpc_send_version_request(struct rxrpc_local *local,\n * local_object.c\n */\n void rxrpc_local_dont_fragment(const struct rxrpc_local *local, bool set);\n+void rxrpc_adjust_rcvbuf(struct sock *sk);\n struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *);\n struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *, enum rxrpc_local_trace);\n struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *, enum rxrpc_local_trace);\n@@ -1515,6 +1532,12 @@ void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace);\n void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace);\n void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace);\n void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace);\n+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb);\n+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,\n+\t\t\t\t struct rxrpc_async_queue_charge *charge);\n+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);\n+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);\n+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list);\n void rxrpc_purge_queue(struct sk_buff_head *);\n \n /*\ndiff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c\nindex 21be9c86d7a74..9360852604645 100644\n--- a/net/rxrpc/call_event.c\n+++ b/net/rxrpc/call_event.c\n@@ -473,6 +473,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)\n out:\n \tif (__rxrpc_call_is_complete(call)) {\n \t\ttimer_delete_sync(\u0026call-\u003etimer);\n+\t\trxrpc_purge_queue(\u0026call-\u003erx_queue);\n \t\tif (!test_bit(RXRPC_CALL_DISCONNECTED, \u0026call-\u003eflags))\n \t\t\trxrpc_disconnect_call(call);\n \t\tif (call-\u003esecurity)\ndiff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c\nindex 817ed9acb91e6..8f115be491249 100644\n--- a/net/rxrpc/call_object.c\n+++ b/net/rxrpc/call_object.c\n@@ -553,9 +553,9 @@ static void rxrpc_cleanup_tx_buffers(struct rxrpc_call *call)\n */\n static void rxrpc_cleanup_rx_buffers(struct rxrpc_call *call)\n {\n-\trxrpc_purge_queue(\u0026call-\u003erecvmsg_queue);\n+\trxrpc_purge_data_queue(call, \u0026call-\u003erecvmsg_queue);\n \trxrpc_purge_queue(\u0026call-\u003erx_queue);\n-\trxrpc_purge_queue(\u0026call-\u003erx_oos_queue);\n+\trxrpc_purge_data_queue(call, \u0026call-\u003erx_oos_queue);\n \tkfree(call-\u003erx_dec_buffer);\n }\n \ndiff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c\nindex 611c790bc6d0c..d37cef2523997 100644\n--- a/net/rxrpc/conn_event.c\n+++ b/net/rxrpc/conn_event.c\n@@ -391,8 +391,17 @@ static void rxrpc_do_process_connection(struct rxrpc_connection *conn)\n \t/* go through the conn-level event packets, releasing the ref on this\n \t * connection that each one has when we've finished with it */\n \twhile ((skb = skb_dequeue(\u0026conn-\u003erx_queue))) {\n+\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n \t\trxrpc_see_skb(skb, rxrpc_skb_see_conn_work);\n \t\trxrpc_process_event(conn, skb);\n+\t\tif (skb-\u003emark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\n+\t\t\trxrpc_uncharge_async_queue(conn-\u003elocal, skb);\n+\t\tif (sp-\u003ehdr.type == RXRPC_PACKET_TYPE_CHALLENGE \u0026\u0026 sp-\u003echall.conn) {\n+\t\t\trxrpc_put_connection(\n+\t\t\t\tsp-\u003echall.conn,\n+\t\t\t\trxrpc_conn_put_challenge_input);\n+\t\t\tsp-\u003echall.conn = NULL;\n+\t\t}\n \t\trxrpc_free_skb(skb, rxrpc_skb_put_conn_work);\n \t}\n }\n@@ -414,15 +423,22 @@ void rxrpc_process_connection(struct work_struct *work)\n * post connection-level events to the connection\n * - this includes challenges, responses, some aborts and call terminal packet\n * retransmission.\n+ * - bound the queued memory independently of the UDP rmem charge.\n */\n-static void rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,\n+static bool rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,\n \t\t\t\t struct sk_buff *skb)\n {\n+\tstruct rxrpc_local *local = conn-\u003elocal;\n+\n+\tif (!rxrpc_charge_async_queue(local, skb))\n+\t\treturn false;\n+\n \t_enter(\"%p,%p\", conn, skb);\n \n \trxrpc_get_skb(skb, rxrpc_skb_get_conn_work);\n \tskb_queue_tail(\u0026conn-\u003erx_queue, skb);\n \trxrpc_queue_conn(conn, rxrpc_conn_queue_rx_work);\n+\treturn true;\n }\n \n /*\n@@ -442,7 +458,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,\n \t\trxrpc_get_connection(conn, rxrpc_conn_get_challenge_input);\n \n \tif (!conn-\u003esecurity-\u003echallenge_to_recvmsg) {\n-\t\trxrpc_post_packet_to_conn(conn, skb);\n+\t\tif (!rxrpc_post_packet_to_conn(conn, skb)) {\n+\t\t\trxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);\n+\t\t\tsp-\u003echall.conn = NULL;\n+\t\t}\n \t\treturn true;\n \t}\n \n@@ -480,8 +499,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,\n \t\treturn false;\n \t}\n \n-\tif (!call)\n-\t\trxrpc_post_packet_to_conn(conn, skb);\n+\tif (!call \u0026\u0026 !rxrpc_post_packet_to_conn(conn, skb)) {\n+\t\trxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);\n+\t\tsp-\u003echall.conn = NULL;\n+\t}\n \treturn true;\n }\n \ndiff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c\nindex 0ece717db0f85..d85345e014a9f 100644\n--- a/net/rxrpc/conn_object.c\n+++ b/net/rxrpc/conn_object.c\n@@ -300,6 +300,19 @@ static void rxrpc_rcu_free_connection(struct rcu_head *rcu)\n \t\twake_up_var(\u0026rxnet-\u003enr_conns);\n }\n \n+/*\n+ * Purge a connection's receive queue, updating the local queue accounting.\n+ */\n+static void rxrpc_purge_conn_queue(struct rxrpc_connection *conn)\n+{\n+\tstruct sk_buff *skb;\n+\n+\twhile ((skb = skb_dequeue(\u0026conn-\u003erx_queue))) {\n+\t\trxrpc_uncharge_async_queue(conn-\u003elocal, skb);\n+\t\trxrpc_free_skb(skb, rxrpc_skb_put_purge);\n+\t}\n+}\n+\n /*\n * Clean up a dead connection.\n */\n@@ -329,7 +342,7 @@ static void rxrpc_clean_up_connection(struct work_struct *work)\n \t\tconn-\u003epeer-\u003epmtud_pending = true;\n \t}\n \n-\trxrpc_purge_queue(\u0026conn-\u003erx_queue);\n+\trxrpc_purge_conn_queue(conn);\n \trxrpc_free_skb(conn-\u003etx_response, rxrpc_skb_put_response);\n \n \trxrpc_kill_client_conn(conn);\n@@ -338,15 +351,15 @@ static void rxrpc_clean_up_connection(struct work_struct *work)\n \tkey_put(conn-\u003ekey);\n \trxrpc_put_bundle(conn-\u003ebundle, rxrpc_bundle_put_conn);\n \trxrpc_put_peer(conn-\u003epeer, rxrpc_peer_put_conn);\n-\trxrpc_put_local(conn-\u003elocal, rxrpc_local_put_kill_conn);\n \n \t/* Drain the Rx queue. Note that even though we've unpublished, an\n \t * incoming packet could still be being added to our Rx queue, so we\n \t * will need to drain it again in the RCU cleanup handler.\n \t */\n-\trxrpc_purge_queue(\u0026conn-\u003erx_queue);\n+\trxrpc_purge_conn_queue(conn);\n \n \tpage_frag_cache_drain(\u0026conn-\u003etx_data_alloc);\n+\trxrpc_put_local(conn-\u003elocal, rxrpc_local_put_kill_conn);\n \tcall_rcu(\u0026conn-\u003ercu, rxrpc_rcu_free_connection);\n }\n \ndiff --git a/net/rxrpc/input.c b/net/rxrpc/input.c\nindex 73cafe6bfa9f5..6f0ba50097390 100644\n--- a/net/rxrpc/input.c\n+++ b/net/rxrpc/input.c\n@@ -479,7 +479,9 @@ static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,\n * Process a DATA packet.\n */\n static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n-\t\t\t\t bool *_notify, rxrpc_serial_t *_ack_serial, int *_ack_reason)\n+\t\t\t\t bool *_notify, rxrpc_serial_t *_ack_serial,\n+\t\t\t\t int *_ack_reason,\n+\t\t\t\t struct rxrpc_async_queue_charge **_charge)\n {\n \tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n \tstruct sk_buff *oos;\n@@ -487,9 +489,13 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n \tunsigned int sack = call-\u003eackr_sack_base;\n \trxrpc_seq_t window = call-\u003eackr_window;\n \trxrpc_seq_t wtop = call-\u003eackr_wtop;\n-\trxrpc_seq_t wlimit = window + call-\u003erx_winsize - 1;\n+\t/* Bound queued DATA by the application's receive window. */\n+\trxrpc_seq_t wlimit = smp_load_acquire(\u0026call-\u003erx_consumed) +\n+\t\tcall-\u003erx_winsize;\n \trxrpc_seq_t seq = sp-\u003ehdr.seq;\n \tbool last = sp-\u003ehdr.flags \u0026 RXRPC_LAST_PACKET;\n+\tbool set_last = false;\n+\tunsigned int slot = 0;\n \tint ack_reason = -1;\n \n \trxrpc_inc_stat(call-\u003erxnet, stat_rx_data);\n@@ -498,10 +504,24 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n \tif (sp-\u003ehdr.flags \u0026 RXRPC_JUMBO_PACKET)\n \t\trxrpc_inc_stat(call-\u003erxnet, stat_rx_data_jumbo);\n \n+\tif (after(seq, call-\u003erx_highest_seq))\n+\t\tcall-\u003erx_highest_seq = seq;\n+\n+\ttrace_rxrpc_rx_data(call-\u003edebug_id, seq, serial, sp-\u003ehdr.flags);\n+\n+\tif (after(seq, wlimit)) {\n+\t\tack_reason = RXRPC_ACK_EXCEEDS_WINDOW;\n+\t\tgoto send_ack;\n+\t}\n+\n \tif (last) {\n-\t\tif (test_and_set_bit(RXRPC_CALL_RX_LAST, \u0026call-\u003eflags) \u0026\u0026\n-\t\t seq + 1 != wtop)\n-\t\t\treturn rxrpc_proto_abort(call, seq, rxrpc_eproto_different_last);\n+\t\tif (test_and_set_bit(RXRPC_CALL_RX_LAST, \u0026call-\u003eflags)) {\n+\t\t\tif (seq + 1 != wtop)\n+\t\t\t\treturn rxrpc_proto_abort(call, seq,\n+\t\t\t\t\t\t\trxrpc_eproto_different_last);\n+\t\t} else {\n+\t\t\tset_last = true;\n+\t\t}\n \t} else {\n \t\tif (test_bit(RXRPC_CALL_RX_LAST, \u0026call-\u003eflags) \u0026\u0026\n \t\t after_eq(seq, wtop)) {\n@@ -511,17 +531,33 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n \t\t}\n \t}\n \n-\tif (after(seq, call-\u003erx_highest_seq))\n-\t\tcall-\u003erx_highest_seq = seq;\n-\n-\ttrace_rxrpc_rx_data(call-\u003edebug_id, seq, serial, sp-\u003ehdr.flags);\n-\n \tif (before(seq, window)) {\n \t\tack_reason = RXRPC_ACK_DUPLICATE;\n \t\tgoto send_ack;\n \t}\n-\tif (after(seq, wlimit)) {\n-\t\tack_reason = RXRPC_ACK_EXCEEDS_WINDOW;\n+\n+\tif (seq != window) {\n+\t\tslot = seq - window;\n+\t\tsack = (sack + slot) % RXRPC_SACK_SIZE;\n+\n+\t\tif (call-\u003eackr_sack_table[sack]) {\n+\t\t\tack_reason = RXRPC_ACK_DUPLICATE;\n+\t\t\tgoto send_ack;\n+\t\t}\n+\t}\n+\n+\tsp-\u003edata.charge = NULL;\n+\tif (sp-\u003eoffset != sizeof(struct rxrpc_wire_header) ||\n+\t (sp-\u003ehdr.flags \u0026 RXRPC_JUMBO_PACKET)) {\n+\t\tif (!*_charge)\n+\t\t\t*_charge = rxrpc_alloc_async_queue_charge(skb);\n+\t\tsp-\u003edata.charge = *_charge;\n+\t}\n+\tif (!rxrpc_charge_async_queue(call-\u003elocal, skb)) {\n+\t\tsp-\u003edata.charge = NULL;\n+\t\tif (set_last)\n+\t\t\tclear_bit(RXRPC_CALL_RX_LAST, \u0026call-\u003eflags);\n+\t\tack_reason = RXRPC_ACK_NOSPACE;\n \t\tgoto send_ack;\n \t}\n \n@@ -568,19 +604,8 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n \n \t\tcall-\u003eackr_sack_base = sack;\n \t} else {\n-\t\tunsigned int slot;\n-\n \t\tack_reason = RXRPC_ACK_OUT_OF_SEQUENCE;\n-\n-\t\tslot = seq - window;\n-\t\tsack = (sack + slot) % RXRPC_SACK_SIZE;\n-\n-\t\tif (call-\u003eackr_sack_table[sack % RXRPC_SACK_SIZE]) {\n-\t\t\tack_reason = RXRPC_ACK_DUPLICATE;\n-\t\t\tgoto send_ack;\n-\t\t}\n-\n-\t\tcall-\u003eackr_sack_table[sack % RXRPC_SACK_SIZE] |= 1;\n+\t\tcall-\u003eackr_sack_table[sack] |= 1;\n \t\ttrace_rxrpc_sack(call, seq, sack, rxrpc_sack_oos);\n \n \t\tif (after(seq + 1, wtop)) {\n@@ -623,6 +648,7 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n */\n static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n {\n+\tstruct rxrpc_async_queue_charge *charge = NULL;\n \tstruct rxrpc_jumbo_header jhdr;\n \tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp;\n \tstruct sk_buff *jskb;\n@@ -644,13 +670,15 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb\n \t\tjskb = skb_clone(skb, GFP_NOFS);\n \t\tif (!jskb) {\n \t\t\tkdebug(\"couldn't clone\");\n+\t\t\trxrpc_put_async_queue_charge(call-\u003elocal, charge);\n \t\t\treturn false;\n \t\t}\n \t\trxrpc_new_skb(jskb, rxrpc_skb_new_jumbo_subpacket);\n \t\tjsp = rxrpc_skb(jskb);\n \t\tjsp-\u003eoffset = offset;\n \t\tjsp-\u003elen = RXRPC_JUMBO_DATALEN;\n-\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason);\n+\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\n+\t\t\t\t \u0026charge);\n \t\trxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket);\n \n \t\tsp-\u003ehdr.flags = jhdr.flags;\n@@ -664,7 +692,8 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb\n \n \tsp-\u003eoffset = offset;\n \tsp-\u003elen = len;\n-\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason);\n+\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\n+\t\t\t \u0026charge);\n \n \tstat_ix = umin(count, ARRAY_SIZE(call-\u003erxnet-\u003estat_rx_jumbo)) - 1;\n \tatomic_inc(\u0026call-\u003erxnet-\u003estat_rx_jumbo[stat_ix]);\n@@ -681,9 +710,11 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb\n \t\ttrace_rxrpc_notify_socket(call-\u003edebug_id, sp-\u003ehdr.serial);\n \t\trxrpc_notify_socket(call);\n \t}\n+\trxrpc_put_async_queue_charge(call-\u003elocal, charge);\n \treturn true;\n \n protocol_error:\n+\trxrpc_put_async_queue_charge(call-\u003elocal, charge);\n \treturn false;\n }\n \ndiff --git a/net/rxrpc/io_thread.c b/net/rxrpc/io_thread.c\nindex dc5184a2fa9d1..8679402c03e1b 100644\n--- a/net/rxrpc/io_thread.c\n+++ b/net/rxrpc/io_thread.c\n@@ -7,12 +7,37 @@\n \n #define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n \n+#include \u003cnet/udp.h\u003e\n+\n #include \"ar-internal.h\"\n \n static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,\n \t\t\t\t struct sockaddr_rxrpc *peer_srx,\n \t\t\t\t struct sk_buff *skb);\n \n+/*\n+ * Drop UDP rmem ownership for packets charged in encap_rcv().\n+ * sk_forward_alloc is serialised by sk_receive_queue.lock.\n+ */\n+static void rxrpc_skb_orphan_udp(struct sk_buff *skb)\n+{\n+\tstruct sock *sk = skb-\u003esk;\n+\n+\tif (!sk)\n+\t\treturn;\n+\n+\tspin_lock_bh(\u0026sk-\u003esk_receive_queue.lock);\n+\tskb_orphan(skb);\n+\tspin_unlock_bh(\u0026sk-\u003esk_receive_queue.lock);\n+}\n+\n+static void rxrpc_encap_rcv_drop(struct sock *udp_sk, struct sk_buff *skb,\n+\t\t\t\t enum skb_drop_reason reason)\n+{\n+\tsk_drops_inc(udp_sk);\n+\tsk_skb_reason_drop(udp_sk, skb, reason);\n+}\n+\n /*\n * handle data received on the local endpoint\n * - may be called in interrupt context\n@@ -28,6 +53,10 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)\n \tstruct sk_buff_head *rx_queue;\n \tstruct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk);\n \tstruct task_struct *io_thread;\n+\tenum skb_drop_reason reason;\n+\tunsigned int headroom;\n+\tunsigned int rcvbuf;\n+\tunsigned int rmem;\n \n \tif (unlikely(!local)) {\n \t\tkfree_skb(skb);\n@@ -41,8 +70,6 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)\n \tif (skb-\u003etstamp == 0)\n \t\tskb-\u003etstamp = ktime_get_real();\n \n-\tskb-\u003emark = RXRPC_SKB_MARK_PACKET;\n-\trxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);\n \trx_queue = \u0026local-\u003erx_queue;\n #ifdef CONFIG_AF_RXRPC_INJECT_RX_DELAY\n \tif (rxrpc_inject_rx_delay ||\n@@ -52,9 +79,36 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)\n \t}\n #endif\n \n+\theadroom = SKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;\n+\tspin_lock(\u0026udp_sk-\u003esk_receive_queue.lock);\n+\trxrpc_adjust_rcvbuf(udp_sk);\n+\trcvbuf = READ_ONCE(udp_sk-\u003esk_rcvbuf);\n+\trmem = atomic_read(\u0026udp_sk-\u003esk_rmem_alloc);\n+\t/* Permit one skb when there is no receive memory charged, as UDP does. */\n+\tif (rmem \u0026\u0026 rmem + skb-\u003etruesize + headroom \u003e= rcvbuf) {\n+\t\treason = SKB_DROP_REASON_SOCKET_RCVBUFF;\n+\t\tgoto drop;\n+\t}\n+\tif (!sk_rmem_schedule(udp_sk, skb, skb-\u003etruesize)) {\n+\t\treason = SKB_DROP_REASON_PROTO_MEM;\n+\t\tgoto drop;\n+\t}\n+\n+\tskb-\u003edev = NULL;\n+\tskb_set_owner_r(skb, udp_sk);\n+\tspin_unlock(\u0026udp_sk-\u003esk_receive_queue.lock);\n+\tskb_dst_drop(skb);\n+\n+\tskb-\u003emark = RXRPC_SKB_MARK_PACKET;\n+\trxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);\n \tskb_queue_tail(rx_queue, skb);\n \twake_up_process(io_thread);\n \treturn 0;\n+\n+drop:\n+\tspin_unlock(\u0026udp_sk-\u003esk_receive_queue.lock);\n+\trxrpc_encap_rcv_drop(udp_sk, skb, reason);\n+\treturn 0;\n }\n \n /*\n@@ -471,6 +525,11 @@ int rxrpc_io_thread(void *data)\n \t\t/* Distribute packets and errors. */\n \t\twhile ((skb = __skb_dequeue(\u0026rx_queue))) {\n \t\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n+\n+\t\t\tif (skb-\u003emark == RXRPC_SKB_MARK_PACKET)\n+\t\t\t\trxrpc_skb_orphan_udp(skb);\n+\t\t\telse if (skb-\u003emark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\n+\t\t\t\trxrpc_uncharge_async_queue(sp-\u003epoke_conn-\u003elocal, skb);\n \t\t\tswitch (skb-\u003emark) {\n \t\t\tcase RXRPC_SKB_MARK_PACKET:\n \t\t\t\tskb-\u003epriority = 0;\ndiff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c\nindex 169f9dfdaa77f..8e43f77d43683 100644\n--- a/net/rxrpc/local_object.c\n+++ b/net/rxrpc/local_object.c\n@@ -22,6 +22,19 @@\n \n static void rxrpc_local_rcu(struct rcu_head *);\n \n+void rxrpc_adjust_rcvbuf(struct sock *sk)\n+{\n+\tu32 rcvbuf, old_rcvbuf;\n+\n+\trcvbuf = READ_ONCE(rxrpc_rx_window_size) *\n+\t\tSKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;\n+\trcvbuf += rcvbuf / 4;\n+\trcvbuf = min_t(u32, rcvbuf, READ_ONCE(sysctl_rmem_max));\n+\told_rcvbuf = READ_ONCE(sk-\u003esk_rcvbuf);\n+\tif (rcvbuf \u003e old_rcvbuf)\n+\t\tWRITE_ONCE(sk-\u003esk_rcvbuf, rcvbuf);\n+}\n+\n /*\n * Handle an ICMP/ICMP6 error turning up at the tunnel. Push it through the\n * usual mechanism so that it gets parsed and presented through the UDP\n@@ -124,6 +137,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct net *net,\n \t\tskb_queue_head_init(\u0026local-\u003erx_delay_queue);\n #endif\n \t\tskb_queue_head_init(\u0026local-\u003erx_queue);\n+\t\tatomic_long_set(\u0026local-\u003erx_async_queue_bytes, 0);\n \t\tINIT_LIST_HEAD(\u0026local-\u003econn_attend_q);\n \t\tINIT_LIST_HEAD(\u0026local-\u003ecall_attend_q);\n \n@@ -198,6 +212,9 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)\n \n \t/* set the socket up */\n \tusk = local-\u003esocket-\u003esk;\n+\tspin_lock_bh(\u0026usk-\u003esk_receive_queue.lock);\n+\trxrpc_adjust_rcvbuf(usk);\n+\tspin_unlock_bh(\u0026usk-\u003esk_receive_queue.lock);\n \tusk-\u003esk_error_report = rxrpc_error_report;\n \n \tswitch (srx-\u003etransport.family) {\n@@ -437,8 +454,8 @@ void rxrpc_destroy_local(struct rxrpc_local *local)\n \tif (socket) {\n \t\tlocal-\u003esocket = NULL;\n \t\tkernel_sock_shutdown(socket, SHUT_RDWR);\n-\t\tsocket-\u003esk-\u003esk_user_data = NULL;\n-\t\tsock_release(socket);\n+\t\trcu_assign_sk_user_data(socket-\u003esk, NULL);\n+\t\tsynchronize_rcu();\n \t}\n \n \t/* At this point, there should be no more packets coming in to the\n@@ -448,6 +465,10 @@ void rxrpc_destroy_local(struct rxrpc_local *local)\n \trxrpc_purge_queue(\u0026local-\u003erx_delay_queue);\n #endif\n \trxrpc_purge_queue(\u0026local-\u003erx_queue);\n+\n+\tif (socket)\n+\t\tsock_release(socket);\n+\n \trxrpc_purge_client_connections(local);\n \tpage_frag_cache_drain(\u0026local-\u003etx_alloc);\n }\ndiff --git a/net/rxrpc/oob.c b/net/rxrpc/oob.c\nindex c80ee2487d094..e3d135b12d22d 100644\n--- a/net/rxrpc/oob.c\n+++ b/net/rxrpc/oob.c\n@@ -46,7 +46,9 @@ bool rxrpc_notify_socket_oob(struct rxrpc_call *call, struct sk_buff *skb)\n \t\tsk = \u0026rx-\u003esk;\n \t\tspin_lock_irq(\u0026rx-\u003erecvmsg_lock);\n \n-\t\tif (sk-\u003esk_state \u003c RXRPC_CLOSE) {\n+\t\tif (sk-\u003esk_state \u003c RXRPC_CLOSE \u0026\u0026\n+\t\t rxrpc_charge_async_queue(sp-\u003echall.conn-\u003elocal, skb)) {\n+\t\t\tskb-\u003emark = RXRPC_SKB_MARK_CHALLENGE;\n \t\t\tskb-\u003eskb_mstamp_ns = rx-\u003eoob_id_counter++;\n \t\t\trxrpc_get_skb(skb, rxrpc_skb_get_post_oob);\n \t\t\tskb_queue_tail(\u0026rx-\u003erecvmsg_oobq, skb);\n@@ -194,7 +196,7 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,\n \tswitch (p-\u003ecommand) {\n \tcase RXRPC_OOB_CMD_RESPOND:\n \t\tret = -EPROTO;\n-\t\tif (skb-\u003emark != RXRPC_OOB_CHALLENGE)\n+\t\tif (skb-\u003emark != RXRPC_SKB_MARK_CHALLENGE)\n \t\t\tbreak;\n \t\tconn = sp-\u003echall.conn;\n \t\tret = -EOPNOTSUPP;\n@@ -214,7 +216,8 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,\n \t}\n \n \tswitch (skb-\u003emark) {\n-\tcase RXRPC_OOB_CHALLENGE:\n+\tcase RXRPC_SKB_MARK_CHALLENGE:\n+\t\trxrpc_uncharge_async_queue(sp-\u003echall.conn-\u003elocal, skb);\n \t\trxrpc_put_connection(sp-\u003echall.conn, rxrpc_conn_put_oob);\n \t\tbreak;\n \t}\n@@ -275,10 +278,10 @@ enum rxrpc_oob_type rxrpc_kernel_query_oob(struct sk_buff *oob,\n \t\t\t\t\t unsigned long *_peer_appdata)\n {\n \tstruct rxrpc_skb_priv *sp = rxrpc_skb(oob);\n-\tenum rxrpc_oob_type type = oob-\u003emark;\n+\tenum rxrpc_oob_type type = RXRPC_OOB_CHALLENGE;\n \n-\tswitch (type) {\n-\tcase RXRPC_OOB_CHALLENGE:\n+\tswitch (oob-\u003emark) {\n+\tcase RXRPC_SKB_MARK_CHALLENGE:\n \t\t*_peer\t\t= sp-\u003echall.conn-\u003epeer;\n \t\t*_peer_appdata\t= sp-\u003echall.conn-\u003epeer-\u003eapp_data;\n \t\tbreak;\n@@ -312,7 +315,7 @@ struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,\n \n \toob = skb_dequeue(\u0026rx-\u003erecvmsg_oobq);\n \tif (oob)\n-\t\t*_type = oob-\u003emark;\n+\t\t*_type = RXRPC_OOB_CHALLENGE;\n \treturn oob;\n }\n EXPORT_SYMBOL(rxrpc_kernel_dequeue_oob);\n@@ -328,7 +331,8 @@ void rxrpc_kernel_free_oob(struct sk_buff *oob)\n \tstruct rxrpc_skb_priv *sp = rxrpc_skb(oob);\n \n \tswitch (oob-\u003emark) {\n-\tcase RXRPC_OOB_CHALLENGE:\n+\tcase RXRPC_SKB_MARK_CHALLENGE:\n+\t\trxrpc_uncharge_async_queue(sp-\u003echall.conn-\u003elocal, oob);\n \t\trxrpc_put_connection(sp-\u003echall.conn, rxrpc_conn_put_oob);\n \t\tbreak;\n \t}\ndiff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c\nindex efcba4b2e74f0..85c9562cb3790 100644\n--- a/net/rxrpc/recvmsg.c\n+++ b/net/rxrpc/recvmsg.c\n@@ -118,6 +118,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call)\n \n \tskb = skb_dequeue(\u0026call-\u003erecvmsg_queue);\n \trxrpc_see_skb(skb, rxrpc_skb_see_rotate);\n+\trxrpc_uncharge_async_queue(call-\u003elocal, skb);\n \n \tsp = rxrpc_skb(skb);\n \ttseq = sp-\u003ehdr.seq;\n@@ -248,8 +249,8 @@ static int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,\n \tif (ret \u003c 0)\n \t\treturn ret;\n \n-\tswitch ((enum rxrpc_oob_type)skb-\u003emark) {\n-\tcase RXRPC_OOB_CHALLENGE:\n+\tswitch (skb-\u003emark) {\n+\tcase RXRPC_SKB_MARK_CHALLENGE:\n \t\tneed_response = true;\n \t\tret = rxrpc_recvmsg_challenge(sock, msg, skb, flags);\n \t\tbreak;\n@@ -565,7 +566,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,\n \tgoto not_yet_complete;\n \n call_failed:\n-\trxrpc_purge_queue(\u0026call-\u003erecvmsg_queue);\n+\trxrpc_purge_data_queue(call, \u0026call-\u003erecvmsg_queue);\n call_complete:\n \tret = rxrpc_recvmsg_term(call, msg);\n \tif (ret \u003c 0)\ndiff --git a/net/rxrpc/skbuff.c b/net/rxrpc/skbuff.c\nindex e2169d1a14b5f..3b999200b6fc6 100644\n--- a/net/rxrpc/skbuff.c\n+++ b/net/rxrpc/skbuff.c\n@@ -10,6 +10,7 @@\n #include \u003clinux/module.h\u003e\n #include \u003clinux/net.h\u003e\n #include \u003clinux/skbuff.h\u003e\n+#include \u003clinux/slab.h\u003e\n #include \u003cnet/sock.h\u003e\n #include \u003cnet/af_rxrpc.h\u003e\n #include \"ar-internal.h\"\n@@ -58,6 +59,116 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)\n \t}\n }\n \n+static bool rxrpc_charge_async_queue_bytes(struct rxrpc_local *local, long size)\n+{\n+\tstruct sock *sk = local-\u003esocket-\u003esk;\n+\tlong rcvbuf;\n+\tlong queued;\n+\n+\trcvbuf = READ_ONCE(sk-\u003esk_rcvbuf);\n+\n+\tfor (;;) {\n+\t\tqueued = atomic_long_read(\u0026local-\u003erx_async_queue_bytes);\n+\t\tif (queued \u0026\u0026\n+\t\t (queued \u003e= rcvbuf || size \u003e= rcvbuf - queued)) {\n+\t\t\tsk_drops_inc(sk);\n+\t\t\treturn false;\n+\t\t}\n+\t\tif (atomic_long_cmpxchg(\u0026local-\u003erx_async_queue_bytes, queued,\n+\t\t\t\t\tqueued + size) == queued)\n+\t\t\treturn true;\n+\t}\n+}\n+\n+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb)\n+{\n+\tstruct rxrpc_async_queue_charge *charge;\n+\n+\tcharge = kzalloc(sizeof(*charge), GFP_NOFS);\n+\tif (!charge)\n+\t\treturn NULL;\n+\n+\trefcount_set(\u0026charge-\u003eref, 1);\n+\tcharge-\u003esize = skb-\u003etruesize + sizeof(*charge);\n+\treturn charge;\n+}\n+\n+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,\n+\t\t\t\t struct rxrpc_async_queue_charge *charge)\n+{\n+\tif (charge \u0026\u0026 refcount_dec_and_test(\u0026charge-\u003eref)) {\n+\t\tif (charge-\u003echarged)\n+\t\t\tatomic_long_sub(charge-\u003esize, \u0026local-\u003erx_async_queue_bytes);\n+\t\tkfree(charge);\n+\t}\n+}\n+\n+/*\n+ * Charge an skb retained outside UDP receive-memory accounting.\n+ */\n+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)\n+{\n+\tstruct rxrpc_async_queue_charge *charge = NULL;\n+\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n+\tlong size = 0;\n+\n+\tif (sp-\u003ehdr.type == RXRPC_PACKET_TYPE_DATA)\n+\t\tcharge = sp-\u003edata.charge;\n+\n+\tif (charge) {\n+\t\tbool clone = sp-\u003ehdr.flags \u0026 RXRPC_JUMBO_PACKET;\n+\n+\t\tif (!charge-\u003echarged) {\n+\t\t\tsize = charge-\u003esize;\n+\t\t\tif (clone)\n+\t\t\t\tsize += SKB_DATA_ALIGN(sizeof(struct sk_buff));\n+\t\t} else if (clone) {\n+\t\t\tsize = SKB_DATA_ALIGN(sizeof(struct sk_buff));\n+\t\t}\n+\t\tif (size \u0026\u0026 !rxrpc_charge_async_queue_bytes(local, size))\n+\t\t\treturn false;\n+\t\tcharge-\u003echarged = true;\n+\t\trefcount_inc(\u0026charge-\u003eref);\n+\t\treturn true;\n+\t}\n+\treturn rxrpc_charge_async_queue_bytes(local, (long)skb-\u003etruesize);\n+}\n+\n+/*\n+ * Release the asynchronous receive charge on an skb.\n+ */\n+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)\n+{\n+\tstruct rxrpc_async_queue_charge *charge;\n+\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n+\n+\tif (sp-\u003ehdr.type == RXRPC_PACKET_TYPE_DATA) {\n+\t\tcharge = sp-\u003edata.charge;\n+\t\tif (charge) {\n+\t\t\tsp-\u003edata.charge = NULL;\n+\t\t\tif (sp-\u003ehdr.flags \u0026 RXRPC_JUMBO_PACKET)\n+\t\t\t\tatomic_long_sub(SKB_DATA_ALIGN(sizeof(struct sk_buff)),\n+\t\t\t\t\t\t\u0026local-\u003erx_async_queue_bytes);\n+\t\t\trxrpc_put_async_queue_charge(local, charge);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\tatomic_long_sub(skb-\u003etruesize, \u0026local-\u003erx_async_queue_bytes);\n+}\n+\n+/*\n+ * Purge DATA from a call's receive queue and release its per-local charge.\n+ */\n+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list)\n+{\n+\tstruct sk_buff *skb;\n+\n+\twhile ((skb = skb_dequeue(list)) != NULL) {\n+\t\trxrpc_uncharge_async_queue(call-\u003elocal, skb);\n+\t\trxrpc_free_skb(skb, rxrpc_skb_put_purge);\n+\t}\n+}\n+\n /*\n * Clear a queue of socket buffers.\n */\n@@ -66,7 +177,15 @@ void rxrpc_purge_queue(struct sk_buff_head *list)\n \tstruct sk_buff *skb;\n \n \twhile ((skb = skb_dequeue((list))) != NULL) {\n-\t\tint n = atomic_dec_return(select_skb_count(skb));\n+\t\tint n;\n+\n+\t\tif (skb-\u003emark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED) {\n+\t\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n+\n+\t\t\trxrpc_uncharge_async_queue(sp-\u003epoke_conn-\u003elocal, skb);\n+\t\t\trxrpc_put_connection(sp-\u003epoke_conn, rxrpc_conn_put_poke);\n+\t\t}\n+\t\tn = atomic_dec_return(select_skb_count(skb));\n \t\ttrace_rxrpc_skb(skb, refcount_read(\u0026skb-\u003eusers), n,\n \t\t\t\trxrpc_skb_put_purge);\n \t\tconsume_skb(skb);\n"
} |
| 2/1 | 2026/10/17 05:02 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": [
"AF_RXRPC"
],
"FocusSymbols": [
"rxrpc_encap_rcv",
"rxrpc_charge_async_queue",
"rxrpc_uncharge_async_queue",
"rxrpc_purge_data_queue",
"rxrpc_adjust_rcvbuf",
"rxrpc_input_call_packet",
"rxrpc_recvmsg"
],
"Reasoning": "The patch introduces asynchronous receive-memory queue charging and bounds receive window accounting for RxRPC (AF_RXRPC). It adds refcounted accounting for split jumbo DATA packets, enforces socket receive buffer limits in the UDP encapsulation receive handler, and modifies packet reception, socket read, and queue purge paths. These changes alter core protocol memory tracking and refcounting in reachable network socket code, warranting fuzzing for potential leaks, underflows, or state corruption.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 32558b85243dfd8ba5a459ae7ad050597dd1e055
Author: syz-cluster <triage@syzkaller.com>
Date: Sat Oct 17 05:02:50 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 865f05fe37ab9..1f1f49eca8e11 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -50,6 +50,7 @@ struct key_preparsed_payload;
struct rxrpc_connection;
struct rxrpc_txbuf;
struct rxrpc_txqueue;
+struct rxrpc_async_queue_charge;
struct rxgk_context;
/*
@@ -222,6 +223,15 @@ struct rxrpc_host_header {
u16 serviceId; /* service ID */
} __packed;
+/*
+ * Shared asynchronous receive-memory charge for split jumbo DATA packets.
+ */
+struct rxrpc_async_queue_charge {
+ refcount_t ref;
+ long size;
+ bool charged;
+};
+
/*
* RxRPC socket buffer private variables
* - max 48 bytes (struct sk_buff::cb)
@@ -233,6 +243,11 @@ struct rxrpc_skb_priv {
u16 offset; /* Offset of data */
u16 len; /* Length of data */
};
+ struct {
+ u16 offset;
+ u16 len;
+ struct rxrpc_async_queue_charge *charge;
+ } data;
struct {
rxrpc_seq_t first_ack; /* First packet in acks table */
rxrpc_seq_t prev_ack; /* Highest seq seen */
@@ -360,6 +375,7 @@ struct rxrpc_local {
struct sk_buff_head rx_delay_queue; /* Delay injection queue */
#endif
struct sk_buff_head rx_queue; /* Received packets */
+ atomic_long_t rx_async_queue_bytes; /* Outstanding async Rx bytes */
struct list_head conn_attend_q; /* Conns requiring immediate attention */
struct list_head call_attend_q; /* Calls requiring immediate attention */
@@ -1323,6 +1339,7 @@ void rxrpc_send_version_request(struct rxrpc_local *local,
* local_object.c
*/
void rxrpc_local_dont_fragment(const struct rxrpc_local *local, bool set);
+void rxrpc_adjust_rcvbuf(struct sock *sk);
struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *);
struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *, enum rxrpc_local_trace);
struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *, enum rxrpc_local_trace);
@@ -1515,6 +1532,12 @@ void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace);
+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb);
+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,
+ struct rxrpc_async_queue_charge *charge);
+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);
+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);
+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list);
void rxrpc_purge_queue(struct sk_buff_head *);
/*
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 21be9c86d7a74..9360852604645 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -473,6 +473,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
out:
if (__rxrpc_call_is_complete(call)) {
timer_delete_sync(&call->timer);
+ rxrpc_purge_queue(&call->rx_queue);
if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
rxrpc_disconnect_call(call);
if (call->security)
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 817ed9acb91e6..8f115be491249 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -553,9 +553,9 @@ static void rxrpc_cleanup_tx_buffers(struct rxrpc_call *call)
*/
static void rxrpc_cleanup_rx_buffers(struct rxrpc_call *call)
{
- rxrpc_purge_queue(&call->recvmsg_queue);
+ rxrpc_purge_data_queue(call, &call->recvmsg_queue);
rxrpc_purge_queue(&call->rx_queue);
- rxrpc_purge_queue(&call->rx_oos_queue);
+ rxrpc_purge_data_queue(call, &call->rx_oos_queue);
kfree(call->rx_dec_buffer);
}
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
index 611c790bc6d0c..d37cef2523997 100644
--- a/net/rxrpc/conn_event.c
+++ b/net/rxrpc/conn_event.c
@@ -391,8 +391,17 @@ static void rxrpc_do_process_connection(struct rxrpc_connection *conn)
/* go through the conn-level event packets, releasing the ref on this
* connection that each one has when we've finished with it */
while ((skb = skb_dequeue(&conn->rx_queue))) {
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
rxrpc_see_skb(skb, rxrpc_skb_see_conn_work);
rxrpc_process_event(conn, skb);
+ if (skb->mark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)
+ rxrpc_uncharge_async_queue(conn->local, skb);
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_CHALLENGE && sp->chall.conn) {
+ rxrpc_put_connection(
+ sp->chall.conn,
+ rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
rxrpc_free_skb(skb, rxrpc_skb_put_conn_work);
}
}
@@ -414,15 +423,22 @@ void rxrpc_process_connection(struct work_struct *work)
* post connection-level events to the connection
* - this includes challenges, responses, some aborts and call terminal packet
* retransmission.
+ * - bound the queued memory independently of the UDP rmem charge.
*/
-static void rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,
+static bool rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,
struct sk_buff *skb)
{
+ struct rxrpc_local *local = conn->local;
+
+ if (!rxrpc_charge_async_queue(local, skb))
+ return false;
+
_enter("%p,%p", conn, skb);
rxrpc_get_skb(skb, rxrpc_skb_get_conn_work);
skb_queue_tail(&conn->rx_queue, skb);
rxrpc_queue_conn(conn, rxrpc_conn_queue_rx_work);
+ return true;
}
/*
@@ -442,7 +458,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
rxrpc_get_connection(conn, rxrpc_conn_get_challenge_input);
if (!conn->security->challenge_to_recvmsg) {
- rxrpc_post_packet_to_conn(conn, skb);
+ if (!rxrpc_post_packet_to_conn(conn, skb)) {
+ rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
return true;
}
@@ -480,8 +499,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
return false;
}
- if (!call)
- rxrpc_post_packet_to_conn(conn, skb);
+ if (!call && !rxrpc_post_packet_to_conn(conn, skb)) {
+ rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
return true;
}
diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
index 0ece717db0f85..d85345e014a9f 100644
--- a/net/rxrpc/conn_object.c
+++ b/net/rxrpc/conn_object.c
@@ -300,6 +300,19 @@ static void rxrpc_rcu_free_connection(struct rcu_head *rcu)
wake_up_var(&rxnet->nr_conns);
}
+/*
+ * Purge a connection's receive queue, updating the local queue accounting.
+ */
+static void rxrpc_purge_conn_queue(struct rxrpc_connection *conn)
+{
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(&conn->rx_queue))) {
+ rxrpc_uncharge_async_queue(conn->local, skb);
+ rxrpc_free_skb(skb, rxrpc_skb_put_purge);
+ }
+}
+
/*
* Clean up a dead connection.
*/
@@ -329,7 +342,7 @@ static void rxrpc_clean_up_connection(struct work_struct *work)
conn->peer->pmtud_pending = true;
}
- rxrpc_purge_queue(&conn->rx_queue);
+ rxrpc_purge_conn_queue(conn);
rxrpc_free_skb(conn->tx_response, rxrpc_skb_put_response);
rxrpc_kill_client_conn(conn);
@@ -338,15 +351,15 @@ static void rxrpc_clean_up_connection(struct work_struct *work)
key_put(conn->key);
rxrpc_put_bundle(conn->bundle, rxrpc_bundle_put_conn);
rxrpc_put_peer(conn->peer, rxrpc_peer_put_conn);
- rxrpc_put_local(conn->local, rxrpc_local_put_kill_conn);
/* Drain the Rx queue. Note that even though we've unpublished, an
* incoming packet could still be being added to our Rx queue, so we
* will need to drain it again in the RCU cleanup handler.
*/
- rxrpc_purge_queue(&conn->rx_queue);
+ rxrpc_purge_conn_queue(conn);
page_frag_cache_drain(&conn->tx_data_alloc);
+ rxrpc_put_local(conn->local, rxrpc_local_put_kill_conn);
call_rcu(&conn->rcu, rxrpc_rcu_free_connection);
}
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 73cafe6bfa9f5..6f0ba50097390 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -479,7 +479,9 @@ static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,
* Process a DATA packet.
*/
static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
- bool *_notify, rxrpc_serial_t *_ack_serial, int *_ack_reason)
+ bool *_notify, rxrpc_serial_t *_ack_serial,
+ int *_ack_reason,
+ struct rxrpc_async_queue_charge **_charge)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
struct sk_buff *oos;
@@ -487,9 +489,13 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
unsigned int sack = call->ackr_sack_base;
rxrpc_seq_t window = call->ackr_window;
rxrpc_seq_t wtop = call->ackr_wtop;
- rxrpc_seq_t wlimit = window + call->rx_winsize - 1;
+ /* Bound queued DATA by the application's receive window. */
+ rxrpc_seq_t wlimit = smp_load_acquire(&call->rx_consumed) +
+ call->rx_winsize;
rxrpc_seq_t seq = sp->hdr.seq;
bool last = sp->hdr.flags & RXRPC_LAST_PACKET;
+ bool set_last = false;
+ unsigned int slot = 0;
int ack_reason = -1;
rxrpc_inc_stat(call->rxnet, stat_rx_data);
@@ -498,10 +504,24 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
if (sp->hdr.flags & RXRPC_JUMBO_PACKET)
rxrpc_inc_stat(call->rxnet, stat_rx_data_jumbo);
+ if (after(seq, call->rx_highest_seq))
+ call->rx_highest_seq = seq;
+
+ trace_rxrpc_rx_data(call->debug_id, seq, serial, sp->hdr.flags);
+
+ if (after(seq, wlimit)) {
+ ack_reason = RXRPC_ACK_EXCEEDS_WINDOW;
+ goto send_ack;
+ }
+
if (last) {
- if (test_and_set_bit(RXRPC_CALL_RX_LAST, &call->flags) &&
- seq + 1 != wtop)
- return rxrpc_proto_abort(call, seq, rxrpc_eproto_different_last);
+ if (test_and_set_bit(RXRPC_CALL_RX_LAST, &call->flags)) {
+ if (seq + 1 != wtop)
+ return rxrpc_proto_abort(call, seq,
+ rxrpc_eproto_different_last);
+ } else {
+ set_last = true;
+ }
} else {
if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) &&
after_eq(seq, wtop)) {
@@ -511,17 +531,33 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
}
}
- if (after(seq, call->rx_highest_seq))
- call->rx_highest_seq = seq;
-
- trace_rxrpc_rx_data(call->debug_id, seq, serial, sp->hdr.flags);
-
if (before(seq, window)) {
ack_reason = RXRPC_ACK_DUPLICATE;
goto send_ack;
}
- if (after(seq, wlimit)) {
- ack_reason = RXRPC_ACK_EXCEEDS_WINDOW;
+
+ if (seq != window) {
+ slot = seq - window;
+ sack = (sack + slot) % RXRPC_SACK_SIZE;
+
+ if (call->ackr_sack_table[sack]) {
+ ack_reason = RXRPC_ACK_DUPLICATE;
+ goto send_ack;
+ }
+ }
+
+ sp->data.charge = NULL;
+ if (sp->offset != sizeof(struct rxrpc_wire_header) ||
+ (sp->hdr.flags & RXRPC_JUMBO_PACKET)) {
+ if (!*_charge)
+ *_charge = rxrpc_alloc_async_queue_charge(skb);
+ sp->data.charge = *_charge;
+ }
+ if (!rxrpc_charge_async_queue(call->local, skb)) {
+ sp->data.charge = NULL;
+ if (set_last)
+ clear_bit(RXRPC_CALL_RX_LAST, &call->flags);
+ ack_reason = RXRPC_ACK_NOSPACE;
goto send_ack;
}
@@ -568,19 +604,8 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
call->ackr_sack_base = sack;
} else {
- unsigned int slot;
-
ack_reason = RXRPC_ACK_OUT_OF_SEQUENCE;
-
- slot = seq - window;
- sack = (sack + slot) % RXRPC_SACK_SIZE;
-
- if (call->ackr_sack_table[sack % RXRPC_SACK_SIZE]) {
- ack_reason = RXRPC_ACK_DUPLICATE;
- goto send_ack;
- }
-
- call->ackr_sack_table[sack % RXRPC_SACK_SIZE] |= 1;
+ call->ackr_sack_table[sack] |= 1;
trace_rxrpc_sack(call, seq, sack, rxrpc_sack_oos);
if (after(seq + 1, wtop)) {
@@ -623,6 +648,7 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
*/
static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)
{
+ struct rxrpc_async_queue_charge *charge = NULL;
struct rxrpc_jumbo_header jhdr;
struct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp;
struct sk_buff *jskb;
@@ -644,13 +670,15 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
jskb = skb_clone(skb, GFP_NOFS);
if (!jskb) {
kdebug("couldn't clone");
+ rxrpc_put_async_queue_charge(call->local, charge);
return false;
}
rxrpc_new_skb(jskb, rxrpc_skb_new_jumbo_subpacket);
jsp = rxrpc_skb(jskb);
jsp->offset = offset;
jsp->len = RXRPC_JUMBO_DATALEN;
- rxrpc_input_data_one(call, jskb, ¬ify, &ack_serial, &ack_reason);
+ rxrpc_input_data_one(call, jskb, ¬ify, &ack_serial, &ack_reason,
+ &charge);
rxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket);
sp->hdr.flags = jhdr.flags;
@@ -664,7 +692,8 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
sp->offset = offset;
sp->len = len;
- rxrpc_input_data_one(call, skb, ¬ify, &ack_serial, &ack_reason);
+ rxrpc_input_data_one(call, skb, ¬ify, &ack_serial, &ack_reason,
+ &charge);
stat_ix = umin(count, ARRAY_SIZE(call->rxnet->stat_rx_jumbo)) - 1;
atomic_inc(&call->rxnet->stat_rx_jumbo[stat_ix]);
@@ -681,9 +710,11 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
trace_rxrpc_notify_socket(call->debug_id, sp->hdr.serial);
rxrpc_notify_socket(call);
}
+ rxrpc_put_async_queue_charge(call->local, charge);
return true;
protocol_error:
+ rxrpc_put_async_queue_charge(call->local, charge);
return false;
}
diff --git a/net/rxrpc/io_thread.c b/net/rxrpc/io_thread.c
index dc5184a2fa9d1..8679402c03e1b 100644
--- a/net/rxrpc/io_thread.c
+++ b/net/rxrpc/io_thread.c
@@ -7,12 +7,37 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <net/udp.h>
+
#include "ar-internal.h"
static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,
struct sockaddr_rxrpc *peer_srx,
struct sk_buff *skb);
+/*
+ * Drop UDP rmem ownership for packets charged in encap_rcv().
+ * sk_forward_alloc is serialised by sk_receive_queue.lock.
+ */
+static void rxrpc_skb_orphan_udp(struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+
+ if (!sk)
+ return;
+
+ spin_lock_bh(&sk->sk_receive_queue.lock);
+ skb_orphan(skb);
+ spin_unlock_bh(&sk->sk_receive_queue.lock);
+}
+
+static void rxrpc_encap_rcv_drop(struct sock *udp_sk, struct sk_buff *skb,
+ enum skb_drop_reason reason)
+{
+ sk_drops_inc(udp_sk);
+ sk_skb_reason_drop(udp_sk, skb, reason);
+}
+
/*
* handle data received on the local endpoint
* - may be called in interrupt context
@@ -28,6 +53,10 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
struct sk_buff_head *rx_queue;
struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk);
struct task_struct *io_thread;
+ enum skb_drop_reason reason;
+ unsigned int headroom;
+ unsigned int rcvbuf;
+ unsigned int rmem;
if (unlikely(!local)) {
kfree_skb(skb);
@@ -41,8 +70,6 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
if (skb->tstamp == 0)
skb->tstamp = ktime_get_real();
- skb->mark = RXRPC_SKB_MARK_PACKET;
- rxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);
rx_queue = &local->rx_queue;
#ifdef CONFIG_AF_RXRPC_INJECT_RX_DELAY
if (rxrpc_inject_rx_delay ||
@@ -52,9 +79,36 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
}
#endif
+ headroom = SKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;
+ spin_lock(&udp_sk->sk_receive_queue.lock);
+ rxrpc_adjust_rcvbuf(udp_sk);
+ rcvbuf = READ_ONCE(udp_sk->sk_rcvbuf);
+ rmem = atomic_read(&udp_sk->sk_rmem_alloc);
+ /* Permit one skb when there is no receive memory charged, as UDP does. */
+ if (rmem && rmem + skb->truesize + headroom >= rcvbuf) {
+ reason = SKB_DROP_REASON_SOCKET_RCVBUFF;
+ goto drop;
+ }
+ if (!sk_rmem_schedule(udp_sk, skb, skb->truesize)) {
+ reason = SKB_DROP_REASON_PROTO_MEM;
+ goto drop;
+ }
+
+ skb->dev = NULL;
+ skb_set_owner_r(skb, udp_sk);
+ spin_unlock(&udp_sk->sk_receive_queue.lock);
+ skb_dst_drop(skb);
+
+ skb->mark = RXRPC_SKB_MARK_PACKET;
+ rxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);
skb_queue_tail(rx_queue, skb);
wake_up_process(io_thread);
return 0;
+
+drop:
+ spin_unlock(&udp_sk->sk_receive_queue.lock);
+ rxrpc_encap_rcv_drop(udp_sk, skb, reason);
+ return 0;
}
/*
@@ -471,6 +525,11 @@ int rxrpc_io_thread(void *data)
/* Distribute packets and errors. */
while ((skb = __skb_dequeue(&rx_queue))) {
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ if (skb->mark == RXRPC_SKB_MARK_PACKET)
+ rxrpc_skb_orphan_udp(skb);
+ else if (skb->mark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED)
+ rxrpc_uncharge_async_queue(sp->poke_conn->local, skb);
switch (skb->mark) {
case RXRPC_SKB_MARK_PACKET:
skb->priority = 0;
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index 169f9dfdaa77f..8e43f77d43683 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -22,6 +22,19 @@
static void rxrpc_local_rcu(struct rcu_head *);
+void rxrpc_adjust_rcvbuf(struct sock *sk)
+{
+ u32 rcvbuf, old_rcvbuf;
+
+ rcvbuf = READ_ONCE(rxrpc_rx_window_size) *
+ SKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;
+ rcvbuf += rcvbuf / 4;
+ rcvbuf = min_t(u32, rcvbuf, READ_ONCE(sysctl_rmem_max));
+ old_rcvbuf = READ_ONCE(sk->sk_rcvbuf);
+ if (rcvbuf > old_rcvbuf)
+ WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
+}
+
/*
* Handle an ICMP/ICMP6 error turning up at the tunnel. Push it through the
* usual mechanism so that it gets parsed and presented through the UDP
@@ -124,6 +137,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct net *net,
skb_queue_head_init(&local->rx_delay_queue);
#endif
skb_queue_head_init(&local->rx_queue);
+ atomic_long_set(&local->rx_async_queue_bytes, 0);
INIT_LIST_HEAD(&local->conn_attend_q);
INIT_LIST_HEAD(&local->call_attend_q);
@@ -198,6 +212,9 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
/* set the socket up */
usk = local->socket->sk;
+ spin_lock_bh(&usk->sk_receive_queue.lock);
+ rxrpc_adjust_rcvbuf(usk);
+ spin_unlock_bh(&usk->sk_receive_queue.lock);
usk->sk_error_report = rxrpc_error_report;
switch (srx->transport.family) {
@@ -437,8 +454,8 @@ void rxrpc_destroy_local(struct rxrpc_local *local)
if (socket) {
local->socket = NULL;
kernel_sock_shutdown(socket, SHUT_RDWR);
- socket->sk->sk_user_data = NULL;
- sock_release(socket);
+ rcu_assign_sk_user_data(socket->sk, NULL);
+ synchronize_rcu();
}
/* At this point, there should be no more packets coming in to the
@@ -448,6 +465,10 @@ void rxrpc_destroy_local(struct rxrpc_local *local)
rxrpc_purge_queue(&local->rx_delay_queue);
#endif
rxrpc_purge_queue(&local->rx_queue);
+
+ if (socket)
+ sock_release(socket);
+
rxrpc_purge_client_connections(local);
page_frag_cache_drain(&local->tx_alloc);
}
diff --git a/net/rxrpc/oob.c b/net/rxrpc/oob.c
index c80ee2487d094..e3d135b12d22d 100644
--- a/net/rxrpc/oob.c
+++ b/net/rxrpc/oob.c
@@ -46,7 +46,9 @@ bool rxrpc_notify_socket_oob(struct rxrpc_call *call, struct sk_buff *skb)
sk = &rx->sk;
spin_lock_irq(&rx->recvmsg_lock);
- if (sk->sk_state < RXRPC_CLOSE) {
+ if (sk->sk_state < RXRPC_CLOSE &&
+ rxrpc_charge_async_queue(sp->chall.conn->local, skb)) {
+ skb->mark = RXRPC_SKB_MARK_CHALLENGE;
skb->skb_mstamp_ns = rx->oob_id_counter++;
rxrpc_get_skb(skb, rxrpc_skb_get_post_oob);
skb_queue_tail(&rx->recvmsg_oobq, skb);
@@ -194,7 +196,7 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,
switch (p->command) {
case RXRPC_OOB_CMD_RESPOND:
ret = -EPROTO;
- if (skb->mark != RXRPC_OOB_CHALLENGE)
+ if (skb->mark != RXRPC_SKB_MARK_CHALLENGE)
break;
conn = sp->chall.conn;
ret = -EOPNOTSUPP;
@@ -214,7 +216,8 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,
}
switch (skb->mark) {
- case RXRPC_OOB_CHALLENGE:
+ case RXRPC_SKB_MARK_CHALLENGE:
+ rxrpc_uncharge_async_queue(sp->chall.conn->local, skb);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
@@ -275,10 +278,10 @@ enum rxrpc_oob_type rxrpc_kernel_query_oob(struct sk_buff *oob,
unsigned long *_peer_appdata)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(oob);
- enum rxrpc_oob_type type = oob->mark;
+ enum rxrpc_oob_type type = RXRPC_OOB_CHALLENGE;
- switch (type) {
- case RXRPC_OOB_CHALLENGE:
+ switch (oob->mark) {
+ case RXRPC_SKB_MARK_CHALLENGE:
*_peer = sp->chall.conn->peer;
*_peer_appdata = sp->chall.conn->peer->app_data;
break;
@@ -312,7 +315,7 @@ struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,
oob = skb_dequeue(&rx->recvmsg_oobq);
if (oob)
- *_type = oob->mark;
+ *_type = RXRPC_OOB_CHALLENGE;
return oob;
}
EXPORT_SYMBOL(rxrpc_kernel_dequeue_oob);
@@ -328,7 +331,8 @@ void rxrpc_kernel_free_oob(struct sk_buff *oob)
struct rxrpc_skb_priv *sp = rxrpc_skb(oob);
switch (oob->mark) {
- case RXRPC_OOB_CHALLENGE:
+ case RXRPC_SKB_MARK_CHALLENGE:
+ rxrpc_uncharge_async_queue(sp->chall.conn->local, oob);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index efcba4b2e74f0..85c9562cb3790 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -118,6 +118,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call)
skb = skb_dequeue(&call->recvmsg_queue);
rxrpc_see_skb(skb, rxrpc_skb_see_rotate);
+ rxrpc_uncharge_async_queue(call->local, skb);
sp = rxrpc_skb(skb);
tseq = sp->hdr.seq;
@@ -248,8 +249,8 @@ static int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,
if (ret < 0)
return ret;
- switch ((enum rxrpc_oob_type)skb->mark) {
- case RXRPC_OOB_CHALLENGE:
+ switch (skb->mark) {
+ case RXRPC_SKB_MARK_CHALLENGE:
need_response = true;
ret = rxrpc_recvmsg_challenge(sock, msg, skb, flags);
break;
@@ -565,7 +566,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
goto not_yet_complete;
call_failed:
- rxrpc_purge_queue(&call->recvmsg_queue);
+ rxrpc_purge_data_queue(call, &call->recvmsg_queue);
call_complete:
ret = rxrpc_recvmsg_term(call, msg);
if (ret < 0)
diff --git a/net/rxrpc/skbuff.c b/net/rxrpc/skbuff.c
index e2169d1a14b5f..3b999200b6fc6 100644
--- a/net/rxrpc/skbuff.c
+++ b/net/rxrpc/skbuff.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/net.h>
#include <linux/skbuff.h>
+#include <linux/slab.h>
#include <net/sock.h>
#include <net/af_rxrpc.h>
#include "ar-internal.h"
@@ -58,6 +59,116 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
}
}
+static bool rxrpc_charge_async_queue_bytes(struct rxrpc_local *local, long size)
+{
+ struct sock *sk = local->socket->sk;
+ long rcvbuf;
+ long queued;
+
+ rcvbuf = READ_ONCE(sk->sk_rcvbuf);
+
+ for (;;) {
+ queued = atomic_long_read(&local->rx_async_queue_bytes);
+ if (queued &&
+ (queued >= rcvbuf || size >= rcvbuf - queued)) {
+ sk_drops_inc(sk);
+ return false;
+ }
+ if (atomic_long_cmpxchg(&local->rx_async_queue_bytes, queued,
+ queued + size) == queued)
+ return true;
+ }
+}
+
+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge;
+
+ charge = kzalloc(sizeof(*charge), GFP_NOFS);
+ if (!charge)
+ return NULL;
+
+ refcount_set(&charge->ref, 1);
+ charge->size = skb->truesize + sizeof(*charge);
+ return charge;
+}
+
+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,
+ struct rxrpc_async_queue_charge *charge)
+{
+ if (charge && refcount_dec_and_test(&charge->ref)) {
+ if (charge->charged)
+ atomic_long_sub(charge->size, &local->rx_async_queue_bytes);
+ kfree(charge);
+ }
+}
+
+/*
+ * Charge an skb retained outside UDP receive-memory accounting.
+ */
+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge = NULL;
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+ long size = 0;
+
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA)
+ charge = sp->data.charge;
+
+ if (charge) {
+ bool clone = sp->hdr.flags & RXRPC_JUMBO_PACKET;
+
+ if (!charge->charged) {
+ size = charge->size;
+ if (clone)
+ size += SKB_DATA_ALIGN(sizeof(struct sk_buff));
+ } else if (clone) {
+ size = SKB_DATA_ALIGN(sizeof(struct sk_buff));
+ }
+ if (size && !rxrpc_charge_async_queue_bytes(local, size))
+ return false;
+ charge->charged = true;
+ refcount_inc(&charge->ref);
+ return true;
+ }
+ return rxrpc_charge_async_queue_bytes(local, (long)skb->truesize);
+}
+
+/*
+ * Release the asynchronous receive charge on an skb.
+ */
+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge;
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA) {
+ charge = sp->data.charge;
+ if (charge) {
+ sp->data.charge = NULL;
+ if (sp->hdr.flags & RXRPC_JUMBO_PACKET)
+ atomic_long_sub(SKB_DATA_ALIGN(sizeof(struct sk_buff)),
+ &local->rx_async_queue_bytes);
+ rxrpc_put_async_queue_charge(local, charge);
+ return;
+ }
+ }
+ atomic_long_sub(skb->truesize, &local->rx_async_queue_bytes);
+}
+
+/*
+ * Purge DATA from a call's receive queue and release its per-local charge.
+ */
+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list)
+{
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(list)) != NULL) {
+ rxrpc_uncharge_async_queue(call->local, skb);
+ rxrpc_free_skb(skb, rxrpc_skb_put_purge);
+ }
+}
+
/*
* Clear a queue of socket buffers.
*/
@@ -66,7 +177,15 @@ void rxrpc_purge_queue(struct sk_buff_head *list)
struct sk_buff *skb;
while ((skb = skb_dequeue((list))) != NULL) {
- int n = atomic_dec_return(select_skb_count(skb));
+ int n;
+
+ if (skb->mark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED) {
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ rxrpc_uncharge_async_queue(sp->poke_conn->local, skb);
+ rxrpc_put_connection(sp->poke_conn, rxrpc_conn_put_poke);
+ }
+ n = atomic_dec_return(select_skb_count(skb));
trace_rxrpc_skb(skb, refcount_read(&skb->users), n,
rxrpc_skb_put_purge);
consume_skb(skb);
|
| 3/2 | 2026/10/17 05:02 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14074 output: 34 thoughts: 819 Thoughts: **RxRPC Receive Memory Accounting Review** Okay, let's dive into this patch. My initial thought is to understand the scope, and it's clear we're dealing with `net/rxrpc/`, specifically the AF_RXRPC socket protocol. That immediately grabs my attention because RxRPC is a real, live network socket family (AF_RXRPC = 33), and I know it's accessible via user-space `socket(AF_RXRPC, ...)` calls. Syzkaller's been hammering this, generating the standard socket calls: `sendmsg`, `recvmsg`, the whole shebang. So, yes, this is absolutely reachable in standard environments. Now, let's get into the nitty-gritty of the changes. The patch modifies a significant chunk of the RxRPC code: `ar-internal.h`, `call_event.c`, `call_object.c`, `conn_event.c`, `conn_object.c`, `input.c`, `io_thread.c`, `local_object.c`, `oob.c`, `recvmsg.c`, and `skbuff.c`. That's a lot of core logic touched! Looking at the code, it's all about receive-memory accounting. Specifically, this patch implements memory charging for asynchronous queues (`rxrpc_async_queue_charge`, etc.) and UDP rmem handling, which involves scheduling, dropping packets due to rcvbuf limits (`sk_rmem_schedule`, `skb_set_owner_r`), orphaning UDP skbs when pulled from `local->rx_queue` by the io_thread (`rxrpc_skb_orphan_udp`), shared memory charge for jumbo packets, bounding queued DATA by the application's receive window, properly purging queues (with uncharging via `rxrpc_purge_data_queue`, etc.), and handling marks and OOB challenge packets (`RXRPC_SKB_MARK_CHALLENGE`). Also, there's `rxrpc_adjust_rcvbuf`. Essentially, it's a major restructuring of core socket buffer lifecycle: skb ownership is being altered, refcounting is involved (`refcount_t ref`), memory accounting is being changed, queue purging is happening, and the packet processing logic is being updated. This hits the very heart of how RxRPC handles incoming data and manages its memory. This is complex and critical! Given that RxRPC is reachable through user-space socket operations (creating `socket(AF_RXRPC, ...)`, binding, sending UDP packets to rxrpc ports, recvmsg, etc.), this is absolutely worth fuzzing. Memory accounting, refcounting (`refcount_set`, `refcount_inc`, `refcount_dec_and_test`), skb queueing/dequeuing, and memory limits are classic regression magnets and often the source of memory leaks, use-after-free conditions, double-frees, underflows, deadlocks, and assertion failures. We need to be especially careful about these changes because any errors could trigger memory corruption vulnerabilities. Next step, check that Kconfig option for `AF_RXRPC`. Need to ensure this can be enabled. I'll use `grepper` to find this. |
| 4/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "config AF_RXRPC",
"PathPrefixes": [
"net/rxrpc/Kconfig"
]
}Results: {
"Output": "net/rxrpc/Kconfig-5-\nnet/rxrpc/Kconfig:6:config AF_RXRPC\nnet/rxrpc/Kconfig-7-\ttristate \"RxRPC session sockets\"\n--\nnet/rxrpc/Kconfig=25=if AF_RXRPC\nnet/rxrpc/Kconfig-26-\nnet/rxrpc/Kconfig:27:config AF_RXRPC_IPV6\nnet/rxrpc/Kconfig-28-\tbool \"IPv6 support for RxRPC\"\n--\nnet/rxrpc/Kconfig-33-\nnet/rxrpc/Kconfig:34:config AF_RXRPC_INJECT_LOSS\nnet/rxrpc/Kconfig-35-\tbool \"Inject packet loss into RxRPC packet stream\"\n--\nnet/rxrpc/Kconfig-39-\nnet/rxrpc/Kconfig:40:config AF_RXRPC_INJECT_RX_DELAY\nnet/rxrpc/Kconfig-41-\tbool \"Inject delay into packet reception\"\n--\nnet/rxrpc/Kconfig-49-\nnet/rxrpc/Kconfig:50:config AF_RXRPC_DEBUG\nnet/rxrpc/Kconfig-51-\tbool \"RxRPC dynamic debugging\"\n--\nnet/rxrpc/Kconfig=89=config RXPERF\n--\nnet/rxrpc/Kconfig-95-\nnet/rxrpc/Kconfig:96:config AF_RXRPC_KUNIT_TEST\nnet/rxrpc/Kconfig-97-\ttristate \"RxRPC crypto KUnit test\" if !KUNIT_ALL_TESTS\n"
} |
| 5/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16017 output: 33 thoughts: 24 Thoughts: Okay, let's dive into this. Here's my thought process on what we're looking at, expert-to-expert: **Analyzing the rxrpc Kconfig Dependencies** Alright, I need to understand the dependencies for `net/rxrpc/Kconfig`. That's where all the configuration options for RxRPC live, so knowing what other features *enable* RxRPC is crucial. I'm going to jump directly into the source code, specifically around lines 5 through 25, to see what options might be required or dependent on other kernel components. I'll be looking for `depends on` statements, `select` statements, or anything else that defines the build requirements and relationships to other features within the kernel config. This is the quickest way to get a solid grasp of how RxRPC fits into the broader kernel ecosystem and avoid any build or runtime issues. Knowing these dependencies upfront is key for proper integration and configuration. |
| 6/2 | 2026/10/17 05:03 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/Kconfig",
"FirstLine": 1,
"LineCount": 30
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\t#\n 3:\t# RxRPC session sockets\n 4:\t#\n 5:\t\n 6:\tconfig AF_RXRPC\n 7:\t\ttristate \"RxRPC session sockets\"\n 8:\t\tdepends on INET\n 9:\t\tselect CRYPTO\n 10:\t\tselect CRYPTO_LIB_DES if RXKAD\n 11:\t\tselect KEYS\n 12:\t\tselect NET_UDP_TUNNEL\n 13:\t\thelp\n 14:\t\t Say Y or M here to include support for RxRPC session sockets (just\n 15:\t\t the transport part, not the presentation part: (un)marshalling is\n 16:\t\t left to the application).\n 17:\t\n 18:\t\t These are used for AFS kernel filesystem and userspace utilities.\n 19:\t\n 20:\t\t This module at the moment only supports client operations and is\n 21:\t\t currently incomplete.\n 22:\t\n 23:\t\t See Documentation/networking/rxrpc.rst.\n 24:\t\n 25:\tif AF_RXRPC\n 26:\t\n 27:\tconfig AF_RXRPC_IPV6\n 28:\t\tbool \"IPv6 support for RxRPC\"\n 29:\t\tdepends on IPV6\n 30:\t\thelp\n"
} |
| 7/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16626 output: 34 thoughts: 149 Thoughts: Okay, let's break this down. **RX-RPC Dependencies and Input Handling** Right, so `AF_RXRPC` is clearly built on top of `INET`. That makes sense. The key configuration variable is `CONFIG_AF_RXRPC`, which I'll need to remember for build configurations. Now, I need to get a better handle on the changes. Time to review the added or modified symbols: `rxrpc_encap_rcv`, `rxrpc_io_thread`, and `rxrpc_input_data_one`. I already suspect that `rxrpc_input_data_one` might be static, I really need to check *who* is calling it. Is it being called from `rxrpc_input_packet`, `rxrpc_input_split_jumbo`, or `rxrpc_input_data`? I'll need to trace those function calls. Let's start by digging into `net/rxrpc/input.c` and focusing on the surrounding code of `rxrpc_input_data_one`. That should give me the immediate context. |
| 8/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_input_data_one",
"PathPrefixes": [
"net/rxrpc/"
]
}Results: {
"Output": "net/rxrpc/input.c=456=static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-480- */\nnet/rxrpc/input.c:481:static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\nnet/rxrpc/input.c-482-\t\t\t\t bool *_notify, rxrpc_serial_t *_ack_serial,\n--\nnet/rxrpc/input.c=649=static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-679-\t\tjsp-\u003elen = RXRPC_JUMBO_DATALEN;\nnet/rxrpc/input.c:680:\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-681-\t\t\t\t \u0026charge);\n--\nnet/rxrpc/input.c-694-\tsp-\u003elen = len;\nnet/rxrpc/input.c:695:\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-696-\t\t\t \u0026charge);\n"
} |
| 9/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17410 output: 35 thoughts: 20 Thoughts: Here's a summary of my thought process: **Investigating the Call Sites of `rxrpc_input_split_jumbo`** Okay, so I need to understand where `rxrpc_input_split_jumbo` is being used. This function name strongly suggests a role in handling large packets within the RxRPC (Remote Procedure Call) input processing. To truly grasp its significance and potential impact, I need to know where it's being *called* from. I need to trace its call sites to see what parts of the RxRPC stack depend on it and how. Let's dig in and find those calls. |
| 10/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_input_split_jumbo",
"PathPrefixes": [
"net/rxrpc/"
]
}Results: {
"Output": "net/rxrpc/input.c=481=static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-648- */\nnet/rxrpc/input.c:649:static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-650-{\n--\nnet/rxrpc/input.c=725=static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-764-\nnet/rxrpc/input.c:765:\tif (!rxrpc_input_split_jumbo(call, skb)) {\nnet/rxrpc/input.c-766-\t\trxrpc_proto_abort(call, sp-\u003ehdr.seq, rxrpc_badmsg_bad_jumbo);\n"
} |
| 11/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17855 output: 33 thoughts: 12 Thoughts: Okay, here's my summary, presented as a stream of thought: **Tracing the Usage of `rxrpc_input_data`** Alright, let's get down to brass tacks. I need to figure out where `rxrpc_input_data` is actually being *used*. It's a key variable, presumably related to input within the RXRPC framework, and understanding its call chain is essential for grasping its role and impact. Where exactly is this thing getting invoked within the code? I need to track down all the call sites to get the bigger picture. This will clarify how this input data influences the overall system's behavior and performance. Gotta dive into the code and start searching... let's see what I can uncover. |
| 12/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_input_data\\(",
"PathPrefixes": [
"net/rxrpc/"
]
}Results: {
"Output": "net/rxrpc/input.c=649=static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-724- */\nnet/rxrpc/input.c:725:static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-726-{\n--\nnet/rxrpc/input.c=1294=void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-1317-\tcase RXRPC_PACKET_TYPE_DATA:\nnet/rxrpc/input.c:1318:\t\treturn rxrpc_input_data(call, skb);\nnet/rxrpc/input.c-1319-\n--\nnet/rxrpc/recvmsg.c=108=static void rxrpc_rotate_rx_window(struct rxrpc_call *call)\n--\nnet/rxrpc/recvmsg.c-127-\nnet/rxrpc/recvmsg.c:128:\t/* Barrier against rxrpc_input_data(). */\nnet/rxrpc/recvmsg.c-129-\tif (after(tseq, call-\u003erx_consumed))\n"
} |
| 13/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18405 output: 36 thoughts: 1078 Thoughts: **Analyzing RxRPC Symbol Exposure** Okay, so I'm digging into `rxrpc_input_call_packet` which is a visible symbol in `net/rxrpc/input.c`. My initial thought is to identify other non-static functions related to this one, in the interest of understanding the surface area of the change. Let's see what's being touched or added. In `net/rxrpc/skbuff.c`, I see a cluster of new functions: `rxrpc_charge_async_queue`, `rxrpc_uncharge_async_queue`, `rxrpc_alloc_async_queue_charge`, `rxrpc_put_async_queue_charge`, and `rxrpc_purge_data_queue`, plus a modified `rxrpc_purge_queue`. It's clear that there's new async memory management here. Then in `net/rxrpc/local_object.c`, `rxrpc_adjust_rcvbuf` (exported in `ar-internal.h`) and a modified `rxrpc_destroy_local` are also in the picture. The receive buffer adjustment is interesting. Moving on, in `net/rxrpc/io_thread.c`, I've got `rxrpc_encap_rcv` and `rxrpc_io_thread`. The encapsulation callback is an entry point, which might be critical. Next up, `net/rxrpc/recvmsg.c` introduces `rxrpc_recvmsg`. That's the socket receive path, so I should see how data is consumed. In `net/rxrpc/conn_event.c` I see `rxrpc_process_connection` which deals with connection events, then in `net/rxrpc/call_event.c` is the associated `rxrpc_input_call_event`. And finally, `net/rxrpc/oob.c` has a set of functions: `rxrpc_notify_socket_oob`, `rxrpc_kernel_query_oob`, `rxrpc_kernel_dequeue_oob`, and `rxrpc_kernel_free_oob`. Now, considering the goal is to define FocusSymbols, let's assess these functions against those criteria: target specific feature logic, avoid general hot-paths, and focus on specific non-ubiquitous kernel functions. We need to handle static inline functions in headers as well. Here's the breakdown, starting with what I feel are the most important entrypoints for further investigation. * `rxrpc_encap_rcv`: This handles the UDP encapsulation receive callback, where packets enter. This is where I'd expect to find the new receive buffer check and `sk_rmem_schedule` interactions. Seems like a clear entrypoint for new logic. * `rxrpc_charge_async_queue`: This implements the memory charging logic for async queues. This is very new, so it makes sense to focus on it. * `rxrpc_uncharge_async_queue`: The complementary function releasing charges. Equally important. * `rxrpc_input_call_packet`: Processes incoming packets *on* a call. This is the starting point for handling data packets, which might invoke `rxrpc_input_data`, `rxrpc_input_split_jumbo`, and `rxrpc_input_data_one`. * `rxrpc_purge_data_queue`: Purging data queue and uncharging async memory, so also of interest. * `rxrpc_adjust_rcvbuf`: Adjusting the socket receive buffer. This may have an impact in the allocation of memory. * `rxrpc_recvmsg`: This represents the socket receive path. It has an impact on the rotation and uncharging, and so I need to understand it. I'll double-check `rxrpc_purge_conn_queue`, even though it's static in `conn_object.c`. It's called from `rxrpc_clean_up_connection`. That's useful information. Likewise, `rxrpc_input_data` is static in `input.c` but called from `rxrpc_input_call_packet`. Also `rxrpc_io_thread`, the kernel thread function that processes rx\_queue. Now I'll just confirm these symbols exist in the tree. Looks like I have: * `rxrpc_charge_async_queue`: Defined in `net/rxrpc/skbuff.c` line 107. * `rxrpc_uncharge_async_queue`: Defined in `net/rxrpc/skbuff.c` line 138. * `rxrpc_encap_rcv`: Defined in `net/rxrpc |
| 14/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "^void rxrpc_input_call_packet",
"PathPrefixes": [
"net/rxrpc/"
]
}Results: {
"Output": "net/rxrpc/ar-internal.h=1261=void rxrpc_congestion_degrade(struct rxrpc_call *);\nnet/rxrpc/ar-internal.h:1262:void rxrpc_input_call_packet(struct rxrpc_call *, struct sk_buff *);\nnet/rxrpc/ar-internal.h-1263-void rxrpc_implicit_end_call(struct rxrpc_call *, struct sk_buff *);\n--\nnet/rxrpc/input.c=1281=static void rxrpc_input_abort(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-1293- */\nnet/rxrpc/input.c:1294:void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-1295-{\n"
} |
| 15/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20780 output: 34 thoughts: 46 Thoughts: Okay, here's my take on those thoughts, framed as my own: **Investigating Non-Static RXRPC Symbols** Alright, so `rxrpc_input_call_packet` is confirmed as a non-static symbol. That's good to know, solidifies what I was thinking. Now, I need to understand why it's structured this way, what other symbols share this trait, and any implications. My next step is to nail down the same information for `rxrpc_io_thread`. Let's dig into the code… specifically, the `net/rxrpc/io_thread.c` file. Time to dive in and see what's happening there with the I/O thread, and whether it's similarly exposed, and if so, what the design decisions behind that might have been. |
| 16/2 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "^int rxrpc_io_thread",
"PathPrefixes": [
"net/rxrpc/"
]
}Results: {
"Output": "net/rxrpc/ar-internal.h=1298=bool rxrpc_direct_conn_abort(struct sk_buff *skb, enum rxrpc_abort_reason why,\nnet/rxrpc/ar-internal.h-1299-\t\t\t s32 abort_code, int err);\nnet/rxrpc/ar-internal.h:1300:int rxrpc_io_thread(void *data);\nnet/rxrpc/ar-internal.h-1301-void rxrpc_post_response(struct rxrpc_connection *conn, struct sk_buff *skb);\n--\nnet/rxrpc/io_thread.c=381=static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,\n--\nnet/rxrpc/io_thread.c-483- */\nnet/rxrpc/io_thread.c:484:int rxrpc_io_thread(void *data)\nnet/rxrpc/io_thread.c-485-{\n"
} |
| 17/2 | 2026/10/17 05:03 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21292 output: 203 thoughts: 1059 Thoughts: **Analysis of RxRPC Async Receive Memory Queue Patch** Okay, let's break this down. First, I need to confirm the relevant configurations. Since this patch touches `rxrpc_open_socket` and `net/rxrpc/` code, enabling `CONFIG_AF_RXRPC` is definitely the core requirement. We should also check for dependencies like `INET`, which is likely, given typical Syzkaller config behavior. Listing `AF_RXRPC` is non-negotiable here. Now for the patch itself. It's focused on introducing a bounded async receive memory queue for RxRPC. The core of this logic looks like this: 1. We have `rxrpc_encap_rcv()` charging UDP receive memory. 2. `rxrpc_io_thread()` unbinds/orphans UDP skbs or uncharges the async queue. 3. `rxrpc_input_data_one()` bounds the queued data and charges the async queue. This part uses `rxrpc_charge_async_queue()` and `rxrpc_alloc_async_queue_charge()`. 4. Window management functions like `rxrpc_rotate_rx_window()` and queue purges (`rxrpc_purge_data_queue`) uncharge the async queue via `rxrpc_uncharge_async_queue()`. 5. OOB (out-of-band) handling also involves charging and uncharging. This whole thing is exposed through standard RxRPC socket operations over loopback or UDP. This is ripe for fuzzing. Why? Because the memory accounting and reference counting within this system are classic sources of errors, especially with scenarios like packet drops, aborts, duplicates, out-of-sequence packets, or premature socket closures. The interaction between memory management (`local->rx_async_queue_bytes`) and potential race conditions between receive and I/O threads also worries me. We need to be testing the window management and how it interacts with `recvmsg` and the IO thread/softirq. Jumbo packet splitting with its shared, refcounted charge (`struct rxrpc_async_queue_charge`) is another area of concern. So, fuzzing is definitely *worthwhile* here. We've got a list of focus symbols: `rxrpc_encap_rcv`, `rxrpc_charge_async_queue`, `rxrpc_uncharge_async_queue`, `rxrpc_input_call_packet`, `rxrpc_recvmsg`, `rxrpc_adjust_rcvbuf`, and `rxrpc_purge_data_queue`. The only config we need to enable is "AF_RXRPC." Finally, sanity check time. I need to make sure those focus symbols are valid. Quick look at the source shows that they all look good - non-static, exposed functions in `net/rxrpc/` and all present in the kernel. Alright, that's everything. Time to `set-results`. |
| 18/2 | 2026/10/17 05:03 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"AF_RXRPC"
],
"FocusSymbols": [
"rxrpc_encap_rcv",
"rxrpc_charge_async_queue",
"rxrpc_uncharge_async_queue",
"rxrpc_purge_data_queue",
"rxrpc_adjust_rcvbuf",
"rxrpc_input_call_packet",
"rxrpc_recvmsg"
],
"Reasoning": "The patch introduces asynchronous receive-memory queue charging and bounds receive window accounting for RxRPC (AF_RXRPC). It adds refcounted accounting for split jumbo DATA packets, enforces socket receive buffer limits in the UDP encapsulation receive handler, and modifies packet reception, socket read, and queue purge paths. These changes alter core protocol memory tracking and refcounting in reachable network socket code, warranting fuzzing for potential leaks, underflows, or state corruption.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"AF_RXRPC"
],
"FocusSymbols": [
"rxrpc_encap_rcv",
"rxrpc_charge_async_queue",
"rxrpc_uncharge_async_queue",
"rxrpc_purge_data_queue",
"rxrpc_adjust_rcvbuf",
"rxrpc_input_call_packet",
"rxrpc_recvmsg"
],
"Reasoning": "The patch introduces asynchronous receive-memory queue charging and bounds receive window accounting for RxRPC (AF_RXRPC). It adds refcounted accounting for split jumbo DATA packets, enforces socket receive buffer limits in the UDP encapsulation receive handler, and modifies packet reception, socket read, and queue purge paths. These changes alter core protocol memory tracking and refcounting in reachable network socket code, warranting fuzzing for potential leaks, underflows, or state corruption.",
"WorthFuzzing": true
} |
| 19/1 | 2026/10/17 05:03 | action | If |
2mArgs:{
"WorthFuzzing": true
}Results: null |
| 20/2 | 2026/10/17 05:03 | agent | kmsan-evaluator |
2mModel:core Args: null Results: {
"KMSANReasoning": "The patch series introduces asynchronous receive-memory accounting (rx_async_queue_bytes) and per-connection/per-call queue charge management for RxRPC, including `struct rxrpc_async_queue_charge` to handle split jumbo packets, rmem scheduling in UDP encap_rcv, and receive window bounding.\n\n- KMSAN Applicability: KMSAN detects reads of uninitialized memory and information leaks to user space. In this patch, all newly allocated structures (`struct rxrpc_async_queue_charge`) are allocated using `kzalloc()`, all local variables (such as `reason` in `rxrpc_encap_rcv()` and `slot` / `set_last` in `rxrpc_input_data_one()`) are explicitly initialized before use, and `sp-\u003edata.charge` is explicitly initialized prior to being accessed. No uninitialized memory or structure padding is exposed or copied to user space. Thus, there are no uninitialized memory risks that KMSAN would uniquely detect.\n\n- KASAN \u0026 Standard Sanitizers Applicability: The changes primarily involve reference counting (`charge-\u003eref`, connection refcounts), socket locking (`sk_receive_queue.lock`), atomic accounting (`rx_async_queue_bytes`), and skb queue lifecycle management. Potential bugs in these areas (such as use-after-free, double free, refcount underflow/leak, or locking deadlocks) are already covered by KASAN, refcount_t hardening, and LOCKDEP.\n\nTherefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 32558b85243dfd8ba5a459ae7ad050597dd1e055
Author: syz-cluster <triage@syzkaller.com>
Date: Sat Oct 17 05:02:50 2026 +0000
syz-cluster: applied patch under review
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 865f05fe37ab9..1f1f49eca8e11 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -50,6 +50,7 @@ struct key_preparsed_payload;
struct rxrpc_connection;
struct rxrpc_txbuf;
struct rxrpc_txqueue;
+struct rxrpc_async_queue_charge;
struct rxgk_context;
/*
@@ -222,6 +223,15 @@ struct rxrpc_host_header {
u16 serviceId; /* service ID */
} __packed;
+/*
+ * Shared asynchronous receive-memory charge for split jumbo DATA packets.
+ */
+struct rxrpc_async_queue_charge {
+ refcount_t ref;
+ long size;
+ bool charged;
+};
+
/*
* RxRPC socket buffer private variables
* - max 48 bytes (struct sk_buff::cb)
@@ -233,6 +243,11 @@ struct rxrpc_skb_priv {
u16 offset; /* Offset of data */
u16 len; /* Length of data */
};
+ struct {
+ u16 offset;
+ u16 len;
+ struct rxrpc_async_queue_charge *charge;
+ } data;
struct {
rxrpc_seq_t first_ack; /* First packet in acks table */
rxrpc_seq_t prev_ack; /* Highest seq seen */
@@ -360,6 +375,7 @@ struct rxrpc_local {
struct sk_buff_head rx_delay_queue; /* Delay injection queue */
#endif
struct sk_buff_head rx_queue; /* Received packets */
+ atomic_long_t rx_async_queue_bytes; /* Outstanding async Rx bytes */
struct list_head conn_attend_q; /* Conns requiring immediate attention */
struct list_head call_attend_q; /* Calls requiring immediate attention */
@@ -1323,6 +1339,7 @@ void rxrpc_send_version_request(struct rxrpc_local *local,
* local_object.c
*/
void rxrpc_local_dont_fragment(const struct rxrpc_local *local, bool set);
+void rxrpc_adjust_rcvbuf(struct sock *sk);
struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *);
struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *, enum rxrpc_local_trace);
struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *, enum rxrpc_local_trace);
@@ -1515,6 +1532,12 @@ void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace);
void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace);
+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb);
+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,
+ struct rxrpc_async_queue_charge *charge);
+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);
+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb);
+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list);
void rxrpc_purge_queue(struct sk_buff_head *);
/*
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 21be9c86d7a74..9360852604645 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -473,6 +473,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
out:
if (__rxrpc_call_is_complete(call)) {
timer_delete_sync(&call->timer);
+ rxrpc_purge_queue(&call->rx_queue);
if (!test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
rxrpc_disconnect_call(call);
if (call->security)
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 817ed9acb91e6..8f115be491249 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -553,9 +553,9 @@ static void rxrpc_cleanup_tx_buffers(struct rxrpc_call *call)
*/
static void rxrpc_cleanup_rx_buffers(struct rxrpc_call *call)
{
- rxrpc_purge_queue(&call->recvmsg_queue);
+ rxrpc_purge_data_queue(call, &call->recvmsg_queue);
rxrpc_purge_queue(&call->rx_queue);
- rxrpc_purge_queue(&call->rx_oos_queue);
+ rxrpc_purge_data_queue(call, &call->rx_oos_queue);
kfree(call->rx_dec_buffer);
}
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
index 611c790bc6d0c..d37cef2523997 100644
--- a/net/rxrpc/conn_event.c
+++ b/net/rxrpc/conn_event.c
@@ -391,8 +391,17 @@ static void rxrpc_do_process_connection(struct rxrpc_connection *conn)
/* go through the conn-level event packets, releasing the ref on this
* connection that each one has when we've finished with it */
while ((skb = skb_dequeue(&conn->rx_queue))) {
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
rxrpc_see_skb(skb, rxrpc_skb_see_conn_work);
rxrpc_process_event(conn, skb);
+ if (skb->mark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)
+ rxrpc_uncharge_async_queue(conn->local, skb);
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_CHALLENGE && sp->chall.conn) {
+ rxrpc_put_connection(
+ sp->chall.conn,
+ rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
rxrpc_free_skb(skb, rxrpc_skb_put_conn_work);
}
}
@@ -414,15 +423,22 @@ void rxrpc_process_connection(struct work_struct *work)
* post connection-level events to the connection
* - this includes challenges, responses, some aborts and call terminal packet
* retransmission.
+ * - bound the queued memory independently of the UDP rmem charge.
*/
-static void rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,
+static bool rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,
struct sk_buff *skb)
{
+ struct rxrpc_local *local = conn->local;
+
+ if (!rxrpc_charge_async_queue(local, skb))
+ return false;
+
_enter("%p,%p", conn, skb);
rxrpc_get_skb(skb, rxrpc_skb_get_conn_work);
skb_queue_tail(&conn->rx_queue, skb);
rxrpc_queue_conn(conn, rxrpc_conn_queue_rx_work);
+ return true;
}
/*
@@ -442,7 +458,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
rxrpc_get_connection(conn, rxrpc_conn_get_challenge_input);
if (!conn->security->challenge_to_recvmsg) {
- rxrpc_post_packet_to_conn(conn, skb);
+ if (!rxrpc_post_packet_to_conn(conn, skb)) {
+ rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
return true;
}
@@ -480,8 +499,10 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
return false;
}
- if (!call)
- rxrpc_post_packet_to_conn(conn, skb);
+ if (!call && !rxrpc_post_packet_to_conn(conn, skb)) {
+ rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);
+ sp->chall.conn = NULL;
+ }
return true;
}
diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
index 0ece717db0f85..d85345e014a9f 100644
--- a/net/rxrpc/conn_object.c
+++ b/net/rxrpc/conn_object.c
@@ -300,6 +300,19 @@ static void rxrpc_rcu_free_connection(struct rcu_head *rcu)
wake_up_var(&rxnet->nr_conns);
}
+/*
+ * Purge a connection's receive queue, updating the local queue accounting.
+ */
+static void rxrpc_purge_conn_queue(struct rxrpc_connection *conn)
+{
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(&conn->rx_queue))) {
+ rxrpc_uncharge_async_queue(conn->local, skb);
+ rxrpc_free_skb(skb, rxrpc_skb_put_purge);
+ }
+}
+
/*
* Clean up a dead connection.
*/
@@ -329,7 +342,7 @@ static void rxrpc_clean_up_connection(struct work_struct *work)
conn->peer->pmtud_pending = true;
}
- rxrpc_purge_queue(&conn->rx_queue);
+ rxrpc_purge_conn_queue(conn);
rxrpc_free_skb(conn->tx_response, rxrpc_skb_put_response);
rxrpc_kill_client_conn(conn);
@@ -338,15 +351,15 @@ static void rxrpc_clean_up_connection(struct work_struct *work)
key_put(conn->key);
rxrpc_put_bundle(conn->bundle, rxrpc_bundle_put_conn);
rxrpc_put_peer(conn->peer, rxrpc_peer_put_conn);
- rxrpc_put_local(conn->local, rxrpc_local_put_kill_conn);
/* Drain the Rx queue. Note that even though we've unpublished, an
* incoming packet could still be being added to our Rx queue, so we
* will need to drain it again in the RCU cleanup handler.
*/
- rxrpc_purge_queue(&conn->rx_queue);
+ rxrpc_purge_conn_queue(conn);
page_frag_cache_drain(&conn->tx_data_alloc);
+ rxrpc_put_local(conn->local, rxrpc_local_put_kill_conn);
call_rcu(&conn->rcu, rxrpc_rcu_free_connection);
}
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 73cafe6bfa9f5..6f0ba50097390 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -479,7 +479,9 @@ static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,
* Process a DATA packet.
*/
static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
- bool *_notify, rxrpc_serial_t *_ack_serial, int *_ack_reason)
+ bool *_notify, rxrpc_serial_t *_ack_serial,
+ int *_ack_reason,
+ struct rxrpc_async_queue_charge **_charge)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
struct sk_buff *oos;
@@ -487,9 +489,13 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
unsigned int sack = call->ackr_sack_base;
rxrpc_seq_t window = call->ackr_window;
rxrpc_seq_t wtop = call->ackr_wtop;
- rxrpc_seq_t wlimit = window + call->rx_winsize - 1;
+ /* Bound queued DATA by the application's receive window. */
+ rxrpc_seq_t wlimit = smp_load_acquire(&call->rx_consumed) +
+ call->rx_winsize;
rxrpc_seq_t seq = sp->hdr.seq;
bool last = sp->hdr.flags & RXRPC_LAST_PACKET;
+ bool set_last = false;
+ unsigned int slot = 0;
int ack_reason = -1;
rxrpc_inc_stat(call->rxnet, stat_rx_data);
@@ -498,10 +504,24 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
if (sp->hdr.flags & RXRPC_JUMBO_PACKET)
rxrpc_inc_stat(call->rxnet, stat_rx_data_jumbo);
+ if (after(seq, call->rx_highest_seq))
+ call->rx_highest_seq = seq;
+
+ trace_rxrpc_rx_data(call->debug_id, seq, serial, sp->hdr.flags);
+
+ if (after(seq, wlimit)) {
+ ack_reason = RXRPC_ACK_EXCEEDS_WINDOW;
+ goto send_ack;
+ }
+
if (last) {
- if (test_and_set_bit(RXRPC_CALL_RX_LAST, &call->flags) &&
- seq + 1 != wtop)
- return rxrpc_proto_abort(call, seq, rxrpc_eproto_different_last);
+ if (test_and_set_bit(RXRPC_CALL_RX_LAST, &call->flags)) {
+ if (seq + 1 != wtop)
+ return rxrpc_proto_abort(call, seq,
+ rxrpc_eproto_different_last);
+ } else {
+ set_last = true;
+ }
} else {
if (test_bit(RXRPC_CALL_RX_LAST, &call->flags) &&
after_eq(seq, wtop)) {
@@ -511,17 +531,33 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
}
}
- if (after(seq, call->rx_highest_seq))
- call->rx_highest_seq = seq;
-
- trace_rxrpc_rx_data(call->debug_id, seq, serial, sp->hdr.flags);
-
if (before(seq, window)) {
ack_reason = RXRPC_ACK_DUPLICATE;
goto send_ack;
}
- if (after(seq, wlimit)) {
- ack_reason = RXRPC_ACK_EXCEEDS_WINDOW;
+
+ if (seq != window) {
+ slot = seq - window;
+ sack = (sack + slot) % RXRPC_SACK_SIZE;
+
+ if (call->ackr_sack_table[sack]) {
+ ack_reason = RXRPC_ACK_DUPLICATE;
+ goto send_ack;
+ }
+ }
+
+ sp->data.charge = NULL;
+ if (sp->offset != sizeof(struct rxrpc_wire_header) ||
+ (sp->hdr.flags & RXRPC_JUMBO_PACKET)) {
+ if (!*_charge)
+ *_charge = rxrpc_alloc_async_queue_charge(skb);
+ sp->data.charge = *_charge;
+ }
+ if (!rxrpc_charge_async_queue(call->local, skb)) {
+ sp->data.charge = NULL;
+ if (set_last)
+ clear_bit(RXRPC_CALL_RX_LAST, &call->flags);
+ ack_reason = RXRPC_ACK_NOSPACE;
goto send_ack;
}
@@ -568,19 +604,8 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
call->ackr_sack_base = sack;
} else {
- unsigned int slot;
-
ack_reason = RXRPC_ACK_OUT_OF_SEQUENCE;
-
- slot = seq - window;
- sack = (sack + slot) % RXRPC_SACK_SIZE;
-
- if (call->ackr_sack_table[sack % RXRPC_SACK_SIZE]) {
- ack_reason = RXRPC_ACK_DUPLICATE;
- goto send_ack;
- }
-
- call->ackr_sack_table[sack % RXRPC_SACK_SIZE] |= 1;
+ call->ackr_sack_table[sack] |= 1;
trace_rxrpc_sack(call, seq, sack, rxrpc_sack_oos);
if (after(seq + 1, wtop)) {
@@ -623,6 +648,7 @@ static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,
*/
static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)
{
+ struct rxrpc_async_queue_charge *charge = NULL;
struct rxrpc_jumbo_header jhdr;
struct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp;
struct sk_buff *jskb;
@@ -644,13 +670,15 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
jskb = skb_clone(skb, GFP_NOFS);
if (!jskb) {
kdebug("couldn't clone");
+ rxrpc_put_async_queue_charge(call->local, charge);
return false;
}
rxrpc_new_skb(jskb, rxrpc_skb_new_jumbo_subpacket);
jsp = rxrpc_skb(jskb);
jsp->offset = offset;
jsp->len = RXRPC_JUMBO_DATALEN;
- rxrpc_input_data_one(call, jskb, ¬ify, &ack_serial, &ack_reason);
+ rxrpc_input_data_one(call, jskb, ¬ify, &ack_serial, &ack_reason,
+ &charge);
rxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket);
sp->hdr.flags = jhdr.flags;
@@ -664,7 +692,8 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
sp->offset = offset;
sp->len = len;
- rxrpc_input_data_one(call, skb, ¬ify, &ack_serial, &ack_reason);
+ rxrpc_input_data_one(call, skb, ¬ify, &ack_serial, &ack_reason,
+ &charge);
stat_ix = umin(count, ARRAY_SIZE(call->rxnet->stat_rx_jumbo)) - 1;
atomic_inc(&call->rxnet->stat_rx_jumbo[stat_ix]);
@@ -681,9 +710,11 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb
trace_rxrpc_notify_socket(call->debug_id, sp->hdr.serial);
rxrpc_notify_socket(call);
}
+ rxrpc_put_async_queue_charge(call->local, charge);
return true;
protocol_error:
+ rxrpc_put_async_queue_charge(call->local, charge);
return false;
}
diff --git a/net/rxrpc/io_thread.c b/net/rxrpc/io_thread.c
index dc5184a2fa9d1..8679402c03e1b 100644
--- a/net/rxrpc/io_thread.c
+++ b/net/rxrpc/io_thread.c
@@ -7,12 +7,37 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <net/udp.h>
+
#include "ar-internal.h"
static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,
struct sockaddr_rxrpc *peer_srx,
struct sk_buff *skb);
+/*
+ * Drop UDP rmem ownership for packets charged in encap_rcv().
+ * sk_forward_alloc is serialised by sk_receive_queue.lock.
+ */
+static void rxrpc_skb_orphan_udp(struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+
+ if (!sk)
+ return;
+
+ spin_lock_bh(&sk->sk_receive_queue.lock);
+ skb_orphan(skb);
+ spin_unlock_bh(&sk->sk_receive_queue.lock);
+}
+
+static void rxrpc_encap_rcv_drop(struct sock *udp_sk, struct sk_buff *skb,
+ enum skb_drop_reason reason)
+{
+ sk_drops_inc(udp_sk);
+ sk_skb_reason_drop(udp_sk, skb, reason);
+}
+
/*
* handle data received on the local endpoint
* - may be called in interrupt context
@@ -28,6 +53,10 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
struct sk_buff_head *rx_queue;
struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk);
struct task_struct *io_thread;
+ enum skb_drop_reason reason;
+ unsigned int headroom;
+ unsigned int rcvbuf;
+ unsigned int rmem;
if (unlikely(!local)) {
kfree_skb(skb);
@@ -41,8 +70,6 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
if (skb->tstamp == 0)
skb->tstamp = ktime_get_real();
- skb->mark = RXRPC_SKB_MARK_PACKET;
- rxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);
rx_queue = &local->rx_queue;
#ifdef CONFIG_AF_RXRPC_INJECT_RX_DELAY
if (rxrpc_inject_rx_delay ||
@@ -52,9 +79,36 @@ int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)
}
#endif
+ headroom = SKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;
+ spin_lock(&udp_sk->sk_receive_queue.lock);
+ rxrpc_adjust_rcvbuf(udp_sk);
+ rcvbuf = READ_ONCE(udp_sk->sk_rcvbuf);
+ rmem = atomic_read(&udp_sk->sk_rmem_alloc);
+ /* Permit one skb when there is no receive memory charged, as UDP does. */
+ if (rmem && rmem + skb->truesize + headroom >= rcvbuf) {
+ reason = SKB_DROP_REASON_SOCKET_RCVBUFF;
+ goto drop;
+ }
+ if (!sk_rmem_schedule(udp_sk, skb, skb->truesize)) {
+ reason = SKB_DROP_REASON_PROTO_MEM;
+ goto drop;
+ }
+
+ skb->dev = NULL;
+ skb_set_owner_r(skb, udp_sk);
+ spin_unlock(&udp_sk->sk_receive_queue.lock);
+ skb_dst_drop(skb);
+
+ skb->mark = RXRPC_SKB_MARK_PACKET;
+ rxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);
skb_queue_tail(rx_queue, skb);
wake_up_process(io_thread);
return 0;
+
+drop:
+ spin_unlock(&udp_sk->sk_receive_queue.lock);
+ rxrpc_encap_rcv_drop(udp_sk, skb, reason);
+ return 0;
}
/*
@@ -471,6 +525,11 @@ int rxrpc_io_thread(void *data)
/* Distribute packets and errors. */
while ((skb = __skb_dequeue(&rx_queue))) {
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ if (skb->mark == RXRPC_SKB_MARK_PACKET)
+ rxrpc_skb_orphan_udp(skb);
+ else if (skb->mark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED)
+ rxrpc_uncharge_async_queue(sp->poke_conn->local, skb);
switch (skb->mark) {
case RXRPC_SKB_MARK_PACKET:
skb->priority = 0;
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index 169f9dfdaa77f..8e43f77d43683 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -22,6 +22,19 @@
static void rxrpc_local_rcu(struct rcu_head *);
+void rxrpc_adjust_rcvbuf(struct sock *sk)
+{
+ u32 rcvbuf, old_rcvbuf;
+
+ rcvbuf = READ_ONCE(rxrpc_rx_window_size) *
+ SKB_TRUESIZE(RXRPC_JUMBO(1)) * 2;
+ rcvbuf += rcvbuf / 4;
+ rcvbuf = min_t(u32, rcvbuf, READ_ONCE(sysctl_rmem_max));
+ old_rcvbuf = READ_ONCE(sk->sk_rcvbuf);
+ if (rcvbuf > old_rcvbuf)
+ WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
+}
+
/*
* Handle an ICMP/ICMP6 error turning up at the tunnel. Push it through the
* usual mechanism so that it gets parsed and presented through the UDP
@@ -124,6 +137,7 @@ static struct rxrpc_local *rxrpc_alloc_local(struct net *net,
skb_queue_head_init(&local->rx_delay_queue);
#endif
skb_queue_head_init(&local->rx_queue);
+ atomic_long_set(&local->rx_async_queue_bytes, 0);
INIT_LIST_HEAD(&local->conn_attend_q);
INIT_LIST_HEAD(&local->call_attend_q);
@@ -198,6 +212,9 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
/* set the socket up */
usk = local->socket->sk;
+ spin_lock_bh(&usk->sk_receive_queue.lock);
+ rxrpc_adjust_rcvbuf(usk);
+ spin_unlock_bh(&usk->sk_receive_queue.lock);
usk->sk_error_report = rxrpc_error_report;
switch (srx->transport.family) {
@@ -437,8 +454,8 @@ void rxrpc_destroy_local(struct rxrpc_local *local)
if (socket) {
local->socket = NULL;
kernel_sock_shutdown(socket, SHUT_RDWR);
- socket->sk->sk_user_data = NULL;
- sock_release(socket);
+ rcu_assign_sk_user_data(socket->sk, NULL);
+ synchronize_rcu();
}
/* At this point, there should be no more packets coming in to the
@@ -448,6 +465,10 @@ void rxrpc_destroy_local(struct rxrpc_local *local)
rxrpc_purge_queue(&local->rx_delay_queue);
#endif
rxrpc_purge_queue(&local->rx_queue);
+
+ if (socket)
+ sock_release(socket);
+
rxrpc_purge_client_connections(local);
page_frag_cache_drain(&local->tx_alloc);
}
diff --git a/net/rxrpc/oob.c b/net/rxrpc/oob.c
index c80ee2487d094..e3d135b12d22d 100644
--- a/net/rxrpc/oob.c
+++ b/net/rxrpc/oob.c
@@ -46,7 +46,9 @@ bool rxrpc_notify_socket_oob(struct rxrpc_call *call, struct sk_buff *skb)
sk = &rx->sk;
spin_lock_irq(&rx->recvmsg_lock);
- if (sk->sk_state < RXRPC_CLOSE) {
+ if (sk->sk_state < RXRPC_CLOSE &&
+ rxrpc_charge_async_queue(sp->chall.conn->local, skb)) {
+ skb->mark = RXRPC_SKB_MARK_CHALLENGE;
skb->skb_mstamp_ns = rx->oob_id_counter++;
rxrpc_get_skb(skb, rxrpc_skb_get_post_oob);
skb_queue_tail(&rx->recvmsg_oobq, skb);
@@ -194,7 +196,7 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,
switch (p->command) {
case RXRPC_OOB_CMD_RESPOND:
ret = -EPROTO;
- if (skb->mark != RXRPC_OOB_CHALLENGE)
+ if (skb->mark != RXRPC_SKB_MARK_CHALLENGE)
break;
conn = sp->chall.conn;
ret = -EOPNOTSUPP;
@@ -214,7 +216,8 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,
}
switch (skb->mark) {
- case RXRPC_OOB_CHALLENGE:
+ case RXRPC_SKB_MARK_CHALLENGE:
+ rxrpc_uncharge_async_queue(sp->chall.conn->local, skb);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
@@ -275,10 +278,10 @@ enum rxrpc_oob_type rxrpc_kernel_query_oob(struct sk_buff *oob,
unsigned long *_peer_appdata)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(oob);
- enum rxrpc_oob_type type = oob->mark;
+ enum rxrpc_oob_type type = RXRPC_OOB_CHALLENGE;
- switch (type) {
- case RXRPC_OOB_CHALLENGE:
+ switch (oob->mark) {
+ case RXRPC_SKB_MARK_CHALLENGE:
*_peer = sp->chall.conn->peer;
*_peer_appdata = sp->chall.conn->peer->app_data;
break;
@@ -312,7 +315,7 @@ struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,
oob = skb_dequeue(&rx->recvmsg_oobq);
if (oob)
- *_type = oob->mark;
+ *_type = RXRPC_OOB_CHALLENGE;
return oob;
}
EXPORT_SYMBOL(rxrpc_kernel_dequeue_oob);
@@ -328,7 +331,8 @@ void rxrpc_kernel_free_oob(struct sk_buff *oob)
struct rxrpc_skb_priv *sp = rxrpc_skb(oob);
switch (oob->mark) {
- case RXRPC_OOB_CHALLENGE:
+ case RXRPC_SKB_MARK_CHALLENGE:
+ rxrpc_uncharge_async_queue(sp->chall.conn->local, oob);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index efcba4b2e74f0..85c9562cb3790 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -118,6 +118,7 @@ static void rxrpc_rotate_rx_window(struct rxrpc_call *call)
skb = skb_dequeue(&call->recvmsg_queue);
rxrpc_see_skb(skb, rxrpc_skb_see_rotate);
+ rxrpc_uncharge_async_queue(call->local, skb);
sp = rxrpc_skb(skb);
tseq = sp->hdr.seq;
@@ -248,8 +249,8 @@ static int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,
if (ret < 0)
return ret;
- switch ((enum rxrpc_oob_type)skb->mark) {
- case RXRPC_OOB_CHALLENGE:
+ switch (skb->mark) {
+ case RXRPC_SKB_MARK_CHALLENGE:
need_response = true;
ret = rxrpc_recvmsg_challenge(sock, msg, skb, flags);
break;
@@ -565,7 +566,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
goto not_yet_complete;
call_failed:
- rxrpc_purge_queue(&call->recvmsg_queue);
+ rxrpc_purge_data_queue(call, &call->recvmsg_queue);
call_complete:
ret = rxrpc_recvmsg_term(call, msg);
if (ret < 0)
diff --git a/net/rxrpc/skbuff.c b/net/rxrpc/skbuff.c
index e2169d1a14b5f..3b999200b6fc6 100644
--- a/net/rxrpc/skbuff.c
+++ b/net/rxrpc/skbuff.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/net.h>
#include <linux/skbuff.h>
+#include <linux/slab.h>
#include <net/sock.h>
#include <net/af_rxrpc.h>
#include "ar-internal.h"
@@ -58,6 +59,116 @@ void rxrpc_free_skb(struct sk_buff *skb, enum rxrpc_skb_trace why)
}
}
+static bool rxrpc_charge_async_queue_bytes(struct rxrpc_local *local, long size)
+{
+ struct sock *sk = local->socket->sk;
+ long rcvbuf;
+ long queued;
+
+ rcvbuf = READ_ONCE(sk->sk_rcvbuf);
+
+ for (;;) {
+ queued = atomic_long_read(&local->rx_async_queue_bytes);
+ if (queued &&
+ (queued >= rcvbuf || size >= rcvbuf - queued)) {
+ sk_drops_inc(sk);
+ return false;
+ }
+ if (atomic_long_cmpxchg(&local->rx_async_queue_bytes, queued,
+ queued + size) == queued)
+ return true;
+ }
+}
+
+struct rxrpc_async_queue_charge *rxrpc_alloc_async_queue_charge(struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge;
+
+ charge = kzalloc(sizeof(*charge), GFP_NOFS);
+ if (!charge)
+ return NULL;
+
+ refcount_set(&charge->ref, 1);
+ charge->size = skb->truesize + sizeof(*charge);
+ return charge;
+}
+
+void rxrpc_put_async_queue_charge(struct rxrpc_local *local,
+ struct rxrpc_async_queue_charge *charge)
+{
+ if (charge && refcount_dec_and_test(&charge->ref)) {
+ if (charge->charged)
+ atomic_long_sub(charge->size, &local->rx_async_queue_bytes);
+ kfree(charge);
+ }
+}
+
+/*
+ * Charge an skb retained outside UDP receive-memory accounting.
+ */
+bool rxrpc_charge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge = NULL;
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+ long size = 0;
+
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA)
+ charge = sp->data.charge;
+
+ if (charge) {
+ bool clone = sp->hdr.flags & RXRPC_JUMBO_PACKET;
+
+ if (!charge->charged) {
+ size = charge->size;
+ if (clone)
+ size += SKB_DATA_ALIGN(sizeof(struct sk_buff));
+ } else if (clone) {
+ size = SKB_DATA_ALIGN(sizeof(struct sk_buff));
+ }
+ if (size && !rxrpc_charge_async_queue_bytes(local, size))
+ return false;
+ charge->charged = true;
+ refcount_inc(&charge->ref);
+ return true;
+ }
+ return rxrpc_charge_async_queue_bytes(local, (long)skb->truesize);
+}
+
+/*
+ * Release the asynchronous receive charge on an skb.
+ */
+void rxrpc_uncharge_async_queue(struct rxrpc_local *local, struct sk_buff *skb)
+{
+ struct rxrpc_async_queue_charge *charge;
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA) {
+ charge = sp->data.charge;
+ if (charge) {
+ sp->data.charge = NULL;
+ if (sp->hdr.flags & RXRPC_JUMBO_PACKET)
+ atomic_long_sub(SKB_DATA_ALIGN(sizeof(struct sk_buff)),
+ &local->rx_async_queue_bytes);
+ rxrpc_put_async_queue_charge(local, charge);
+ return;
+ }
+ }
+ atomic_long_sub(skb->truesize, &local->rx_async_queue_bytes);
+}
+
+/*
+ * Purge DATA from a call's receive queue and release its per-local charge.
+ */
+void rxrpc_purge_data_queue(struct rxrpc_call *call, struct sk_buff_head *list)
+{
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(list)) != NULL) {
+ rxrpc_uncharge_async_queue(call->local, skb);
+ rxrpc_free_skb(skb, rxrpc_skb_put_purge);
+ }
+}
+
/*
* Clear a queue of socket buffers.
*/
@@ -66,7 +177,15 @@ void rxrpc_purge_queue(struct sk_buff_head *list)
struct sk_buff *skb;
while ((skb = skb_dequeue((list))) != NULL) {
- int n = atomic_dec_return(select_skb_count(skb));
+ int n;
+
+ if (skb->mark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED) {
+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+
+ rxrpc_uncharge_async_queue(sp->poke_conn->local, skb);
+ rxrpc_put_connection(sp->poke_conn, rxrpc_conn_put_poke);
+ }
+ n = atomic_dec_return(select_skb_count(skb));
trace_rxrpc_skb(skb, refcount_read(&skb->users), n,
rxrpc_skb_put_purge);
consume_skb(skb);
|
| 21/3 | 2026/10/17 05:03 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 13286 output: 39 thoughts: 581 Thoughts: **KMSAN Assessment: RxRPC Patch** Okay, let's break this down. My goal is to determine if this patch introduces any risks related to uninitialized memory that *require* KMSAN. Standard KASAN builds, with their suite of checks, should catch the usual suspects – memory corruption, use-after-free, etc. KMSAN is for the *uninitialized* memory edge cases. The rule is clear: KMSAN is a last resort; if KASAN or other standard tools will catch it, we don't need KMSAN. So, the criteria I need to consider for flagging `NeedsKMSAN=true` are: kernel structures sent to userspace with potential uninitialized fields, conditional logic on uninitialized variables, complex data structure initialization with later reads of uninitialized fields, or vulnerabilities that would allow uninitialized buffer accesses. Conversely, if stack/heap structures are zeroed or initialized, or if the risk is limited to out-of-bounds accesses, null pointer dereferences, or locking issues, we're likely good without KMSAN (`NeedsKMSAN=false`). Now, let's look at the patch itself. It's touching `net/rxrpc/ar-internal.h`. I see that it adds a `struct rxrpc_async_queue_charge`. I need to remember the purpose of this struct and where it's used. More significantly, it also changes the `struct rxrpc_skb_priv`, adding a nested struct `data`. This nested struct has a pointer, `struct rxrpc_async_queue_charge *charge`. This is where I'll focus my attention. It looks like it could be a place for errors. I'll need to check the declaration of `rxrpc_skb_priv` within `net/rxrpc/ar-internal.h` and investigate where these structures are initialized, used, copied, and passed between kernel and user space. This looks like the critical area to determine if there are any risks. The `charge` pointer could be the culprit if not properly initialized. This requires careful review of the patch, the surrounding code, and a good understanding of the RxRPC subsystem. |
| 22/3 | 2026/10/17 05:03 | tool | grepper |
0mArgs:{
"Expression": "struct rxrpc_skb_priv",
"PathPrefixes": [
"net/rxrpc/ar-internal.h"
]
}Results: {
"Output": "net/rxrpc/ar-internal.h=229=struct rxrpc_async_queue_charge {\n--\nnet/rxrpc/ar-internal.h-238- */\nnet/rxrpc/ar-internal.h:239:struct rxrpc_skb_priv {\nnet/rxrpc/ar-internal.h-240-\tunion {\n--\nnet/rxrpc/ar-internal.h-274-\nnet/rxrpc/ar-internal.h:275:#define rxrpc_skb(__skb) ((struct rxrpc_skb_priv *) \u0026(__skb)-\u003ecb)\nnet/rxrpc/ar-internal.h-276-\n--\nnet/rxrpc/ar-internal.h=558=struct rxrpc_connection {\n--\nnet/rxrpc/ar-internal.h-638-\nnet/rxrpc/ar-internal.h:639:static inline bool rxrpc_to_server(const struct rxrpc_skb_priv *sp)\nnet/rxrpc/ar-internal.h-640-{\n--\nnet/rxrpc/ar-internal.h-643-\nnet/rxrpc/ar-internal.h:644:static inline bool rxrpc_to_client(const struct rxrpc_skb_priv *sp)\nnet/rxrpc/ar-internal.h-645-{\n--\nnet/rxrpc/ar-internal.h=1467=static inline int rxrpc_abort_eproto(struct rxrpc_call *call,\n--\nnet/rxrpc/ar-internal.h-1471-{\nnet/rxrpc/ar-internal.h:1472:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/ar-internal.h-1473-\n"
} |
| 23/3 | 2026/10/17 05:03 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 14823 output: 38 thoughts: 27 Thoughts: Okay, let's dive into this. Here's my take on examining `struct rxrpc_skb_priv`, as though I were the one thinking it: **Inspecting `rxrpc_skb_priv` in `net/rxrpc/ar-internal.h`** Alright, time to get my hands dirty. I want to thoroughly understand how the RXRPC protocol uses the `struct rxrpc_skb_priv`. This is a crucial data structure, undoubtedly holding critical per-SKB information related to the RXRPC protocol processing. I'll need to dissect its members, analyze their interactions, and how they play a part in the overall flow of RXRPC operations within the kernel. I expect it's going to be a key element for managing things like retransmissions, acknowledgements, flow control, and perhaps even session-specific data. It's likely involved in the state transitions of the packets as they traverse the networking stack. I need to understand how this private area ties into the general `sk_buff` structure and how memory is managed in relation to this structure. I'll be looking for potential optimization opportunities and points of interest that impact performance and robustness. It's going to be interesting to see how this structure is related to the other major RXRPC related structures, like the socket, the call and the connection. |
| 24/3 | 2026/10/17 05:03 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/ar-internal.h",
"FirstLine": 235,
"LineCount": 45
}Results: {
"Contents": " 235:\t/*\n 236:\t * RxRPC socket buffer private variables\n 237:\t * - max 48 bytes (struct sk_buff::cb)\n 238:\t */\n 239:\tstruct rxrpc_skb_priv {\n 240:\t\tunion {\n 241:\t\t\tstruct rxrpc_connection *poke_conn;\t/* Conn referred to (poke packet) */\n 242:\t\t\tstruct {\n 243:\t\t\t\tu16\t\toffset;\t\t/* Offset of data */\n 244:\t\t\t\tu16\t\tlen;\t\t/* Length of data */\n 245:\t\t\t};\n 246:\t\t\tstruct {\n 247:\t\t\t\tu16\t\toffset;\n 248:\t\t\t\tu16\t\tlen;\n 249:\t\t\t\tstruct rxrpc_async_queue_charge *charge;\n 250:\t\t\t} data;\n 251:\t\t\tstruct {\n 252:\t\t\t\trxrpc_seq_t\tfirst_ack;\t/* First packet in acks table */\n 253:\t\t\t\trxrpc_seq_t\tprev_ack;\t/* Highest seq seen */\n 254:\t\t\t\trxrpc_serial_t\tacked_serial;\t/* Packet in response to (or 0) */\n 255:\t\t\t\tu16\t\tnr_acks;\t/* Number of acks+nacks */\n 256:\t\t\t\tu8\t\treason;\t\t/* Reason for ack */\n 257:\t\t\t} ack;\n 258:\t\t\tstruct {\n 259:\t\t\t\tstruct rxrpc_connection *conn;\t/* Connection referred to */\n 260:\t\t\t\tunion {\n 261:\t\t\t\t\tu32 rxkad_nonce;\n 262:\t\t\t\t};\n 263:\t\t\t} chall;\n 264:\t\t\tstruct {\n 265:\t\t\t\trxrpc_serial_t\tchallenge_serial;\n 266:\t\t\t\tu32\t\tkvno;\n 267:\t\t\t\tu32\t\tversion;\n 268:\t\t\t\tu16\t\tlen;\n 269:\t\t\t\tu16\t\tticket_len;\n 270:\t\t\t} resp;\n 271:\t\t};\n 272:\t\tstruct rxrpc_host_header hdr;\t/* RxRPC packet header from this packet */\n 273:\t};\n 274:\t\n 275:\t#define rxrpc_skb(__skb) ((struct rxrpc_skb_priv *) \u0026(__skb)-\u003ecb)\n 276:\t\n 277:\t/*\n 278:\t * RxRPC security module interface\n 279:\t */\n"
} |
| 25/3 | 2026/10/17 05:03 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 15834 output: 38 thoughts: 259 Thoughts: **Analyzing the `rxrpc_skb_priv` Structure** Okay, so I see that `sp` is being overlaid onto `skb->cb`. Interesting. Diving into `struct rxrpc_skb_priv`, I'm looking at this unnamed union and its members: `poke_conn`, an unnamed struct with `offset` and `len`, and a `data` struct also containing `offset`, `len`, and `charge`. The immediate question that pops into my head is, does `rxrpc_skb(skb)` actually fit within 48 bytes as I expect? We need to calculate this carefully. Let's break down the sizes in that union, piece by piece. `poke_conn` is a pointer, so 8 bytes on a 64-bit system. The `offset` and `len` within the unnamed struct are 4 bytes each, totaling 4 bytes. The `data` struct: `offset` is 2 bytes, `len` is 2 bytes, and the `charge` is 8 bytes. There’s some padding, likely to a multiple of 8, so we're looking at 16 bytes. Let me double check, I see now that `ack` is 15 bytes and `chall` will take 12 bytes. Lastly, `resp` will take 16 bytes. Then, we have `struct rxrpc_host_header hdr` to consider. To figure this out, I'll need to check the definition of `rxrpc_host_header`, specifically lines 210-225 in ar-internal.h, as I recall. |
| 26/3 | 2026/10/17 05:03 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/ar-internal.h",
"FirstLine": 210,
"LineCount": 20
}Results: {
"Contents": " 210:\t\tu32\t\tepoch;\t\t/* client boot timestamp */\n 211:\t\tu32\t\tcid;\t\t/* connection and channel ID */\n 212:\t\tu32\t\tcallNumber;\t/* call ID (0 for connection-level packets) */\n 213:\t\tu32\t\tseq;\t\t/* sequence number of pkt in call stream */\n 214:\t\tu32\t\tserial;\t\t/* serial number of pkt sent to network */\n 215:\t\tu8\t\ttype;\t\t/* packet type */\n 216:\t\tu8\t\tflags;\t\t/* packet flags */\n 217:\t\tu8\t\tuserStatus;\t/* app-layer defined status */\n 218:\t\tu8\t\tsecurityIndex;\t/* security protocol ID */\n 219:\t\tunion {\n 220:\t\t\tu16\t_rsvd;\t\t/* reserved */\n 221:\t\t\tu16\tcksum;\t\t/* kerberos security checksum */\n 222:\t\t};\n 223:\t\tu16\t\tserviceId;\t/* service ID */\n 224:\t} __packed;\n 225:\t\n 226:\t/*\n 227:\t * Shared asynchronous receive-memory charge for split jumbo DATA packets.\n 228:\t */\n 229:\tstruct rxrpc_async_queue_charge {\n"
} |
| 27/3 | 2026/10/17 05:03 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 16830 output: 33 thoughts: 316 Thoughts: **Analyzing RXRPC Packet Handling** Okay, so I'm looking at the memory layout and processing logic for RXRPC packets. I've confirmed that the size of `rxrpc_host_header` is 28 bytes, calculated from the structure's individual members. The union within it occupies 16 bytes. That means the total size of 44 bytes fits comfortably within the 48-byte `skb->cb` space, which is good. No issues there. Now, I'm diving into the `rxrpc_input_data_one` function to understand how data packets are handled. Let's see... it initializes `sp->data.charge` to NULL and then checks if `sp->offset` is not equal to the size of `rxrpc_wire_header` or if the packet has the `RXRPC_JUMBO_PACKET` flag set. If either condition is true, it seems we allocate an asynchronous queue charge, or reuse a previously allocated one and assign it to `sp->data.charge`. Then, there's a call to `rxrpc_charge_async_queue`, and *that* is where things get interesting. If the queue charge fails, `sp->data.charge` gets set to NULL, and we'll clear the `RXRPC_CALL_RX_LAST` flag if `set_last` is true. Then we jump to `send_ack` which indicates a NOSPACE error. Wait a second. What's the context here? I need to understand where `rxrpc_input_data_one` fits into the broader picture. So, I need to check where `rxrpc_input_data_one` is actually *called* from. I'll need to search for those call sites. That will give me a more complete picture of how the data is being managed here, and what the flow of control is. |
| 28/3 | 2026/10/17 05:04 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_input_data_one",
"PathPrefixes": [
"net/rxrpc"
]
}Results: {
"Output": "net/rxrpc/input.c=456=static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-480- */\nnet/rxrpc/input.c:481:static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\nnet/rxrpc/input.c-482-\t\t\t\t bool *_notify, rxrpc_serial_t *_ack_serial,\n--\nnet/rxrpc/input.c=649=static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-679-\t\tjsp-\u003elen = RXRPC_JUMBO_DATALEN;\nnet/rxrpc/input.c:680:\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-681-\t\t\t\t \u0026charge);\n--\nnet/rxrpc/input.c-694-\tsp-\u003elen = len;\nnet/rxrpc/input.c:695:\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-696-\t\t\t \u0026charge);\n"
} |
| 29/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17951 output: 31 thoughts: 47 Thoughts: Okay, let's see, my thought process right now is focused on understanding the context of `rxrpc_input_split_jumbo`. I need to figure out how and why this function is being called, especially from within the `net/rxrpc/input.c` file. My goal is to grasp the broader picture of how jumbo frames are handled in the RxRPC protocol stack. So, I'm thinking, "Let's start by identifying the *callers* of `rxrpc_input_split_jumbo`." This will immediately give me a sense of what precedes this function call, and what's being passed into it. Understanding the preceding context is critical for debugging or analyzing this portion of the code. I also need to see if the function `rxrpc_input_data` also exists within the same file. To do so, I'll *grep* for the string `rxrpc_input_data`. My assumption is that this function will be called in other places and will likely give me a comprehensive understanding of the entire data input flow. This search will likely broaden my understanding and confirm that these functions are related. |
| 30/3 | 2026/10/17 05:04 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_input_data",
"PathPrefixes": [
"net/rxrpc"
]
}Results: {
"Output": "net/rxrpc/input.c=456=static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-480- */\nnet/rxrpc/input.c:481:static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\nnet/rxrpc/input.c-482-\t\t\t\t bool *_notify, rxrpc_serial_t *_ack_serial,\n--\nnet/rxrpc/input.c=649=static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-679-\t\tjsp-\u003elen = RXRPC_JUMBO_DATALEN;\nnet/rxrpc/input.c:680:\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-681-\t\t\t\t \u0026charge);\n--\nnet/rxrpc/input.c-694-\tsp-\u003elen = len;\nnet/rxrpc/input.c:695:\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\nnet/rxrpc/input.c-696-\t\t\t \u0026charge);\n--\nnet/rxrpc/input.c-724- */\nnet/rxrpc/input.c:725:static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-726-{\n--\nnet/rxrpc/input.c=1294=void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-1317-\tcase RXRPC_PACKET_TYPE_DATA:\nnet/rxrpc/input.c:1318:\t\treturn rxrpc_input_data(call, skb);\nnet/rxrpc/input.c-1319-\n--\nnet/rxrpc/recvmsg.c=108=static void rxrpc_rotate_rx_window(struct rxrpc_call *call)\n--\nnet/rxrpc/recvmsg.c-127-\nnet/rxrpc/recvmsg.c:128:\t/* Barrier against rxrpc_input_data(). */\nnet/rxrpc/recvmsg.c-129-\tif (after(tseq, call-\u003erx_consumed))\n"
} |
| 31/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18929 output: 36 thoughts: 29 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Diving into the RxRPC Input Handling** Alright, I'm thinking we need to get a handle on what's going on with `rxrpc_input_data`. Specifically, I'm going to jump into the `net/rxrpc/input.c` file. I'm going to zero in on line 725, or thereabouts. That's usually a key area for data reception, and understanding this particular piece of code will give me a better understanding of the input processing pipeline. Hopefully this will shed light on my question about... [The user should insert their question here, it is not possible to determine this from the given text.]. |
| 32/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/input.c",
"FirstLine": 720,
"LineCount": 40
}Results: {
"Contents": " 720:\t\n 721:\t/*\n 722:\t * Process a DATA packet, adding the packet to the Rx ring. The caller's\n 723:\t * packet ref must be passed on or discarded.\n 724:\t */\n 725:\tstatic void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)\n 726:\t{\n 727:\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n 728:\t\trxrpc_serial_t serial = sp-\u003ehdr.serial;\n 729:\t\trxrpc_seq_t seq0 = sp-\u003ehdr.seq;\n 730:\t\n 731:\t\t_enter(\"{%x,%x,%x},{%u,%x}\",\n 732:\t\t call-\u003eackr_window, call-\u003eackr_wtop, call-\u003erx_highest_seq,\n 733:\t\t skb-\u003elen, seq0);\n 734:\t\n 735:\t\tif (__rxrpc_call_is_complete(call))\n 736:\t\t\treturn;\n 737:\t\n 738:\t\tswitch (__rxrpc_call_state(call)) {\n 739:\t\tcase RXRPC_CALL_CLIENT_SEND_REQUEST:\n 740:\t\tcase RXRPC_CALL_CLIENT_AWAIT_ACK:\n 741:\t\tcase RXRPC_CALL_CLIENT_AWAIT_REPLY:\n 742:\t\t\t/* Received data implicitly ACKs all of the request\n 743:\t\t\t * packets we sent when we're acting as a client.\n 744:\t\t\t */\n 745:\t\t\tif (!rxrpc_receiving_reply(call))\n 746:\t\t\t\tgoto out_notify;\n 747:\t\t\tbreak;\n 748:\t\n 749:\t\tcase RXRPC_CALL_SERVER_RECV_REQUEST: {\n 750:\t\t\tunsigned long timo = READ_ONCE(call-\u003enext_req_timo);\n 751:\t\n 752:\t\t\tif (timo) {\n 753:\t\t\t\tktime_t delay = ms_to_ktime(timo);\n 754:\t\n 755:\t\t\t\tcall-\u003eexpect_req_by = ktime_add(ktime_get_real(), delay);\n 756:\t\t\t\ttrace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_idle);\n 757:\t\t\t}\n 758:\t\t\tbreak;\n 759:\t\t}\n"
} |
| 33/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19818 output: 36 thoughts: 15 Thoughts: Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person: **Diving into `rxrpc_input_data`** Alright, let's drill down into `rxrpc_input_data`. My initial thought is to understand its role within the broader data flow. Specifically, I need to get a clear picture of how this structure functions in relation to the wider context of incoming data. Where is this structure used, and where does the information in it originate? I'm already anticipating questions about potential race conditions and locking strategies, so I'll be keeping an eye out for how concurrency is handled around this particular data structure. Any areas of particular concern when it comes to buffer management should be identified right away. I'm thinking about typical failure scenarios, and whether this structure is appropriately resilient to bad inputs or unexpected network conditions. Ultimately, the question to answer right away is: what is the overall function of this data and, are there immediately apparent flaws? |
| 34/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/input.c",
"FirstLine": 760,
"LineCount": 40
}Results: {
"Contents": " 760:\t\n 761:\t\tdefault:\n 762:\t\t\tbreak;\n 763:\t\t}\n 764:\t\n 765:\t\tif (!rxrpc_input_split_jumbo(call, skb)) {\n 766:\t\t\trxrpc_proto_abort(call, sp-\u003ehdr.seq, rxrpc_badmsg_bad_jumbo);\n 767:\t\t\tgoto out_notify;\n 768:\t\t}\n 769:\t\treturn;\n 770:\t\n 771:\tout_notify:\n 772:\t\ttrace_rxrpc_notify_socket(call-\u003edebug_id, serial);\n 773:\t\trxrpc_notify_socket(call);\n 774:\t\t_leave(\" [queued]\");\n 775:\t}\n 776:\t\n 777:\t/*\n 778:\t * See if there's a cached RTT probe to complete.\n 779:\t */\n 780:\tstatic void rxrpc_complete_rtt_probe(struct rxrpc_call *call,\n 781:\t\t\t\t\t ktime_t resp_time,\n 782:\t\t\t\t\t rxrpc_serial_t acked_serial,\n 783:\t\t\t\t\t rxrpc_serial_t ack_serial,\n 784:\t\t\t\t\t enum rxrpc_rtt_rx_trace type)\n 785:\t{\n 786:\t\trxrpc_serial_t orig_serial;\n 787:\t\tunsigned long avail;\n 788:\t\tktime_t sent_at;\n 789:\t\tbool matched = false;\n 790:\t\tint i;\n 791:\t\n 792:\t\tavail = READ_ONCE(call-\u003ertt_avail);\n 793:\t\tsmp_rmb(); /* Read avail bits before accessing data. */\n 794:\t\n 795:\t\tfor (i = 0; i \u003c ARRAY_SIZE(call-\u003ertt_serial); i++) {\n 796:\t\t\tif (!test_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, \u0026avail))\n 797:\t\t\t\tcontinue;\n 798:\t\n 799:\t\t\tsent_at = call-\u003ertt_sent_at[i];\n"
} |
| 35/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20671 output: 36 thoughts: 65 Thoughts: Here's my summary, as though I'm thinking through this process: **Diving into RxRPC Jumbo Packet Handling** Okay, so `rxrpc_input_data` is the entry point, and it's calling `rxrpc_input_split_jumbo(call, skb)`. Hmm, interesting. Seems like this `split_jumbo` function is the core of handling *both* non-jumbo and jumbo packets. That’s a good sign of elegant design, if done right, avoiding a separate codepath. My experience is that often the split happens further down the stack. So, let’s go ahead and dig into `rxrpc_input_split_jumbo`. That's where the real magic (or potential pitfalls) are likely to be. Time to see what we're actually working with. I wonder what the criteria are for splitting? |
| 36/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/input.c",
"FirstLine": 645,
"LineCount": 70
}Results: {
"Contents": " 645:\t\n 646:\t/*\n 647:\t * Split a jumbo packet and file the bits separately.\n 648:\t */\n 649:\tstatic bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n 650:\t{\n 651:\t\tstruct rxrpc_async_queue_charge *charge = NULL;\n 652:\t\tstruct rxrpc_jumbo_header jhdr;\n 653:\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp;\n 654:\t\tstruct sk_buff *jskb;\n 655:\t\trxrpc_serial_t ack_serial = 0;\n 656:\t\tunsigned int offset = sizeof(struct rxrpc_wire_header);\n 657:\t\tunsigned int len = skb-\u003elen - offset;\n 658:\t\tbool notify = false;\n 659:\t\tint ack_reason = 0, count = 1, stat_ix;\n 660:\t\n 661:\t\twhile (sp-\u003ehdr.flags \u0026 RXRPC_JUMBO_PACKET) {\n 662:\t\t\tif (len \u003c RXRPC_JUMBO_SUBPKTLEN)\n 663:\t\t\t\tgoto protocol_error;\n 664:\t\t\tif (sp-\u003ehdr.flags \u0026 RXRPC_LAST_PACKET)\n 665:\t\t\t\tgoto protocol_error;\n 666:\t\t\tif (skb_copy_bits(skb, offset + RXRPC_JUMBO_DATALEN,\n 667:\t\t\t\t\t \u0026jhdr, sizeof(jhdr)) \u003c 0)\n 668:\t\t\t\tgoto protocol_error;\n 669:\t\n 670:\t\t\tjskb = skb_clone(skb, GFP_NOFS);\n 671:\t\t\tif (!jskb) {\n 672:\t\t\t\tkdebug(\"couldn't clone\");\n 673:\t\t\t\trxrpc_put_async_queue_charge(call-\u003elocal, charge);\n 674:\t\t\t\treturn false;\n 675:\t\t\t}\n 676:\t\t\trxrpc_new_skb(jskb, rxrpc_skb_new_jumbo_subpacket);\n 677:\t\t\tjsp = rxrpc_skb(jskb);\n 678:\t\t\tjsp-\u003eoffset = offset;\n 679:\t\t\tjsp-\u003elen = RXRPC_JUMBO_DATALEN;\n 680:\t\t\trxrpc_input_data_one(call, jskb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\n 681:\t\t\t\t\t \u0026charge);\n 682:\t\t\trxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket);\n 683:\t\n 684:\t\t\tsp-\u003ehdr.flags = jhdr.flags;\n 685:\t\t\tsp-\u003ehdr._rsvd = ntohs(jhdr._rsvd);\n 686:\t\t\tsp-\u003ehdr.seq++;\n 687:\t\t\tsp-\u003ehdr.serial++;\n 688:\t\t\toffset += RXRPC_JUMBO_SUBPKTLEN;\n 689:\t\t\tlen -= RXRPC_JUMBO_SUBPKTLEN;\n 690:\t\t\tcount++;\n 691:\t\t}\n 692:\t\n 693:\t\tsp-\u003eoffset = offset;\n 694:\t\tsp-\u003elen = len;\n 695:\t\trxrpc_input_data_one(call, skb, \u0026notify, \u0026ack_serial, \u0026ack_reason,\n 696:\t\t\t\t \u0026charge);\n 697:\t\n 698:\t\tstat_ix = umin(count, ARRAY_SIZE(call-\u003erxnet-\u003estat_rx_jumbo)) - 1;\n 699:\t\tatomic_inc(\u0026call-\u003erxnet-\u003estat_rx_jumbo[stat_ix]);\n 700:\t\n 701:\t\tif (ack_reason \u003e 0) {\n 702:\t\t\trxrpc_send_ACK(call, ack_reason, ack_serial,\n 703:\t\t\t\t rxrpc_propose_ack_input_data);\n 704:\t\t} else {\n 705:\t\t\tcall-\u003eackr_nr_unacked++;\n 706:\t\t\trxrpc_propose_delay_ACK(call, sp-\u003ehdr.serial,\n 707:\t\t\t\t\t\trxrpc_propose_ack_input_data);\n 708:\t\t}\n 709:\t\tif (notify \u0026\u0026 !test_bit(RXRPC_CALL_CONN_CHALLENGING, \u0026call-\u003eflags)) {\n 710:\t\t\ttrace_rxrpc_notify_socket(call-\u003edebug_id, sp-\u003ehdr.serial);\n 711:\t\t\trxrpc_notify_socket(call);\n 712:\t\t}\n 713:\t\trxrpc_put_async_queue_charge(call-\u003elocal, charge);\n 714:\t\treturn true;\n"
} |
| 37/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22221 output: 37 thoughts: 2043 Thoughts: **Analyzing RXRPC Memory Accounting and OOB Handling** Alright, let's break this down. My initial focus was on understanding how the `charge` variable is managed within the RXRPC jumbo packet handling, specifically in `rxrpc_input_split_jumbo`. It appears that `charge` is used for asynchronous queue charging. I see it being allocated with `rxrpc_alloc_async_queue_charge` using `kzalloc`, and a refcount is initialized to 1. The `charge->size` is set to the packet size plus the size of the charge struct itself. `rxrpc_input_data_one` uses this charge in a conditional block when a non-initial packet (or a jumbo packet) is processed. The `rxrpc_charge_async_queue` function then increments the refcount, which happens for each "charged" packet. `rxrpc_put_async_queue_charge` at the end of the jumbo packet processing then decrements this initial refcount. The `rxrpc_uncharge_async_queue` is called when a packet is freed/dequeued/purged, and is where we ultimately release the charged memory using `rxrpc_put_async_queue_charge`. So, the refcount is used to track the number of places (specifically, packets) that "own" the charge. The `charged` field within the `rxrpc_async_queue_charge` struct seems to be a flag to ensure that the memory is only charged once per packet, and the `rxrpc_charge_async_queue_bytes` function is used for this memory management. This is important to ensure that the asynchronous queue doesn't exceed its limit. Now, let's step back and look at the larger context of this patch. It seems the commit is addressing an RXRPC rmem accounting issue or introducing a new feature. I see that `rxrpc_encap_rcv` now handles rmem charging more directly. It checks rmem, schedules it, and sets the owner with `skb_set_owner_r(skb, udp_sk)`. Subsequently, `rxrpc_skb_orphan_udp(skb)` drops this UDP rmem ownership when packets are queued to connection or call queues (asynchronous queue). RXRPC then uses its own queue charge (`rxrpc_charge_async_queue`) to track `local->rx_async_queue_bytes`. The window bounds checking is updated, using `smp_load_acquire` on `call->rx_consumed`. Finally, let's investigate the OOB changes in `net/rxrpc/oob.c`. The code now calls `rxrpc_charge_async_queue` before enqueueing OOB packets, and sets `skb->mark = RXRPC_SKB_MARK_CHALLENGE`. The counter in this block is also incremented. In `rxrpc_kernel_dequeue_oob`, the `_type` variable is now explicitly set to `RXRPC_OOB_CHALLENGE` *if* a packet is dequeued (if `oob != NULL`). Now, what if `oob` *is* `NULL`? I need to double-check the previous code and make sure the `_type` is valid in this case. I would assume that this value needs some form of error handling or explicit setting to indicate that no OOB packet was dequeued. |
| 38/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/oob.c",
"FirstLine": 305,
"LineCount": 25
}Results: {
"Contents": " 305:\t * its type.\n 306:\t *\n 307:\t * Return: The sk_buff representing the OOB message or %NULL if the queue was\n 308:\t * empty.\n 309:\t */\n 310:\tstruct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,\n 311:\t\t\t\t\t\t enum rxrpc_oob_type *_type)\n 312:\t{\n 313:\t\tstruct rxrpc_sock *rx = rxrpc_sk(sock-\u003esk);\n 314:\t\tstruct sk_buff *oob;\n 315:\t\n 316:\t\toob = skb_dequeue(\u0026rx-\u003erecvmsg_oobq);\n 317:\t\tif (oob)\n 318:\t\t\t*_type = RXRPC_OOB_CHALLENGE;\n 319:\t\treturn oob;\n 320:\t}\n 321:\tEXPORT_SYMBOL(rxrpc_kernel_dequeue_oob);\n 322:\t\n 323:\t/**\n 324:\t * rxrpc_kernel_free_oob - Free an out-of-band message\n 325:\t * @oob: The OOB message to free\n 326:\t *\n 327:\t * Free an OOB message along with any resources it holds.\n 328:\t */\n 329:\tvoid rxrpc_kernel_free_oob(struct sk_buff *oob)\n"
} |
| 39/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25424 output: 23 thoughts: 92 Thoughts: Okay, let's break this down. **Analyzing a Potential Out-of-Band (OOB) Data Vulnerability** Alright, I'm looking at this code snippet related to handling out-of-band data in RXRPC. Before this patch, the code was pretty straightforward: `*_type = oob->mark;`. It seems like the code was taking some sort of mark value associated with the out-of-band data structure (`oob`) and assigning it to `*_type`. Now, after the patch, things have changed to `*_type = RXRPC_OOB_CHALLENGE;`. My immediate thought is, "why the hardcode?". It appears someone made a change where `skb->mark` - which I'm assuming is the source for this mark value - is now set to `RXRPC_SKB_MARK_CHALLENGE` instead of the expected `RXRPC_OOB_CHALLENGE`. That's the crux of it, that's where I need to focus. Something must have introduced this mismatch between the intended setting and the receiving code. This suggests a potential bug or a subtle change in the data flow or the intended behavior. I'm wondering, "How does this affect the larger picture? What are the implications?" Especially, what about all the places calling `rxrpc_kernel_dequeue_oob`? Are those callers now expecting the hardcoded `RXRPC_OOB_CHALLENGE`? If the callers *were* relying on the dynamic `oob->mark`, this is a significant behavior change. If they're *not* and `RXRPC_OOB_CHALLENGE` is now the appropriate value, then it’s a fix. I need to trace the usage of that dequeue function to determine where the old behavior was being used and if it needs to be updated. This requires digging into all the other parts of the RXRPC codebase interacting with this `oob` object and this `mark` field. The potential vulnerability hinges on whether the receiving code is properly updated, and if not, the implications on security or functionality. This whole thing makes me want to start a diff on the `mark` variable to find where it is set and where it is used. |
| 40/3 | 2026/10/17 05:04 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_kernel_dequeue_oob"
}Results: {
"Output": "fs/afs/cm_security.c=98=void afs_process_oob_queue(struct work_struct *work)\n--\nfs/afs/cm_security.c-104-\twhile (READ_ONCE(net-\u003elive) \u0026\u0026\nfs/afs/cm_security.c:105:\t (oob = rxrpc_kernel_dequeue_oob(net-\u003esocket, \u0026type))) {\nfs/afs/cm_security.c-106-\t\tswitch (type) {\n--\ninclude/net/af_rxrpc.h=96=enum rxrpc_oob_type rxrpc_kernel_query_oob(struct sk_buff *oob,\n--\ninclude/net/af_rxrpc.h-98-\t\t\t\t\t unsigned long *_peer_appdata);\ninclude/net/af_rxrpc.h:99:struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,\ninclude/net/af_rxrpc.h-100-\t\t\t\t\t enum rxrpc_oob_type *_type);\n--\nnet/rxrpc/oob.c=297=EXPORT_SYMBOL(rxrpc_kernel_query_oob);\n--\nnet/rxrpc/oob.c-299-/**\nnet/rxrpc/oob.c:300: * rxrpc_kernel_dequeue_oob - Dequeue and return the front OOB message\nnet/rxrpc/oob.c-301- * @sock: The socket to query\n--\nnet/rxrpc/oob.c-309- */\nnet/rxrpc/oob.c:310:struct sk_buff *rxrpc_kernel_dequeue_oob(struct socket *sock,\nnet/rxrpc/oob.c-311-\t\t\t\t\t enum rxrpc_oob_type *_type)\n--\nnet/rxrpc/oob.c-320-}\nnet/rxrpc/oob.c:321:EXPORT_SYMBOL(rxrpc_kernel_dequeue_oob);\nnet/rxrpc/oob.c-322-\n"
} |
| 41/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26532 output: 31 thoughts: 356 Thoughts: **Analyzing the Connection Event Processing Loop** Okay, so I'm diving into `conn_event.c` to see how connection-level events are processed. Looking at this `rxrpc_do_process_connection` function, I see the main loop. It dequeues packets from `conn->rx_queue` and processes them one by one. I can see the core logic: `rxrpc_see_skb`, `rxrpc_process_event`, and `rxrpc_free_skb`. The `rxrpc_see_skb` likely marks the SKB for connection level work and `rxrpc_process_event` seems to contain the main logic and what to do depending on the event, and then we free the SKB. Now, I notice some new additions. There's this conditional check involving `skb->mark` and `RXRPC_SKB_MARK_SERVICE_CONN_SECURED`. If the mark isn't equal, then there's a call to `rxrpc_uncharge_async_queue`. This seems like some sort of resource management, likely related to asynchronous processing. Then there's the more interesting part. If the packet is a `RXRPC_PACKET_TYPE_CHALLENGE` packet, and its `sp->chall.conn` field is not null, then there is a call to `rxrpc_put_connection` on `sp->chall.conn`, using `rxrpc_conn_put_challenge_input` as the release function. Then, that `sp->chall.conn` field is cleared. This is probably some sort of challenge/response authentication sequence, and this block is responsible for releasing the connection when the challenge is complete. I need to understand what `rxrpc_conn_put_challenge_input` does and the exact purpose of this `conn` field. I'm getting curious about the flow before this addition. I should probably check out what `rxrpc_process_event` does, since that's likely where the connection events are initially classified and handled. I should check the code for that. |
| 42/3 | 2026/10/17 05:04 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_process_event",
"PathPrefixes": [
"net/rxrpc"
]
}Results: {
"Output": "net/rxrpc/conn_event.c=243=static int rxrpc_verify_response(struct rxrpc_connection *conn,\n--\nnet/rxrpc/conn_event.c-267- */\nnet/rxrpc/conn_event.c:268:static int rxrpc_process_event(struct rxrpc_connection *conn,\nnet/rxrpc/conn_event.c-269-\t\t\t struct sk_buff *skb)\n--\nnet/rxrpc/conn_event.c=384=static void rxrpc_do_process_connection(struct rxrpc_connection *conn)\n--\nnet/rxrpc/conn_event.c-395-\t\trxrpc_see_skb(skb, rxrpc_skb_see_conn_work);\nnet/rxrpc/conn_event.c:396:\t\trxrpc_process_event(conn, skb);\nnet/rxrpc/conn_event.c-397-\t\tif (skb-\u003emark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\n"
} |
| 43/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 27639 output: 38 thoughts: 26 Thoughts: Okay, let's dive into this. Here's my thought process on tackling that specific section: **Analyzing `net/rxrpc/conn_event.c` (Lines 384-415)** Alright, so I need to zoom in on lines 384-415 of `net/rxrpc/conn_event.c`. Given the file name and the context, I'm assuming this section deals with connection-level event handling within the RxRPC (Remote Procedure Call) networking subsystem. Knowing RxRPC, it’s highly likely these lines are part of the core state machine for handling connection lifecycle events – things like connection establishment, teardown, errors, retransmissions, and flow control events. My initial hypothesis is that this section likely contains the code that: * **Processes incoming connection-related events:** We're probably seeing conditional logic based on the type of event received (e.g., a "connection accepted" signal, a "data ready" notification, a "connection closed" indication, or an error code). * **Updates the connection state:** These events would be used to update the connection's state within the RxRPC system, transitioning the connection between various states like `connecting`, `connected`, `closing`, or `closed`. * **Triggers further actions:** The processing of an event will lead to callbacks, queueing tasks for other threads, or sending further network packets. I need to quickly scan this section to confirm or refine this initial mental model. I'll be looking for keywords like: `switch`, `case`, `if`, `state`, `event`, `rxrpc_conn`, `sk_` (for socket structures), and anything related to error codes or data transmission/reception. I'll focus on how the events are handled in relation to the state of the connection to get the most valuable insight. Let's start reading! |
| 44/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/conn_event.c",
"FirstLine": 384,
"LineCount": 35
}Results: {
"Contents": " 384:\tstatic void rxrpc_do_process_connection(struct rxrpc_connection *conn)\n 385:\t{\n 386:\t\tstruct sk_buff *skb;\n 387:\t\n 388:\t\tif (test_and_clear_bit(RXRPC_CONN_EV_CHALLENGE, \u0026conn-\u003eevents))\n 389:\t\t\trxrpc_secure_connection(conn);\n 390:\t\n 391:\t\t/* go through the conn-level event packets, releasing the ref on this\n 392:\t\t * connection that each one has when we've finished with it */\n 393:\t\twhile ((skb = skb_dequeue(\u0026conn-\u003erx_queue))) {\n 394:\t\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n 395:\t\t\trxrpc_see_skb(skb, rxrpc_skb_see_conn_work);\n 396:\t\t\trxrpc_process_event(conn, skb);\n 397:\t\t\tif (skb-\u003emark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\n 398:\t\t\t\trxrpc_uncharge_async_queue(conn-\u003elocal, skb);\n 399:\t\t\tif (sp-\u003ehdr.type == RXRPC_PACKET_TYPE_CHALLENGE \u0026\u0026 sp-\u003echall.conn) {\n 400:\t\t\t\trxrpc_put_connection(\n 401:\t\t\t\t\tsp-\u003echall.conn,\n 402:\t\t\t\t\trxrpc_conn_put_challenge_input);\n 403:\t\t\t\tsp-\u003echall.conn = NULL;\n 404:\t\t\t}\n 405:\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_conn_work);\n 406:\t\t}\n 407:\t}\n 408:\t\n 409:\tvoid rxrpc_process_connection(struct work_struct *work)\n 410:\t{\n 411:\t\tstruct rxrpc_connection *conn =\n 412:\t\t\tcontainer_of(work, struct rxrpc_connection, processor);\n 413:\t\n 414:\t\trxrpc_see_connection(conn, rxrpc_conn_see_work);\n 415:\t\n 416:\t\tif (__rxrpc_use_local(conn-\u003elocal, rxrpc_local_use_conn_work)) {\n 417:\t\t\trxrpc_do_process_connection(conn);\n 418:\t\t\trxrpc_unuse_local(conn-\u003elocal, rxrpc_local_unuse_conn_work);\n"
} |
| 45/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 28771 output: 37 thoughts: 519 Thoughts: **Analyzing `recvmsg.c` and User Space Interaction with rxrpc** Okay, let's dive into `net/rxrpc/recvmsg.c` and see how user space is interacting with `rxrpc`. Specifically, I want to understand if there are any data copies to user space. I need to trace this carefully to ensure no vulnerabilities exist and understand performance implications of any copies. First, I'm noting the changes in `rxrpc_rotate_rx_window`. It dequeues an `skb` (socket buffer), calls `rxrpc_see_skb`, and now includes `rxrpc_uncharge_async_queue`. I need to figure out how `rxrpc_uncharge_async_queue` works; is this relevant to user-space copies? Next, I'm focusing on `rxrpc_recvmsg_oob`. It looks like it uses `skb->mark` to determine the out-of-band type, specifically focusing on `RXRPC_SKB_MARK_CHALLENGE`. I want to verify if the value comparison in `switch (skb->mark)` aligns with the enum, and whether there are any potential vulnerabilities there. I note that there's a new `rxrpc_purge_data_queue` function that replaces `rxrpc_purge_queue`. Now, I need to zoom in and examine `rxrpc_recvmsg_oob` and the `rxrpc_recvmsg_challenge` functions. The goal is to determine if any of their logic involves copying data from kernel space to user space. This is where the potential user-space interaction would occur and I need to carefully scrutinize the data copying mechanism to determine what is being copied, if it is being validated, and how it can be exploited. |
| 46/3 | 2026/10/17 05:04 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/recvmsg.c",
"FirstLine": 230,
"LineCount": 40
}Results: {
"Contents": " 230:\t\n 231:\t/*\n 232:\t * Process OOB packets. Called with the socket locked.\n 233:\t */\n 234:\tstatic int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,\n 235:\t\t\t\t unsigned int flags)\n 236:\t{\n 237:\t\tstruct rxrpc_sock *rx = rxrpc_sk(sock-\u003esk);\n 238:\t\tstruct sk_buff *skb;\n 239:\t\tbool need_response = false;\n 240:\t\tint ret;\n 241:\t\n 242:\t\tskb = skb_peek(\u0026rx-\u003erecvmsg_oobq);\n 243:\t\tif (!skb)\n 244:\t\t\treturn -EAGAIN;\n 245:\t\trxrpc_see_skb(skb, rxrpc_skb_see_recvmsg);\n 246:\t\n 247:\t\tret = put_cmsg(msg, SOL_RXRPC, RXRPC_OOB_ID, sizeof(u64),\n 248:\t\t\t \u0026skb-\u003eskb_mstamp_ns);\n 249:\t\tif (ret \u003c 0)\n 250:\t\t\treturn ret;\n 251:\t\n 252:\t\tswitch (skb-\u003emark) {\n 253:\t\tcase RXRPC_SKB_MARK_CHALLENGE:\n 254:\t\t\tneed_response = true;\n 255:\t\t\tret = rxrpc_recvmsg_challenge(sock, msg, skb, flags);\n 256:\t\t\tbreak;\n 257:\t\tdefault:\n 258:\t\t\tWARN_ONCE(1, \"recvmsg() can't process unknown OOB type %u\\n\",\n 259:\t\t\t\t skb-\u003emark);\n 260:\t\t\tret = -EIO;\n 261:\t\t\tbreak;\n 262:\t\t}\n 263:\t\n 264:\t\tif (!(flags \u0026 MSG_PEEK)) {\n 265:\t\t\tskb_unlink(skb, \u0026rx-\u003erecvmsg_oobq);\n 266:\t\t\tif (need_response)\n 267:\t\t\t\trxrpc_add_pending_oob(rx, skb);\n 268:\t\t\telse\n 269:\t\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_oob);\n"
} |
| 47/3 | 2026/10/17 05:04 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30340 output: 32 thoughts: 13 Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person: **Analyzing `rxrpc_recvmsg_challenge`** Right, let's dive into this `rxrpc_recvmsg_challenge` function. I'm assuming we're dealing with an RxRPC implementation, so this likely resides within the receive path of the protocol. My initial thought is to quickly identify its purpose within the overall messaging flow. Is it involved in security handshakes, rate limiting, connection negotiation, or data integrity checks, or something else? Understanding its placement within the receive message lifecycle is paramount. I immediately want to dissect its inputs and outputs. What parameters does it take? Likely some form of RxRPC message structure, a socket descriptor, and potentially, some security context information. What does it return? Probably a status code indicating success or failure, and perhaps some modified state variables reflecting the outcome of the challenge. I need to understand what constitutes a "challenge" in this context. Is it a cryptographic challenge, a sequence number check, a timeout condition, or something entirely different? My experience with similar RPC systems gives me a rough guess, but the specifics are crucial. Based on the function's name, "challenge," I suspect it might be related to securing the connection or validating the sender's identity, but I need to examine its implementation to confirm this. I'll need to look at how it interacts with other RxRPC layers, such as the transport layer or the security module, to see how it ties into the overall system architecture. I anticipate that a detailed inspection of the underlying logic will be required to truly understand its function and purpose. Let's start the investigation! |
| 48/3 | 2026/10/17 05:05 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_recvmsg_challenge",
"PathPrefixes": [
"net/rxrpc"
]
}Results: {
"Output": "net/rxrpc/recvmsg.c=200=static int rxrpc_recvmsg_user_id(struct rxrpc_call *call, struct msghdr *msg,\n--\nnet/rxrpc/recvmsg.c-221- */\nnet/rxrpc/recvmsg.c:222:static int rxrpc_recvmsg_challenge(struct socket *sock, struct msghdr *msg,\nnet/rxrpc/recvmsg.c-223-\t\t\t\t struct sk_buff *challenge, unsigned int flags)\n--\nnet/rxrpc/recvmsg.c=234=static int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,\n--\nnet/rxrpc/recvmsg.c-254-\t\tneed_response = true;\nnet/rxrpc/recvmsg.c:255:\t\tret = rxrpc_recvmsg_challenge(sock, msg, skb, flags);\nnet/rxrpc/recvmsg.c-256-\t\tbreak;\n"
} |
| 49/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30996 output: 37 thoughts: 13 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience, and delivered as a first-person summary: **Diving into `rxrpc_recvmsg_challenge`** Right, let's get into `rxrpc_recvmsg_challenge`. I know the overall architecture, but digging into the specifics of this function is key for understanding how we're dealing with the challenges presented at the receive side of the RXRPC protocol. I'm assuming, given the name, this handles the specific challenges involved when a message is received. We need to be checking the packet, authenticating it, and making sure everything's correct and safe before we start passing it up the stack. My initial thoughts are: What are the primary authentication/integrity mechanisms being employed? Is it just relying on the established session key, or are we looking at something more sophisticated, like replay detection or message sequence numbers? Are we incorporating any kind of hardware-based security features, or is this all software? The challenge part itself is intriguing - what specific forms does it take? Denial of service resistance, potentially? Rate limiting? Any unusual or novel techniques here are of particular interest. Let's see how this ties into the overall error handling - how are we dealing with malformed packets or authentication failures? How granular is the error reporting? Any potential vulnerabilities jumping out at me? This feels like an important piece of the puzzle. Let's start dissecting. |
| 50/3 | 2026/10/17 05:05 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/recvmsg.c",
"FirstLine": 220,
"LineCount": 15
}Results: {
"Contents": " 220:\t * Deal with a CHALLENGE packet.\n 221:\t */\n 222:\tstatic int rxrpc_recvmsg_challenge(struct socket *sock, struct msghdr *msg,\n 223:\t\t\t\t\t struct sk_buff *challenge, unsigned int flags)\n 224:\t{\n 225:\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(challenge);\n 226:\t\tstruct rxrpc_connection *conn = sp-\u003echall.conn;\n 227:\t\n 228:\t\treturn conn-\u003esecurity-\u003echallenge_to_recvmsg(conn, challenge, msg);\n 229:\t}\n 230:\t\n 231:\t/*\n 232:\t * Process OOB packets. Called with the socket locked.\n 233:\t */\n 234:\tstatic int rxrpc_recvmsg_oob(struct socket *sock, struct msghdr *msg,\n"
} |
| 51/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31598 output: 47 thoughts: 922 Thoughts: **Analyzing RXRPC OOB Response Handling and Async Queue Management** Okay, let's dive into this `rxrpc_respond_to_oob` function within `oob.c`. I'm immediately drawn to the `RXRPC_OOB_CMD_RESPOND` case. The code checks `skb->mark`, and then there is a crucial call to `rxrpc_uncharge_async_queue`. Now, before I go further, I need to understand this `struct rxrpc_skb_priv` structure. Ah, here's the crucial detail: it's got a union! An anonymous struct with `offset` and `len`, and another struct named `data` that also contains `offset` and `len`, plus a `charge` field. When I see `sp->offset` or `sp->len` it will use the first, anonymous struct. When I see `sp->data.offset` or `sp->data.len` it uses the second struct and those fields overlap with the first at offset 0. And `sp->data.charge` is the one to pay attention to. Looking at `rxrpc_input_data_one`, I see that `sp->data.charge` is explicitly initialized to `NULL` but then set only if the packet is a "JUMBO_PACKET" or if it is at an offset other than the expected header size, and if `rxrpc_charge_async_queue` succeeds. Crucially, if the charging fails, it's set to `NULL`. This raises a question: what happens if the charge, for some reason, isn't uncharged later? Now, let's examine `rxrpc_uncharge_async_queue`. Here, I'm looking at how the `charge` is handled. It checks `sp->hdr.type` and if it is a DATA packet, it checks `sp->data.charge`. Critically, it *sets* `sp->data.charge` to `NULL` after uncharging. Now, my key question emerges: is `sp->hdr.type` *always* initialized when an skb is created or received? It's essential, because if not, there is a race condition. Let's trace back where this `sp->hdr` is initialized to ensure safety. |
| 52/3 | 2026/10/17 05:05 | tool | grepper |
0mArgs:{
"Expression": "rxrpc_skb",
"PathPrefixes": [
"net/rxrpc/input.c",
"net/rxrpc/io_thread.c"
]
}Results: {
"Output": "net/rxrpc/input.c=456=static void rxrpc_input_queue_data(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-459-{\nnet/rxrpc/input.c:460:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-461-\tbool last = sp-\u003ehdr.flags \u0026 RXRPC_LAST_PACKET;\n--\nnet/rxrpc/input.c=481=static void rxrpc_input_data_one(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-485-{\nnet/rxrpc/input.c:486:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-487-\tstruct sk_buff *oos;\n--\nnet/rxrpc/input.c-581-\nnet/rxrpc/input.c:582:\t\trxrpc_get_skb(skb, rxrpc_skb_get_to_recvmsg);\nnet/rxrpc/input.c-583-\n--\nnet/rxrpc/input.c-587-\t\twhile ((oos = skb_peek(\u0026call-\u003erx_oos_queue))) {\nnet/rxrpc/input.c:588:\t\t\tstruct rxrpc_skb_priv *osp = rxrpc_skb(oos);\nnet/rxrpc/input.c-589-\n--\nnet/rxrpc/input.c-616-\t\tskb_queue_walk(\u0026call-\u003erx_oos_queue, oos) {\nnet/rxrpc/input.c:617:\t\t\tstruct rxrpc_skb_priv *osp = rxrpc_skb(oos);\nnet/rxrpc/input.c-618-\nnet/rxrpc/input.c-619-\t\t\tif (after(osp-\u003ehdr.seq, seq)) {\nnet/rxrpc/input.c:620:\t\t\t\trxrpc_get_skb(skb, rxrpc_skb_get_to_recvmsg_oos);\nnet/rxrpc/input.c-621-\t\t\t\t__skb_queue_before(\u0026call-\u003erx_oos_queue, oos, skb);\n--\nnet/rxrpc/input.c-625-\nnet/rxrpc/input.c:626:\t\trxrpc_get_skb(skb, rxrpc_skb_get_to_recvmsg_oos);\nnet/rxrpc/input.c-627-\t\t__skb_queue_tail(\u0026call-\u003erx_oos_queue, skb);\n--\nnet/rxrpc/input.c=649=static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-652-\tstruct rxrpc_jumbo_header jhdr;\nnet/rxrpc/input.c:653:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb), *jsp;\nnet/rxrpc/input.c-654-\tstruct sk_buff *jskb;\n--\nnet/rxrpc/input.c-675-\t\t}\nnet/rxrpc/input.c:676:\t\trxrpc_new_skb(jskb, rxrpc_skb_new_jumbo_subpacket);\nnet/rxrpc/input.c:677:\t\tjsp = rxrpc_skb(jskb);\nnet/rxrpc/input.c-678-\t\tjsp-\u003eoffset = offset;\n--\nnet/rxrpc/input.c-681-\t\t\t\t \u0026charge);\nnet/rxrpc/input.c:682:\t\trxrpc_free_skb(jskb, rxrpc_skb_put_jumbo_subpacket);\nnet/rxrpc/input.c-683-\n--\nnet/rxrpc/input.c=725=static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-726-{\nnet/rxrpc/input.c:727:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-728-\trxrpc_serial_t serial = sp-\u003ehdr.serial;\n--\nnet/rxrpc/input.c=830=static void rxrpc_input_ack_trailer(struct rxrpc_call *call, struct sk_buff *skb,\n--\nnet/rxrpc/input.c-832-{\nnet/rxrpc/input.c:833:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-834-\tstruct rxrpc_peer *peer = call-\u003epeer;\n--\nnet/rxrpc/input.c=1003=static void rxrpc_input_soft_acks(struct rxrpc_call *call,\n--\nnet/rxrpc/input.c-1006-{\nnet/rxrpc/input.c:1007:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-1008-\tstruct rxrpc_txqueue *tq = call-\u003etx_queue;\n--\nnet/rxrpc/input.c=1111=static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)\n--\nnet/rxrpc/input.c-1114-\tstruct rxrpc_acktrailer trailer;\nnet/rxrpc/input.c:1115:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-1116-\trxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;\n--\nnet/rxrpc/input.c=1281=static void rxrpc_input_abort(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-1282-{\nnet/rxrpc/input.c:1283:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-1284-\n--\nnet/rxrpc/input.c=1294=void rxrpc_input_call_packet(struct rxrpc_call *call, struct sk_buff *skb)\nnet/rxrpc/input.c-1295-{\nnet/rxrpc/input.c:1296:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/input.c-1297-\tunsigned long timo;\n--\nnet/rxrpc/io_thread.c=14=static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,\n--\nnet/rxrpc/io_thread.c-21- */\nnet/rxrpc/io_thread.c:22:static void rxrpc_skb_orphan_udp(struct sk_buff *skb)\nnet/rxrpc/io_thread.c-23-{\n--\nnet/rxrpc/io_thread.c=51=int rxrpc_encap_rcv(struct sock *udp_sk, struct sk_buff *skb)\n--\nnet/rxrpc/io_thread.c-102-\tskb-\u003emark = RXRPC_SKB_MARK_PACKET;\nnet/rxrpc/io_thread.c:103:\trxrpc_new_skb(skb, rxrpc_skb_new_encap_rcv);\nnet/rxrpc/io_thread.c-104-\tskb_queue_tail(rx_queue, skb);\n--\nnet/rxrpc/io_thread.c=117=void rxrpc_error_report(struct sock *sk)\n--\nnet/rxrpc/io_thread.c-130-\t\tskb-\u003emark = RXRPC_SKB_MARK_ERROR;\nnet/rxrpc/io_thread.c:131:\t\trxrpc_new_skb(skb, rxrpc_skb_new_error_report);\nnet/rxrpc/io_thread.c-132-\t\tskb_queue_tail(\u0026local-\u003erx_queue, skb);\n--\nnet/rxrpc/io_thread.c=142=bool rxrpc_direct_abort(struct sk_buff *skb, enum rxrpc_abort_reason why,\n--\nnet/rxrpc/io_thread.c-144-{\nnet/rxrpc/io_thread.c:145:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-146-\n--\nnet/rxrpc/io_thread.c=157=bool rxrpc_direct_conn_abort(struct sk_buff *skb, enum rxrpc_abort_reason why,\n--\nnet/rxrpc/io_thread.c-159-{\nnet/rxrpc/io_thread.c:160:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-161-\n--\nnet/rxrpc/io_thread.c=178=static bool rxrpc_input_version(struct rxrpc_local *local, struct sk_buff *skb)\nnet/rxrpc/io_thread.c-179-{\nnet/rxrpc/io_thread.c:180:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-181-\tchar v;\n--\nnet/rxrpc/io_thread.c-184-\nnet/rxrpc/io_thread.c:185:\trxrpc_see_skb(skb, rxrpc_skb_see_version);\nnet/rxrpc/io_thread.c-186-\tif (skb_copy_bits(skb, sizeof(struct rxrpc_wire_header), \u0026v, 1) \u003e= 0) {\n--\nnet/rxrpc/io_thread.c-196- */\nnet/rxrpc/io_thread.c:197:static bool rxrpc_extract_header(struct rxrpc_skb_priv *sp,\nnet/rxrpc/io_thread.c-198-\t\t\t\t struct sk_buff *skb)\n--\nnet/rxrpc/io_thread.c=249=static bool rxrpc_input_packet(struct rxrpc_local *local, struct sk_buff *skb)\n--\nnet/rxrpc/io_thread.c-252-\tstruct sockaddr_rxrpc peer_srx;\nnet/rxrpc/io_thread.c:253:\tstruct rxrpc_skb_priv *sp;\nnet/rxrpc/io_thread.c-254-\tstruct rxrpc_peer *peer = NULL;\n--\nnet/rxrpc/io_thread.c-258-\nnet/rxrpc/io_thread.c:259:\tsp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-260-\n--\nnet/rxrpc/io_thread.c=381=static int rxrpc_input_packet_on_conn(struct rxrpc_connection *conn,\n--\nnet/rxrpc/io_thread.c-384-{\nnet/rxrpc/io_thread.c:385:\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-386-\tstruct rxrpc_channel *chan;\n--\nnet/rxrpc/io_thread.c=484=int rxrpc_io_thread(void *data)\n--\nnet/rxrpc/io_thread.c-526-\t\twhile ((skb = __skb_dequeue(\u0026rx_queue))) {\nnet/rxrpc/io_thread.c:527:\t\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\nnet/rxrpc/io_thread.c-528-\nnet/rxrpc/io_thread.c-529-\t\t\tif (skb-\u003emark == RXRPC_SKB_MARK_PACKET)\nnet/rxrpc/io_thread.c:530:\t\t\t\trxrpc_skb_orphan_udp(skb);\nnet/rxrpc/io_thread.c-531-\t\t\telse if (skb-\u003emark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\n--\nnet/rxrpc/io_thread.c-538-\t\t\t\ttrace_rxrpc_rx_done(skb-\u003emark, skb-\u003epriority);\nnet/rxrpc/io_thread.c:539:\t\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_input);\nnet/rxrpc/io_thread.c-540-\t\t\t\tbreak;\n--\nnet/rxrpc/io_thread.c-542-\t\t\t\trxrpc_input_error(local, skb);\nnet/rxrpc/io_thread.c:543:\t\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_error_report);\nnet/rxrpc/io_thread.c-544-\t\t\t\tbreak;\n--\nnet/rxrpc/io_thread.c-547-\t\t\t\trxrpc_put_connection(sp-\u003epoke_conn, rxrpc_conn_put_poke);\nnet/rxrpc/io_thread.c:548:\t\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_conn_secured);\nnet/rxrpc/io_thread.c-549-\t\t\t\tbreak;\n--\nnet/rxrpc/io_thread.c-551-\t\t\t\tWARN_ON_ONCE(1);\nnet/rxrpc/io_thread.c:552:\t\t\t\trxrpc_free_skb(skb, rxrpc_skb_put_unknown);\nnet/rxrpc/io_thread.c-553-\t\t\t\tbreak;\n"
} |
| 53/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36614 output: 38 thoughts: 25 Thoughts: Okay, let's dive in. **Analyzing `rxrpc_extract_header` in `net/rxrpc/io_thread.c`** Alright, time to get to the bottom of this. My focus is on the `rxrpc_extract_header` function, specifically within the `net/rxrpc/io_thread.c` file. I need to understand its role within the RPCRX framework. I'm already imagining the potential gotchas – is it correctly handling various header versions, what about potential endian issues, and of course, what's the error handling like in the face of malformed or truncated packets? I'm expecting this to be the point where the initial packet validation and metadata extraction happen. So, I need to understand exactly how it parses the incoming data, identifies the header type, and populates the relevant data structures. This is core for the whole RPCRX flow, so any weakness here could be a major vulnerability or performance bottleneck. Let's see how they've handled it. |
| 54/3 | 2026/10/17 05:05 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/io_thread.c",
"FirstLine": 195,
"LineCount": 40
}Results: {
"Contents": " 195:\t * Extract the wire header from a packet and translate the byte order.\n 196:\t */\n 197:\tstatic bool rxrpc_extract_header(struct rxrpc_skb_priv *sp,\n 198:\t\t\t\t\t struct sk_buff *skb)\n 199:\t{\n 200:\t\tstruct rxrpc_wire_header whdr;\n 201:\t\tstruct rxrpc_ackpacket ack;\n 202:\t\n 203:\t\t/* dig out the RxRPC connection details */\n 204:\t\tif (skb_copy_bits(skb, 0, \u0026whdr, sizeof(whdr)) \u003c 0)\n 205:\t\t\treturn rxrpc_bad_message(skb, rxrpc_badmsg_short_hdr);\n 206:\t\n 207:\t\tmemset(sp, 0, sizeof(*sp));\n 208:\t\tsp-\u003ehdr.epoch\t\t= ntohl(whdr.epoch);\n 209:\t\tsp-\u003ehdr.cid\t\t= ntohl(whdr.cid);\n 210:\t\tsp-\u003ehdr.callNumber\t= ntohl(whdr.callNumber);\n 211:\t\tsp-\u003ehdr.seq\t\t= ntohl(whdr.seq);\n 212:\t\tsp-\u003ehdr.serial\t\t= ntohl(whdr.serial);\n 213:\t\tsp-\u003ehdr.flags\t\t= whdr.flags;\n 214:\t\tsp-\u003ehdr.type\t\t= whdr.type;\n 215:\t\tsp-\u003ehdr.userStatus\t= whdr.userStatus;\n 216:\t\tsp-\u003ehdr.securityIndex\t= whdr.securityIndex;\n 217:\t\tsp-\u003ehdr._rsvd\t\t= ntohs(whdr._rsvd);\n 218:\t\tsp-\u003ehdr.serviceId\t= ntohs(whdr.serviceId);\n 219:\t\n 220:\t\tif (sp-\u003ehdr.type == RXRPC_PACKET_TYPE_ACK) {\n 221:\t\t\tif (skb_copy_bits(skb, sizeof(whdr), \u0026ack, sizeof(ack)) \u003c 0)\n 222:\t\t\t\treturn rxrpc_bad_message(skb, rxrpc_badmsg_short_ack);\n 223:\t\t\tsp-\u003eack.first_ack\t= ntohl(ack.firstPacket);\n 224:\t\t\tsp-\u003eack.prev_ack\t= ntohl(ack.previousPacket);\n 225:\t\t\tsp-\u003eack.acked_serial\t= ntohl(ack.serial);\n 226:\t\t\tsp-\u003eack.reason\t\t= ack.reason;\n 227:\t\t\tsp-\u003eack.nr_acks\t\t= ack.nAcks;\n 228:\t\t}\n 229:\t\treturn true;\n 230:\t}\n 231:\t\n 232:\t/*\n 233:\t * Extract the abort code from an ABORT packet and stash it in skb-\u003epriority.\n 234:\t */\n"
} |
| 55/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37652 output: 40 thoughts: 628 Thoughts: **Analyzing Jumbo Packet Handling in RxRPC** Okay, so I'm digging into this RxRPC jumbo packet logic. The `memset(sp, 0, sizeof(*sp))` call in `rxrpc_extract_header` immediately flags me. That zeroes out the entire `sp` structure, which contains crucial control information related to the RxRPC sk_buff. This is then passed to the jumbo packet handling. Now, when a jumbo packet is split, `skb_clone(skb, GFP_NOFS)` is called. I need to remember that `skb_clone` copies `skb->cb` – that's crucial! So the cloned `jsp` now carries the zeroed contents of the original `sp`. Then `jsp->offset` and `jsp->len` are set. Makes sense so far. But then, in `rxrpc_input_data_one`, I see that `sp->data.charge` is explicitly initialized: `sp->data.charge = *_charge;`. This is where the initial zeroing of `sp` might become an issue. Now, let's step back and check `select_skb_count(skb)`. This is clearly involved in garbage collection. I'm especially interested in the `rxrpc_purge_queue` function and the usage of `RXRPC_SKB_MARK_SERVICE_CONN_SECURED`. It appears this mark is used to determine which packets can be safely de-referenced. `rxrpc_purge_queue` calls `rxrpc_uncharge_async_queue` if the mark is set, indicating a potential resource leak if the mark is not set. The question now becomes: Where is `RXRPC_SKB_MARK_SERVICE_CONN_SECURED` set? I need to track down exactly how that mark is established to understand the complete picture of jumbo packet handling and potential refcounting issues. The memset call in the beginning makes me wonder if there's an instance where this mark is not set, resulting in garbage collection that's not fully executed. This needs thorough investigation. |
| 56/3 | 2026/10/17 05:05 | tool | grepper |
0mArgs:{
"Expression": "RXRPC_SKB_MARK_SERVICE_CONN_SECURED",
"PathPrefixes": [
"net/rxrpc"
]
}Results: {
"Output": "net/rxrpc/ar-internal.h=60=enum rxrpc_skb_mark {\n--\nnet/rxrpc/ar-internal.h-63-\tRXRPC_SKB_MARK_CHALLENGE,\t/* Challenge notification */\nnet/rxrpc/ar-internal.h:64:\tRXRPC_SKB_MARK_SERVICE_CONN_SECURED, /* Service connection response has been verified */\nnet/rxrpc/ar-internal.h-65-\tRXRPC_SKB_MARK_REJECT_BUSY,\t/* Reject with BUSY */\n--\nnet/rxrpc/conn_event.c=268=static int rxrpc_process_event(struct rxrpc_connection *conn,\n--\nnet/rxrpc/conn_event.c-317-\t\t\t\tconn, rxrpc_conn_get_poke_secured);\nnet/rxrpc/conn_event.c:318:\t\t\tskb-\u003emark = RXRPC_SKB_MARK_SERVICE_CONN_SECURED;\nnet/rxrpc/conn_event.c-319-\t\t\trxrpc_get_skb(skb, rxrpc_skb_get_conn_secured);\n--\nnet/rxrpc/conn_event.c=384=static void rxrpc_do_process_connection(struct rxrpc_connection *conn)\n--\nnet/rxrpc/conn_event.c-396-\t\trxrpc_process_event(conn, skb);\nnet/rxrpc/conn_event.c:397:\t\tif (skb-\u003emark != RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\nnet/rxrpc/conn_event.c-398-\t\t\trxrpc_uncharge_async_queue(conn-\u003elocal, skb);\n--\nnet/rxrpc/conn_event.c=557=void rxrpc_input_conn_event(struct rxrpc_connection *conn, struct sk_buff *skb)\n--\nnet/rxrpc/conn_event.c-578-\t\tswitch (skb-\u003emark) {\nnet/rxrpc/conn_event.c:579:\t\tcase RXRPC_SKB_MARK_SERVICE_CONN_SECURED:\nnet/rxrpc/conn_event.c-580-\t\t\tif (conn-\u003estate != RXRPC_CONN_SERVICE)\n--\nnet/rxrpc/io_thread.c=484=int rxrpc_io_thread(void *data)\n--\nnet/rxrpc/io_thread.c-530-\t\t\t\trxrpc_skb_orphan_udp(skb);\nnet/rxrpc/io_thread.c:531:\t\t\telse if (skb-\u003emark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED)\nnet/rxrpc/io_thread.c-532-\t\t\t\trxrpc_uncharge_async_queue(sp-\u003epoke_conn-\u003elocal, skb);\n--\nnet/rxrpc/io_thread.c-544-\t\t\t\tbreak;\nnet/rxrpc/io_thread.c:545:\t\t\tcase RXRPC_SKB_MARK_SERVICE_CONN_SECURED:\nnet/rxrpc/io_thread.c-546-\t\t\t\trxrpc_input_conn_event(sp-\u003epoke_conn, skb);\n--\nnet/rxrpc/skbuff.c=175=void rxrpc_purge_queue(struct sk_buff_head *list)\n--\nnet/rxrpc/skbuff.c-181-\nnet/rxrpc/skbuff.c:182:\t\tif (skb-\u003emark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED) {\nnet/rxrpc/skbuff.c-183-\t\t\tstruct rxrpc_skb_priv *sp = rxrpc_skb(skb);\n"
} |
| 57/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39689 output: 38 thoughts: 25 Thoughts: Okay, here's the summary, rendered as if I'm the one thinking it: **Diving into the Connection Event Handling** Alright, let's get down to brass tacks. I need to understand what's going on with the connection events in `net/rxrpc/conn_event.c`. Specifically, I want to zero in on what's happening around line 317. That's a critical point where things are likely converging, or diverging. I need to figure out what kind of event is being processed there, the context it's operating within, and how that impacts the overall state of the connection. I'm expecting this to be a key area for potential issues or performance bottlenecks, and a good place to start my investigation. |
| 58/3 | 2026/10/17 05:05 | tool | read-file |
0mArgs:{
"File": "net/rxrpc/conn_event.c",
"FirstLine": 310,
"LineCount": 20
}Results: {
"Contents": " 310:\t\n 311:\t\t\tif (secured) {\n 312:\t\t\t\t/* Offload call state flipping to the I/O thread. As\n 313:\t\t\t\t * we've already received the packet, put it on the\n 314:\t\t\t\t * front of the queue.\n 315:\t\t\t\t */\n 316:\t\t\t\tsp-\u003epoke_conn = rxrpc_get_connection(\n 317:\t\t\t\t\tconn, rxrpc_conn_get_poke_secured);\n 318:\t\t\t\tskb-\u003emark = RXRPC_SKB_MARK_SERVICE_CONN_SECURED;\n 319:\t\t\t\trxrpc_get_skb(skb, rxrpc_skb_get_conn_secured);\n 320:\t\t\t\tskb_queue_head(\u0026conn-\u003elocal-\u003erx_queue, skb);\n 321:\t\t\t\trxrpc_wake_up_io_thread(conn-\u003elocal);\n 322:\t\t\t}\n 323:\t\t\treturn 0;\n 324:\t\n 325:\t\tdefault:\n 326:\t\t\tWARN_ON_ONCE(1);\n 327:\t\t\treturn -EPROTO;\n 328:\t\t}\n 329:\t}\n"
} |
| 59/3 | 2026/10/17 05:05 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40232 output: 354 thoughts: 3830 Thoughts: **KMSAN Assessment: No Uninitialized Memory Risks** Okay, let's break down this patch and see if it introduces any uninitialized memory risks that would warrant setting `NeedsKMSAN=true`. I need to be *absolutely* sure, so let's go through it carefully. First, I've got to understand the core functionality. This patch appears to be largely about managing packet queues, accounting for memory usage, and handling connection and call lifecycle events within the RxRPC network protocol. There are a number of changes to do with memory management and queueing of data, and changes to the call and connection objects. It also seems to clean up socket releases with `rcu_assign_sk_user_data`. I'm focused on the criteria where KMSAN is most relevant: 1. Kernel data sent to userspace (potential info leaks) 2. Uninitialized variables in conditional branches 3. Uninitialized fields within allocated complex data structures. 4. Bounds checks and potential for reading uninitialized memory. So, let's look at the C code. I'll read each change through the lens of KMSAN applicability. The first code block `rxrpc_do_process_connection` dequeues packets and processes events. It uses a new `rxrpc_uncharge_async_queue` function. It seems that if `skb->mark == RXRPC_SKB_MARK_SERVICE_CONN_SECURED`, the charge is handed over to the queue of `conn->local->rx_queue`. Next, I look at the `rxrpc_io_thread` that processes the items from that queue. It also does `rxrpc_uncharge_async_queue`. Then, I see changes involving `rxrpc_purge_queue`, and the introduction of `rxrpc_purge_data_queue` - these functions seem to relate to the cleanup of queues during disconnection or other events. I need to make sure that these don't lead to dangling pointers or use-after-free conditions but those issues are typically detected by KASAN. I notice that in `call_event.c`, `rxrpc_purge_queue` is used during call completion and disconnection. This is a common pattern for resource cleanup. In `call_object.c` and `conn_object.c` there are `purge_queue` functions. I need to make sure that these operations correctly free up memory and accounting. The same considerations apply. `local_object.c` has `rxrpc_adjust_rcvbuf`, which adjusts receive buffer sizes. This is important to ensure that RxRPC doesn't exhaust available memory and that the windowing calculations are correct. I need to make sure that there are no uninitialized variables being used in this function. This is typically a KMSAN-style issue. However, I read the variable initialization and assignments and there's nothing to worry about. Now, I look at `io_thread.c`. Here, the code seems to handle the reception of UDP-encapsulated packets. There's a `rxrpc_encap_rcv` function, and within it, an `enum skb_drop_reason reason;` variable. I have to look carefully at this because it's a potential area for uninitialized variable usage. However, I verified that the code *always* sets the `reason` variable before a `goto drop;` . Therefore, it's not a KMSAN issue. The changes in `input.c` include changes in the bounds of the receive window. The important thing here is to make sure this doesn't lead to buffer overruns, but KMSAN would not be useful for that, KASAN can detect them. Finally, `local_object.c` has `READ_ONCE` for `rcvbuf` and `old_rcvbuf`. Nothing to worry about. So, now let's go back and explicitly consider the four KMSAN criteria: 1. **Kernel data to userspace:** I see *no* new kernel data structures being sent to userspace. All of the changes seem to be in internal memory management, queueing, and accounting. There are changes to the recvmsg functionality, but these are all internal to the kernel. 2. **Uninitialized variables in conditional branches:** I carefully examined the relevant code, particularly `rxrpc_encap_rcv` where there was a local variable `reason`, and the `skb->data.charge` members. The code *always* initializes variables before use. 3. **Uninitialized fields in complex data structures:** The `rxrpc_async_queue_charge` structure is allocated using `kzalloc`. This guarantees zero-initialization of all fields. 4. **Bounds checks:** The bounds check |
| 60/3 | 2026/10/17 05:05 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch series introduces asynchronous receive-memory accounting (rx_async_queue_bytes) and per-connection/per-call queue charge management for RxRPC, including `struct rxrpc_async_queue_charge` to handle split jumbo packets, rmem scheduling in UDP encap_rcv, and receive window bounding.\n\n- KMSAN Applicability: KMSAN detects reads of uninitialized memory and information leaks to user space. In this patch, all newly allocated structures (`struct rxrpc_async_queue_charge`) are allocated using `kzalloc()`, all local variables (such as `reason` in `rxrpc_encap_rcv()` and `slot` / `set_last` in `rxrpc_input_data_one()`) are explicitly initialized before use, and `sp-\u003edata.charge` is explicitly initialized prior to being accessed. No uninitialized memory or structure padding is exposed or copied to user space. Thus, there are no uninitialized memory risks that KMSAN would uniquely detect.\n\n- KASAN \u0026 Standard Sanitizers Applicability: The changes primarily involve reference counting (`charge-\u003eref`, connection refcounts), socket locking (`sk_receive_queue.lock`), atomic accounting (`rx_async_queue_bytes`), and skb queue lifecycle management. Potential bugs in these areas (such as use-after-free, double free, refcount underflow/leak, or locking deadlocks) are already covered by KASAN, refcount_t hardening, and LOCKDEP.\n\nTherefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch series introduces asynchronous receive-memory accounting (rx_async_queue_bytes) and per-connection/per-call queue charge management for RxRPC, including `struct rxrpc_async_queue_charge` to handle split jumbo packets, rmem scheduling in UDP encap_rcv, and receive window bounding.\n\n- KMSAN Applicability: KMSAN detects reads of uninitialized memory and information leaks to user space. In this patch, all newly allocated structures (`struct rxrpc_async_queue_charge`) are allocated using `kzalloc()`, all local variables (such as `reason` in `rxrpc_encap_rcv()` and `slot` / `set_last` in `rxrpc_input_data_one()`) are explicitly initialized before use, and `sp-\u003edata.charge` is explicitly initialized prior to being accessed. No uninitialized memory or structure padding is exposed or copied to user space. Thus, there are no uninitialized memory risks that KMSAN would uniquely detect.\n\n- KASAN \u0026 Standard Sanitizers Applicability: The changes primarily involve reference counting (`charge-\u003eref`, connection refcounts), socket locking (`sk_receive_queue.lock`), atomic accounting (`rx_async_queue_bytes`), and skb queue lifecycle management. Potential bugs in these areas (such as use-after-free, double free, refcount underflow/leak, or locking deadlocks) are already covered by KASAN, refcount_t hardening, and LOCKDEP.\n\nTherefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|