Files
linux/include/trace/events
Chuck Lever 726ae7300f SUNRPC: Fix the svc_deferred_event trace class
[ Upstream commit 4d5004451a ]

Fix a NULL deref crash that occurs when an svc_rqst is deferred
while the sunrpc tracing subsystem is enabled. svc_revisit() sets
dr->xprt to NULL, so it can't be relied upon in the tracepoint to
provide the remote's address.

Unfortunately we can't revert the "svc_deferred_class" hunk in
commit ece200ddd5 ("sunrpc: Save remote presentation address in
svc_xprt for trace events") because there is now a specific check
of event format specifiers for unsafe dereferences. The warning
that check emits is:

  event svc_defer_recv has unsafe dereference of argument 1

A "%pISpc" format specifier with a "struct sockaddr *" is indeed
flagged by this check.

Instead, take the brute-force approach used by the svcrdma_qp_error
tracepoint. Convert the dr::addr field into a presentation address
in the TP_fast_assign() arm of the trace event, and store that as
a string. This fix can be backported to -stable kernels.

In the meantime, commit c6ced22997 ("tracing: Update print fmt
check to handle new __get_sockaddr() macro") is now in v5.18, so
this wonky fix can be replaced with __sockaddr() and friends
properly during the v5.19 merge window.

Fixes: ece200ddd5 ("sunrpc: Save remote presentation address in svc_xprt for trace events")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:34:09 +02:00
..
2020-11-30 12:54:01 +00:00
2021-06-29 10:53:52 -07:00
2021-09-08 11:50:24 -07:00
2021-09-23 23:21:34 +08:00
2022-04-08 14:22:58 +02:00
2021-11-25 09:48:31 +01:00
2019-11-08 11:23:37 +01:00
2019-03-27 15:52:01 -03:00
2017-09-25 20:38:26 +02:00
2021-06-29 10:53:52 -07:00
2020-04-22 12:55:54 -07:00
2021-05-12 12:10:23 -07:00
2018-02-13 21:30:22 +01:00
2021-05-31 22:48:24 -04:00
2017-12-19 10:56:24 +01:00
2021-06-29 11:28:21 -07:00
2021-05-14 15:26:03 -07:00
2021-03-23 14:08:18 -04:00