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_RPCGSS_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_RPCGSS_H
14 #include <linux/tracepoint.h>
16 #include <trace/misc/sunrpc.h>
19 ** GSS-API related trace events
22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE
);
23 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY
);
24 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY
);
26 #define show_gss_service(x) \
28 { RPC_GSS_SVC_NONE, "none" }, \
29 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \
30 { RPC_GSS_SVC_PRIVACY, "privacy" })
32 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH
);
33 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME
);
34 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE
);
35 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS
);
36 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS
);
37 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG
);
38 TRACE_DEFINE_ENUM(GSS_S_NO_CRED
);
39 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT
);
40 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN
);
41 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL
);
42 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED
);
43 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED
);
44 TRACE_DEFINE_ENUM(GSS_S_FAILURE
);
45 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP
);
46 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED
);
47 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE
);
48 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT
);
49 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN
);
50 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED
);
51 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN
);
52 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN
);
53 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN
);
54 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN
);
56 #define show_gss_status(x) \
58 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \
59 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \
60 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \
61 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \
62 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \
63 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \
64 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \
65 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \
66 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \
67 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \
68 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \
69 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \
70 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \
71 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \
72 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \
73 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \
74 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \
75 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \
76 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \
77 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \
78 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \
79 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \
80 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" })
83 DECLARE_EVENT_CLASS(rpcgss_gssapi_event
,
85 const struct rpc_task
*task
,
89 TP_ARGS(task
, maj_stat
),
92 __field(unsigned int, task_id
)
93 __field(unsigned int, client_id
)
94 __field(u32
, maj_stat
)
99 __entry
->task_id
= task
->tk_pid
;
100 __entry
->client_id
= task
->tk_client
->cl_clid
;
101 __entry
->maj_stat
= maj_stat
;
104 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
" maj_stat=%s",
105 __entry
->task_id
, __entry
->client_id
,
106 __entry
->maj_stat
== 0 ?
107 "GSS_S_COMPLETE" : show_gss_status(__entry
->maj_stat
))
110 #define DEFINE_GSSAPI_EVENT(name) \
111 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \
113 const struct rpc_task *task, \
116 TP_ARGS(task, maj_stat))
118 TRACE_EVENT(rpcgss_import_ctx
,
130 __entry
->status
= status
;
133 TP_printk("status=%d", __entry
->status
)
136 DEFINE_GSSAPI_EVENT(get_mic
);
137 DEFINE_GSSAPI_EVENT(verify_mic
);
138 DEFINE_GSSAPI_EVENT(wrap
);
139 DEFINE_GSSAPI_EVENT(unwrap
);
141 DECLARE_EVENT_CLASS(rpcgss_ctx_class
,
143 const struct gss_cred
*gc
149 __field(const void *, cred
)
150 __field(unsigned long, service
)
151 __string(principal
, gc
->gc_principal
)
156 __entry
->service
= gc
->gc_service
;
157 __assign_str(principal
);
160 TP_printk("cred=%p service=%s principal='%s'",
161 __entry
->cred
, show_gss_service(__entry
->service
),
162 __get_str(principal
))
165 #define DEFINE_CTX_EVENT(name) \
166 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \
168 const struct gss_cred *gc \
172 DEFINE_CTX_EVENT(init
);
173 DEFINE_CTX_EVENT(destroy
);
175 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class
,
177 const struct svc_rqst
*rqstp
,
181 TP_ARGS(rqstp
, maj_stat
),
185 __field(u32
, maj_stat
)
186 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
190 __entry
->xid
= __be32_to_cpu(rqstp
->rq_xid
);
191 __entry
->maj_stat
= maj_stat
;
195 TP_printk("addr=%s xid=0x%08x maj_stat=%s",
196 __get_str(addr
), __entry
->xid
,
197 __entry
->maj_stat
== 0 ?
198 "GSS_S_COMPLETE" : show_gss_status(__entry
->maj_stat
))
201 #define DEFINE_SVC_GSSAPI_EVENT(name) \
202 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \
204 const struct svc_rqst *rqstp, \
207 TP_ARGS(rqstp, maj_stat))
209 DEFINE_SVC_GSSAPI_EVENT(wrap
);
210 DEFINE_SVC_GSSAPI_EVENT(unwrap
);
211 DEFINE_SVC_GSSAPI_EVENT(mic
);
212 DEFINE_SVC_GSSAPI_EVENT(get_mic
);
214 TRACE_EVENT(rpcgss_svc_wrap_failed
,
216 const struct svc_rqst
*rqstp
223 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
227 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
231 TP_printk("addr=%s xid=0x%08x", __get_str(addr
), __entry
->xid
)
234 TRACE_EVENT(rpcgss_svc_unwrap_failed
,
236 const struct svc_rqst
*rqstp
243 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
247 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
251 TP_printk("addr=%s xid=0x%08x", __get_str(addr
), __entry
->xid
)
254 TRACE_EVENT(rpcgss_svc_seqno_bad
,
256 const struct svc_rqst
*rqstp
,
261 TP_ARGS(rqstp
, expected
, received
),
264 __field(u32
, expected
)
265 __field(u32
, received
)
267 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
271 __entry
->expected
= expected
;
272 __entry
->received
= received
;
273 __entry
->xid
= __be32_to_cpu(rqstp
->rq_xid
);
277 TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u",
278 __get_str(addr
), __entry
->xid
,
279 __entry
->expected
, __entry
->received
)
282 TRACE_EVENT(rpcgss_svc_accept_upcall
,
284 const struct svc_rqst
*rqstp
,
289 TP_ARGS(rqstp
, major_status
, minor_status
),
292 __field(u32
, minor_status
)
293 __field(unsigned long, major_status
)
295 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
299 __entry
->minor_status
= minor_status
;
300 __entry
->major_status
= major_status
;
301 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
305 TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u",
306 __get_str(addr
), __entry
->xid
,
307 (__entry
->major_status
== 0) ? "GSS_S_COMPLETE" :
308 show_gss_status(__entry
->major_status
),
309 __entry
->major_status
, __entry
->minor_status
313 TRACE_EVENT(rpcgss_svc_authenticate
,
315 const struct svc_rqst
*rqstp
,
316 const struct rpc_gss_wire_cred
*gc
324 __string(addr
, rqstp
->rq_xprt
->xpt_remotebuf
)
328 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
329 __entry
->seqno
= gc
->gc_seq
;
333 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr
),
334 __entry
->xid
, __entry
->seqno
)
339 ** GSS auth unwrap failures
342 TRACE_EVENT(rpcgss_unwrap_failed
,
344 const struct rpc_task
*task
350 __field(unsigned int, task_id
)
351 __field(unsigned int, client_id
)
355 __entry
->task_id
= task
->tk_pid
;
356 __entry
->client_id
= task
->tk_client
->cl_clid
;
359 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
,
360 __entry
->task_id
, __entry
->client_id
)
363 TRACE_EVENT(rpcgss_bad_seqno
,
365 const struct rpc_task
*task
,
370 TP_ARGS(task
, expected
, received
),
373 __field(unsigned int, task_id
)
374 __field(unsigned int, client_id
)
375 __field(u32
, expected
)
376 __field(u32
, received
)
380 __entry
->task_id
= task
->tk_pid
;
381 __entry
->client_id
= task
->tk_client
->cl_clid
;
382 __entry
->expected
= expected
;
383 __entry
->received
= received
;
386 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
387 " expected seqno %u, received seqno %u",
388 __entry
->task_id
, __entry
->client_id
,
389 __entry
->expected
, __entry
->received
)
392 TRACE_EVENT(rpcgss_seqno
,
394 const struct rpc_task
*task
400 __field(unsigned int, task_id
)
401 __field(unsigned int, client_id
)
407 const struct rpc_rqst
*rqst
= task
->tk_rqstp
;
409 __entry
->task_id
= task
->tk_pid
;
410 __entry
->client_id
= task
->tk_client
->cl_clid
;
411 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
412 __entry
->seqno
= rqst
->rq_seqno
;
415 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
" xid=0x%08x seqno=%u",
416 __entry
->task_id
, __entry
->client_id
,
417 __entry
->xid
, __entry
->seqno
)
420 TRACE_EVENT(rpcgss_need_reencode
,
422 const struct rpc_task
*task
,
427 TP_ARGS(task
, seq_xmit
, ret
),
430 __field(unsigned int, task_id
)
431 __field(unsigned int, client_id
)
433 __field(u32
, seq_xmit
)
439 __entry
->task_id
= task
->tk_pid
;
440 __entry
->client_id
= task
->tk_client
->cl_clid
;
441 __entry
->xid
= be32_to_cpu(task
->tk_rqstp
->rq_xid
);
442 __entry
->seq_xmit
= seq_xmit
;
443 __entry
->seqno
= task
->tk_rqstp
->rq_seqno
;
447 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
448 " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
449 __entry
->task_id
, __entry
->client_id
,
450 __entry
->xid
, __entry
->seqno
, __entry
->seq_xmit
,
451 __entry
->ret
? "" : "un")
454 TRACE_EVENT(rpcgss_update_slack
,
456 const struct rpc_task
*task
,
457 const struct rpc_auth
*auth
463 __field(unsigned int, task_id
)
464 __field(unsigned int, client_id
)
466 __field(const void *, auth
)
467 __field(unsigned int, rslack
)
468 __field(unsigned int, ralign
)
469 __field(unsigned int, verfsize
)
473 __entry
->task_id
= task
->tk_pid
;
474 __entry
->client_id
= task
->tk_client
->cl_clid
;
475 __entry
->xid
= be32_to_cpu(task
->tk_rqstp
->rq_xid
);
476 __entry
->auth
= auth
;
477 __entry
->rslack
= auth
->au_rslack
;
478 __entry
->ralign
= auth
->au_ralign
;
479 __entry
->verfsize
= auth
->au_verfsize
;
482 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
483 " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
484 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
485 __entry
->auth
, __entry
->rslack
, __entry
->ralign
,
489 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class
,
491 const struct svc_rqst
*rqstp
,
495 TP_ARGS(rqstp
, seqno
),
503 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
504 __entry
->seqno
= seqno
;
507 TP_printk("xid=0x%08x seqno=%u",
508 __entry
->xid
, __entry
->seqno
)
511 #define DEFINE_SVC_SEQNO_EVENT(name) \
512 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \
514 const struct svc_rqst *rqstp, \
517 TP_ARGS(rqstp, seqno))
519 DEFINE_SVC_SEQNO_EVENT(large
);
520 DEFINE_SVC_SEQNO_EVENT(seen
);
522 TRACE_EVENT(rpcgss_svc_seqno_low
,
524 const struct svc_rqst
*rqstp
,
530 TP_ARGS(rqstp
, seqno
, min
, max
),
540 __entry
->xid
= be32_to_cpu(rqstp
->rq_xid
);
541 __entry
->seqno
= seqno
;
546 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]",
547 __entry
->xid
, __entry
->seqno
, __entry
->min
, __entry
->max
)
551 ** gssd upcall related trace events
554 TRACE_EVENT(rpcgss_upcall_msg
,
569 TP_printk("msg='%s'", __get_str(msg
))
572 TRACE_EVENT(rpcgss_upcall_result
,
578 TP_ARGS(uid
, result
),
588 __entry
->result
= result
;
591 TP_printk("for uid %u, result=%d", __entry
->uid
, __entry
->result
)
594 TRACE_EVENT(rpcgss_context
,
597 unsigned long expiry
,
599 unsigned int timeout
,
604 TP_ARGS(window_size
, expiry
, now
, timeout
, len
, data
),
607 __field(unsigned long, expiry
)
608 __field(unsigned long, now
)
609 __field(unsigned int, timeout
)
610 __field(u32
, window_size
)
612 __string_len(acceptor
, data
, len
)
616 __entry
->expiry
= expiry
;
618 __entry
->timeout
= timeout
;
619 __entry
->window_size
= window_size
;
621 __assign_str(acceptor
);
624 TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",
625 __entry
->window_size
, __entry
->expiry
, __entry
->now
,
626 __entry
->timeout
, __entry
->len
, __get_str(acceptor
))
631 ** Miscellaneous events
634 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5
);
635 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I
);
636 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P
);
638 #define show_pseudoflavor(x) \
639 __print_symbolic(x, \
640 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \
641 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \
642 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" })
645 TRACE_EVENT(rpcgss_createauth
,
651 TP_ARGS(flavor
, error
),
654 __field(unsigned int, flavor
)
660 __entry
->flavor
= flavor
;
661 __entry
->error
= error
;
664 TP_printk("flavor=%s error=%d",
665 show_pseudoflavor(__entry
->flavor
), __entry
->error
)
668 TRACE_EVENT(rpcgss_oid_to_mech
,
683 TP_printk("mech for oid %s was not found", __get_str(oid
))
686 #endif /* _TRACE_RPCGSS_H */
688 #include <trace/define_trace.h>