1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2018 Oracle. All rights reserved. 4 * 5 * Trace point definitions for the "rpcgss" subsystem. 6 */ 7 8 #undef TRACE_SYSTEM 9 #define TRACE_SYSTEM rpcgss 10 11 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ) 12 #define _TRACE_RPCGSS_H 13 14 #include <linux/tracepoint.h> 15 16 /** 17 ** GSS-API related trace events 18 **/ 19 20 TRACE_DEFINE_ENUM(GSS_S_BAD_MECH); 21 TRACE_DEFINE_ENUM(GSS_S_BAD_NAME); 22 TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE); 23 TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS); 24 TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS); 25 TRACE_DEFINE_ENUM(GSS_S_BAD_SIG); 26 TRACE_DEFINE_ENUM(GSS_S_NO_CRED); 27 TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT); 28 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN); 29 TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL); 30 TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED); 31 TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED); 32 TRACE_DEFINE_ENUM(GSS_S_FAILURE); 33 TRACE_DEFINE_ENUM(GSS_S_BAD_QOP); 34 TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED); 35 TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE); 36 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT); 37 TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN); 38 TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED); 39 TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN); 40 TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN); 41 TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN); 42 TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN); 43 44 #define show_gss_status(x) \ 45 __print_flags(x, "|", \ 46 { GSS_S_BAD_MECH, "GSS_S_BAD_MECH" }, \ 47 { GSS_S_BAD_NAME, "GSS_S_BAD_NAME" }, \ 48 { GSS_S_BAD_NAMETYPE, "GSS_S_BAD_NAMETYPE" }, \ 49 { GSS_S_BAD_BINDINGS, "GSS_S_BAD_BINDINGS" }, \ 50 { GSS_S_BAD_STATUS, "GSS_S_BAD_STATUS" }, \ 51 { GSS_S_BAD_SIG, "GSS_S_BAD_SIG" }, \ 52 { GSS_S_NO_CRED, "GSS_S_NO_CRED" }, \ 53 { GSS_S_NO_CONTEXT, "GSS_S_NO_CONTEXT" }, \ 54 { GSS_S_DEFECTIVE_TOKEN, "GSS_S_DEFECTIVE_TOKEN" }, \ 55 { GSS_S_DEFECTIVE_CREDENTIAL, "GSS_S_DEFECTIVE_CREDENTIAL" }, \ 56 { GSS_S_CREDENTIALS_EXPIRED, "GSS_S_CREDENTIALS_EXPIRED" }, \ 57 { GSS_S_CONTEXT_EXPIRED, "GSS_S_CONTEXT_EXPIRED" }, \ 58 { GSS_S_FAILURE, "GSS_S_FAILURE" }, \ 59 { GSS_S_BAD_QOP, "GSS_S_BAD_QOP" }, \ 60 { GSS_S_UNAUTHORIZED, "GSS_S_UNAUTHORIZED" }, \ 61 { GSS_S_UNAVAILABLE, "GSS_S_UNAVAILABLE" }, \ 62 { GSS_S_DUPLICATE_ELEMENT, "GSS_S_DUPLICATE_ELEMENT" }, \ 63 { GSS_S_NAME_NOT_MN, "GSS_S_NAME_NOT_MN" }, \ 64 { GSS_S_CONTINUE_NEEDED, "GSS_S_CONTINUE_NEEDED" }, \ 65 { GSS_S_DUPLICATE_TOKEN, "GSS_S_DUPLICATE_TOKEN" }, \ 66 { GSS_S_OLD_TOKEN, "GSS_S_OLD_TOKEN" }, \ 67 { GSS_S_UNSEQ_TOKEN, "GSS_S_UNSEQ_TOKEN" }, \ 68 { GSS_S_GAP_TOKEN, "GSS_S_GAP_TOKEN" }) 69 70 71 DECLARE_EVENT_CLASS(rpcgss_gssapi_event, 72 TP_PROTO( 73 const struct rpc_task *task, 74 u32 maj_stat 75 ), 76 77 TP_ARGS(task, maj_stat), 78 79 TP_STRUCT__entry( 80 __field(unsigned int, task_id) 81 __field(unsigned int, client_id) 82 __field(u32, maj_stat) 83 84 ), 85 86 TP_fast_assign( 87 __entry->task_id = task->tk_pid; 88 __entry->client_id = task->tk_client->cl_clid; 89 __entry->maj_stat = maj_stat; 90 ), 91 92 TP_printk("task:%u@%u maj_stat=%s", 93 __entry->task_id, __entry->client_id, 94 __entry->maj_stat == 0 ? 95 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat)) 96 ); 97 98 #define DEFINE_GSSAPI_EVENT(name) \ 99 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \ 100 TP_PROTO( \ 101 const struct rpc_task *task, \ 102 u32 maj_stat \ 103 ), \ 104 TP_ARGS(task, maj_stat)) 105 106 TRACE_EVENT(rpcgss_import_ctx, 107 TP_PROTO( 108 int status 109 ), 110 111 TP_ARGS(status), 112 113 TP_STRUCT__entry( 114 __field(int, status) 115 ), 116 117 TP_fast_assign( 118 __entry->status = status; 119 ), 120 121 TP_printk("status=%d", __entry->status) 122 ); 123 124 DEFINE_GSSAPI_EVENT(get_mic); 125 DEFINE_GSSAPI_EVENT(verify_mic); 126 DEFINE_GSSAPI_EVENT(wrap); 127 DEFINE_GSSAPI_EVENT(unwrap); 128 129 TRACE_EVENT(rpcgss_svc_accept_upcall, 130 TP_PROTO( 131 __be32 xid, 132 u32 major_status, 133 u32 minor_status 134 ), 135 136 TP_ARGS(xid, major_status, minor_status), 137 138 TP_STRUCT__entry( 139 __field(u32, xid) 140 __field(u32, minor_status) 141 __field(unsigned long, major_status) 142 ), 143 144 TP_fast_assign( 145 __entry->xid = be32_to_cpu(xid); 146 __entry->minor_status = minor_status; 147 __entry->major_status = major_status; 148 ), 149 150 TP_printk("xid=0x%08x major_status=%s (0x%08lx) minor_status=%u", 151 __entry->xid, __entry->major_status == 0 ? "GSS_S_COMPLETE" : 152 show_gss_status(__entry->major_status), 153 __entry->major_status, __entry->minor_status 154 ) 155 ); 156 157 TRACE_EVENT(rpcgss_svc_accept, 158 TP_PROTO( 159 __be32 xid, 160 size_t len 161 ), 162 163 TP_ARGS(xid, len), 164 165 TP_STRUCT__entry( 166 __field(u32, xid) 167 __field(size_t, len) 168 ), 169 170 TP_fast_assign( 171 __entry->xid = be32_to_cpu(xid); 172 __entry->len = len; 173 ), 174 175 TP_printk("xid=0x%08x len=%zu", 176 __entry->xid, __entry->len 177 ) 178 ); 179 180 181 /** 182 ** GSS auth unwrap failures 183 **/ 184 185 TRACE_EVENT(rpcgss_unwrap_failed, 186 TP_PROTO( 187 const struct rpc_task *task 188 ), 189 190 TP_ARGS(task), 191 192 TP_STRUCT__entry( 193 __field(unsigned int, task_id) 194 __field(unsigned int, client_id) 195 ), 196 197 TP_fast_assign( 198 __entry->task_id = task->tk_pid; 199 __entry->client_id = task->tk_client->cl_clid; 200 ), 201 202 TP_printk("task:%u@%u", __entry->task_id, __entry->client_id) 203 ); 204 205 TRACE_EVENT(rpcgss_bad_seqno, 206 TP_PROTO( 207 const struct rpc_task *task, 208 u32 expected, 209 u32 received 210 ), 211 212 TP_ARGS(task, expected, received), 213 214 TP_STRUCT__entry( 215 __field(unsigned int, task_id) 216 __field(unsigned int, client_id) 217 __field(u32, expected) 218 __field(u32, received) 219 ), 220 221 TP_fast_assign( 222 __entry->task_id = task->tk_pid; 223 __entry->client_id = task->tk_client->cl_clid; 224 __entry->expected = expected; 225 __entry->received = received; 226 ), 227 228 TP_printk("task:%u@%u expected seqno %u, received seqno %u", 229 __entry->task_id, __entry->client_id, 230 __entry->expected, __entry->received) 231 ); 232 233 TRACE_EVENT(rpcgss_seqno, 234 TP_PROTO( 235 const struct rpc_task *task 236 ), 237 238 TP_ARGS(task), 239 240 TP_STRUCT__entry( 241 __field(unsigned int, task_id) 242 __field(unsigned int, client_id) 243 __field(u32, xid) 244 __field(u32, seqno) 245 ), 246 247 TP_fast_assign( 248 const struct rpc_rqst *rqst = task->tk_rqstp; 249 250 __entry->task_id = task->tk_pid; 251 __entry->client_id = task->tk_client->cl_clid; 252 __entry->xid = be32_to_cpu(rqst->rq_xid); 253 __entry->seqno = rqst->rq_seqno; 254 ), 255 256 TP_printk("task:%u@%u xid=0x%08x seqno=%u", 257 __entry->task_id, __entry->client_id, 258 __entry->xid, __entry->seqno) 259 ); 260 261 TRACE_EVENT(rpcgss_need_reencode, 262 TP_PROTO( 263 const struct rpc_task *task, 264 u32 seq_xmit, 265 bool ret 266 ), 267 268 TP_ARGS(task, seq_xmit, ret), 269 270 TP_STRUCT__entry( 271 __field(unsigned int, task_id) 272 __field(unsigned int, client_id) 273 __field(u32, xid) 274 __field(u32, seq_xmit) 275 __field(u32, seqno) 276 __field(bool, ret) 277 ), 278 279 TP_fast_assign( 280 __entry->task_id = task->tk_pid; 281 __entry->client_id = task->tk_client->cl_clid; 282 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 283 __entry->seq_xmit = seq_xmit; 284 __entry->seqno = task->tk_rqstp->rq_seqno; 285 __entry->ret = ret; 286 ), 287 288 TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded", 289 __entry->task_id, __entry->client_id, 290 __entry->xid, __entry->seqno, __entry->seq_xmit, 291 __entry->ret ? "" : "un") 292 ); 293 294 TRACE_EVENT(rpcgss_update_slack, 295 TP_PROTO( 296 const struct rpc_task *task, 297 const struct rpc_auth *auth 298 ), 299 300 TP_ARGS(task, auth), 301 302 TP_STRUCT__entry( 303 __field(unsigned int, task_id) 304 __field(unsigned int, client_id) 305 __field(u32, xid) 306 __field(const void *, auth) 307 __field(unsigned int, rslack) 308 __field(unsigned int, ralign) 309 __field(unsigned int, verfsize) 310 ), 311 312 TP_fast_assign( 313 __entry->task_id = task->tk_pid; 314 __entry->client_id = task->tk_client->cl_clid; 315 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 316 __entry->auth = auth; 317 __entry->rslack = auth->au_rslack; 318 __entry->ralign = auth->au_ralign; 319 __entry->verfsize = auth->au_verfsize; 320 ), 321 322 TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n", 323 __entry->task_id, __entry->client_id, __entry->xid, 324 __entry->auth, __entry->rslack, __entry->ralign, 325 __entry->verfsize) 326 ); 327 328 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class, 329 TP_PROTO( 330 __be32 xid, 331 u32 seqno 332 ), 333 334 TP_ARGS(xid, seqno), 335 336 TP_STRUCT__entry( 337 __field(u32, xid) 338 __field(u32, seqno) 339 ), 340 341 TP_fast_assign( 342 __entry->xid = be32_to_cpu(xid); 343 __entry->seqno = seqno; 344 ), 345 346 TP_printk("xid=0x%08x seqno=%u, request discarded", 347 __entry->xid, __entry->seqno) 348 ); 349 350 #define DEFINE_SVC_SEQNO_EVENT(name) \ 351 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_##name, \ 352 TP_PROTO( \ 353 __be32 xid, \ 354 u32 seqno \ 355 ), \ 356 TP_ARGS(xid, seqno)) 357 358 DEFINE_SVC_SEQNO_EVENT(large_seqno); 359 DEFINE_SVC_SEQNO_EVENT(old_seqno); 360 361 362 /** 363 ** gssd upcall related trace events 364 **/ 365 366 TRACE_EVENT(rpcgss_upcall_msg, 367 TP_PROTO( 368 const char *buf 369 ), 370 371 TP_ARGS(buf), 372 373 TP_STRUCT__entry( 374 __string(msg, buf) 375 ), 376 377 TP_fast_assign( 378 __assign_str(msg, buf) 379 ), 380 381 TP_printk("msg='%s'", __get_str(msg)) 382 ); 383 384 TRACE_EVENT(rpcgss_upcall_result, 385 TP_PROTO( 386 u32 uid, 387 int result 388 ), 389 390 TP_ARGS(uid, result), 391 392 TP_STRUCT__entry( 393 __field(u32, uid) 394 __field(int, result) 395 396 ), 397 398 TP_fast_assign( 399 __entry->uid = uid; 400 __entry->result = result; 401 ), 402 403 TP_printk("for uid %u, result=%d", __entry->uid, __entry->result) 404 ); 405 406 TRACE_EVENT(rpcgss_context, 407 TP_PROTO( 408 unsigned long expiry, 409 unsigned long now, 410 unsigned int timeout, 411 unsigned int len, 412 const u8 *data 413 ), 414 415 TP_ARGS(expiry, now, timeout, len, data), 416 417 TP_STRUCT__entry( 418 __field(unsigned long, expiry) 419 __field(unsigned long, now) 420 __field(unsigned int, timeout) 421 __field(int, len) 422 __string(acceptor, data) 423 ), 424 425 TP_fast_assign( 426 __entry->expiry = expiry; 427 __entry->now = now; 428 __entry->timeout = timeout; 429 __entry->len = len; 430 strncpy(__get_str(acceptor), data, len); 431 ), 432 433 TP_printk("gc_expiry=%lu now=%lu timeout=%u acceptor=%.*s", 434 __entry->expiry, __entry->now, __entry->timeout, 435 __entry->len, __get_str(acceptor)) 436 ); 437 438 439 /** 440 ** Miscellaneous events 441 */ 442 443 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 444 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 445 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 446 447 #define show_pseudoflavor(x) \ 448 __print_symbolic(x, \ 449 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \ 450 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \ 451 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" }) 452 453 454 TRACE_EVENT(rpcgss_createauth, 455 TP_PROTO( 456 unsigned int flavor, 457 int error 458 ), 459 460 TP_ARGS(flavor, error), 461 462 TP_STRUCT__entry( 463 __field(unsigned int, flavor) 464 __field(int, error) 465 466 ), 467 468 TP_fast_assign( 469 __entry->flavor = flavor; 470 __entry->error = error; 471 ), 472 473 TP_printk("flavor=%s error=%d", 474 show_pseudoflavor(__entry->flavor), __entry->error) 475 ); 476 477 TRACE_EVENT(rpcgss_oid_to_mech, 478 TP_PROTO( 479 const char *oid 480 ), 481 482 TP_ARGS(oid), 483 484 TP_STRUCT__entry( 485 __string(oid, oid) 486 ), 487 488 TP_fast_assign( 489 __assign_str(oid, oid); 490 ), 491 492 TP_printk("mech for oid %s was not found", __get_str(oid)) 493 ); 494 495 #endif /* _TRACE_RPCGSS_H */ 496 497 #include <trace/define_trace.h> 498