1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2018 Oracle. All rights reserved.
5 * Trace point definitions for the "rpcgss" subsystem.
9 #define TRACE_SYSTEM rpcgss
11 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_RPCGSS_H
14 #include <linux/tracepoint.h>
17 ** GSS-API related trace events
20 TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE
);
21 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY
);
22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY
);
24 #define show_gss_service(x) \
26 { RPC_GSS_SVC_NONE, "none" }, \
27 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \
28 { RPC_GSS_SVC_PRIVACY, "privacy" })
30 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH
);
31 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME
);
32 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE
);
33 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS
);
34 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS
);
35 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG
);
36 TRACE_DEFINE_ENUM(GSS_S_NO_CRED
);
37 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT
);
38 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN
);
39 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL
);
40 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED
);
41 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED
);
42 TRACE_DEFINE_ENUM(GSS_S_FAILURE
);
43 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP
);
44 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED
);
45 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE
);
46 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT
);
47 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN
);
48 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED
);
49 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN
);
50 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN
);
51 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN
);
52 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN
);
54 #define show_gss_status(x) \
55 __print_flags(x, "|", \
56 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \
57 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \
58 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
59 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \
60 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \
61 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \
62 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \
63 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \
64 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \
65 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
66 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
67 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \
68 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \
69 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \
70 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \
71 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \
72 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \
73 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \
74 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \
75 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \
76 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \
77 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \
78 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
81 DECLARE_EVENT_CLASS(rpcgss_gssapi_event
,
83 const struct rpc_task
*task
,
87 TP_ARGS(task
, maj_stat
),
90 __field(unsigned int, task_id
)
91 __field(unsigned int, client_id
)
92 __field(u32
, maj_stat
)
97 __entry
->task_id
= task
->tk_pid
;
98 __entry
->client_id
= task
->tk_client
->cl_clid
;
99 __entry
->maj_stat
= maj_stat
;
102 TP_printk("task:%u@%u maj_stat=%s",
103 __entry
->task_id
, __entry
->client_id
,
104 __entry
->maj_stat
== 0 ?
105 "GSS_S_COMPLETE" : show_gss_status(__entry
->maj_stat
))
108 #define DEFINE_GSSAPI_EVENT(name) \
109 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \
111 const struct rpc_task *task, \
114 TP_ARGS(task, maj_stat))
116 TRACE_EVENT(rpcgss_import_ctx
,
128 __entry
->status
= status
;
131 TP_printk("status=%d", __entry
->status
)
134 DEFINE_GSSAPI_EVENT(get_mic
);
135 DEFINE_GSSAPI_EVENT(verify_mic
);
136 DEFINE_GSSAPI_EVENT(wrap
);
137 DEFINE_GSSAPI_EVENT(unwrap
);
139 DECLARE_EVENT_CLASS(rpcgss_ctx_class
,
141 const struct gss_cred
*gc
147 __field(const void *, cred
)
148 __field(unsigned long, service
)
149 __string(principal
, gc
->gc_principal
)
154 __entry
->service
= gc
->gc_service
;
155 __assign_str(principal
, gc
->gc_principal
)
158 TP_printk("cred=%p service=%s principal='%s'",
159 __entry
->cred
, show_gss_service(__entry
->service
),
160 __get_str(principal
))
163 #define DEFINE_CTX_EVENT(name) \
164 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \
166 const struct gss_cred *gc \
170 DEFINE_CTX_EVENT(init
);
171 DEFINE_CTX_EVENT(destroy
);
173 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class
,
175 const struct svc_rqst
*rqstp
,
179 TP_ARGS(rqstp
, maj_stat
),
183 __field(u32
, maj_stat
)
184 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
188 __entry
->xid
= __be32_to_cpu(rqstp
->rq_xid
);
189 __entry
->maj_stat
= maj_stat
;
190 __assign_str(addr
, rqstp
->rq_xprt
->xpt_remotebuf
);
193 TP_printk("addr=%s xid=0x%08x maj_stat=%s",
194 __get_str(addr
), __entry
->xid
,
195 __entry
->maj_stat
== 0 ?
196 "GSS_S_COMPLETE" : show_gss_status(__entry
->maj_stat
))
199 #define DEFINE_SVC_GSSAPI_EVENT(name) \
200 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \
202 const struct svc_rqst *rqstp, \
205 TP_ARGS(rqstp, maj_stat))
207 DEFINE_SVC_GSSAPI_EVENT(unwrap
);
208 DEFINE_SVC_GSSAPI_EVENT(mic
);
210 TRACE_EVENT(rpcgss_svc_unwrap_failed
,
212 const struct svc_rqst
*rqstp
219 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
223 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
224 __assign_str(addr
, rqstp
->rq_xprt
->xpt_remotebuf
);
227 TP_printk("addr=%s xid=0x%08x", __get_str(addr
), __entry
->xid
)
230 TRACE_EVENT(rpcgss_svc_seqno_bad
,
232 const struct svc_rqst
*rqstp
,
237 TP_ARGS(rqstp
, expected
, received
),
240 __field(u32
, expected
)
241 __field(u32
, received
)
243 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
247 __entry
->expected
= expected
;
248 __entry
->received
= received
;
249 __entry
->xid
= __be32_to_cpu(rqstp
->rq_xid
);
250 __assign_str(addr
, rqstp
->rq_xprt
->xpt_remotebuf
);
253 TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
254 __get_str(addr
), __entry
->xid
,
255 __entry
->expected
, __entry
->received
)
258 TRACE_EVENT(rpcgss_svc_accept_upcall
,
260 const struct svc_rqst
*rqstp
,
265 TP_ARGS(rqstp
, major_status
, minor_status
),
268 __field(u32
, minor_status
)
269 __field(unsigned long, major_status
)
271 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
275 __entry
->minor_status
= minor_status
;
276 __entry
->major_status
= major_status
;
277 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
278 __assign_str(addr
, rqstp
->rq_xprt
->xpt_remotebuf
);
281 TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
282 __get_str(addr
), __entry
->xid
,
283 (__entry
->major_status
== 0) ? "GSS_S_COMPLETE" :
284 show_gss_status(__entry
->major_status
),
285 __entry
->major_status
, __entry
->minor_status
289 TRACE_EVENT(rpcgss_svc_authenticate
,
291 const struct svc_rqst
*rqstp
,
292 const struct rpc_gss_wire_cred
*gc
300 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
304 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
305 __entry
->seqno
= gc
->gc_seq
;
306 __assign_str(addr
, rqstp
->rq_xprt
->xpt_remotebuf
);
309 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr
),
310 __entry
->xid
, __entry
->seqno
)
315 ** GSS auth unwrap failures
318 TRACE_EVENT(rpcgss_unwrap_failed
,
320 const struct rpc_task
*task
326 __field(unsigned int, task_id
)
327 __field(unsigned int, client_id
)
331 __entry
->task_id
= task
->tk_pid
;
332 __entry
->client_id
= task
->tk_client
->cl_clid
;
335 TP_printk("task:%u@%u", __entry
->task_id
, __entry
->client_id
)
338 TRACE_EVENT(rpcgss_bad_seqno
,
340 const struct rpc_task
*task
,
345 TP_ARGS(task
, expected
, received
),
348 __field(unsigned int, task_id
)
349 __field(unsigned int, client_id
)
350 __field(u32
, expected
)
351 __field(u32
, received
)
355 __entry
->task_id
= task
->tk_pid
;
356 __entry
->client_id
= task
->tk_client
->cl_clid
;
357 __entry
->expected
= expected
;
358 __entry
->received
= received
;
361 TP_printk("task:%u@%u expected seqno %u, received seqno %u",
362 __entry
->task_id
, __entry
->client_id
,
363 __entry
->expected
, __entry
->received
)
366 TRACE_EVENT(rpcgss_seqno
,
368 const struct rpc_task
*task
374 __field(unsigned int, task_id
)
375 __field(unsigned int, client_id
)
381 const struct rpc_rqst
*rqst
= task
->tk_rqstp
;
383 __entry
->task_id
= task
->tk_pid
;
384 __entry
->client_id
= task
->tk_client
->cl_clid
;
385 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
386 __entry
->seqno
= rqst
->rq_seqno
;
389 TP_printk("task:%u@%u xid=0x%08x seqno=%u",
390 __entry
->task_id
, __entry
->client_id
,
391 __entry
->xid
, __entry
->seqno
)
394 TRACE_EVENT(rpcgss_need_reencode
,
396 const struct rpc_task
*task
,
401 TP_ARGS(task
, seq_xmit
, ret
),
404 __field(unsigned int, task_id
)
405 __field(unsigned int, client_id
)
407 __field(u32
, seq_xmit
)
413 __entry
->task_id
= task
->tk_pid
;
414 __entry
->client_id
= task
->tk_client
->cl_clid
;
415 __entry
->xid
= be32_to_cpu(task
->tk_rqstp
->rq_xid
);
416 __entry
->seq_xmit
= seq_xmit
;
417 __entry
->seqno
= task
->tk_rqstp
->rq_seqno
;
421 TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
422 __entry
->task_id
, __entry
->client_id
,
423 __entry
->xid
, __entry
->seqno
, __entry
->seq_xmit
,
424 __entry
->ret
? "" : "un")
427 TRACE_EVENT(rpcgss_update_slack
,
429 const struct rpc_task
*task
,
430 const struct rpc_auth
*auth
436 __field(unsigned int, task_id
)
437 __field(unsigned int, client_id
)
439 __field(const void *, auth
)
440 __field(unsigned int, rslack
)
441 __field(unsigned int, ralign
)
442 __field(unsigned int, verfsize
)
446 __entry
->task_id
= task
->tk_pid
;
447 __entry
->client_id
= task
->tk_client
->cl_clid
;
448 __entry
->xid
= be32_to_cpu(task
->tk_rqstp
->rq_xid
);
449 __entry
->auth
= auth
;
450 __entry
->rslack
= auth
->au_rslack
;
451 __entry
->ralign
= auth
->au_ralign
;
452 __entry
->verfsize
= auth
->au_verfsize
;
455 TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
456 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
457 __entry
->auth
, __entry
->rslack
, __entry
->ralign
,
461 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class
,
463 const struct svc_rqst
*rqstp
,
467 TP_ARGS(rqstp
, seqno
),
475 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
476 __entry
->seqno
= seqno
;
479 TP_printk("xid=0x%08x seqno=%u",
480 __entry
->xid
, __entry
->seqno
)
483 #define DEFINE_SVC_SEQNO_EVENT(name) \
484 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \
486 const struct svc_rqst *rqstp, \
489 TP_ARGS(rqstp, seqno))
491 DEFINE_SVC_SEQNO_EVENT(large
);
492 DEFINE_SVC_SEQNO_EVENT(seen
);
494 TRACE_EVENT(rpcgss_svc_seqno_low
,
496 const struct svc_rqst
*rqstp
,
502 TP_ARGS(rqstp
, seqno
, min
, max
),
512 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
513 __entry
->seqno
= seqno
;
518 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
519 __entry
->xid
, __entry
->seqno
, __entry
->min
, __entry
->max
)
523 ** gssd upcall related trace events
526 TRACE_EVENT(rpcgss_upcall_msg
,
538 __assign_str(msg
, buf
)
541 TP_printk("msg='%s'", __get_str(msg
))
544 TRACE_EVENT(rpcgss_upcall_result
,
550 TP_ARGS(uid
, result
),
560 __entry
->result
= result
;
563 TP_printk("for uid %u, result=%d", __entry
->uid
, __entry
->result
)
566 TRACE_EVENT(rpcgss_context
,
569 unsigned long expiry
,
571 unsigned int timeout
,
576 TP_ARGS(window_size
, expiry
, now
, timeout
, len
, data
),
579 __field(unsigned long, expiry
)
580 __field(unsigned long, now
)
581 __field(unsigned int, timeout
)
582 __field(u32
, window_size
)
584 __string(acceptor
, data
)
588 __entry
->expiry
= expiry
;
590 __entry
->timeout
= timeout
;
591 __entry
->window_size
= window_size
;
593 strncpy(__get_str(acceptor
), data
, len
);
596 TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
597 __entry
->window_size
, __entry
->expiry
, __entry
->now
,
598 __entry
->timeout
, __entry
->len
, __get_str(acceptor
))
603 ** Miscellaneous events
606 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5
);
607 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I
);
608 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P
);
610 #define show_pseudoflavor(x) \
611 __print_symbolic(x, \
612 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \
613 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \
614 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
617 TRACE_EVENT(rpcgss_createauth
,
623 TP_ARGS(flavor
, error
),
626 __field(unsigned int, flavor
)
632 __entry
->flavor
= flavor
;
633 __entry
->error
= error
;
636 TP_printk("flavor=%s error=%d",
637 show_pseudoflavor(__entry
->flavor
), __entry
->error
)
640 TRACE_EVENT(rpcgss_oid_to_mech
,
652 __assign_str(oid
, oid
);
655 TP_printk("mech for oid %s was not found", __get_str(oid
))
658 #endif /* _TRACE_RPCGSS_H */
660 #include <trace/define_trace.h>