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(RPC_GSS_SVC_NONE); 21 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY); 22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY); 23 24 #define show_gss_service(x) \ 25 __print_symbolic(x, \ 26 { RPC_GSS_SVC_NONE, "none" }, \ 27 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \ 28 { RPC_GSS_SVC_PRIVACY, "privacy" }) 29 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); 53 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" }) 79 80 81 DECLARE_EVENT_CLASS(rpcgss_gssapi_event, 82 TP_PROTO( 83 const struct rpc_task *task, 84 u32 maj_stat 85 ), 86 87 TP_ARGS(task, maj_stat), 88 89 TP_STRUCT__entry( 90 __field(unsigned int, task_id) 91 __field(unsigned int, client_id) 92 __field(u32, maj_stat) 93 94 ), 95 96 TP_fast_assign( 97 __entry->task_id = task->tk_pid; 98 __entry->client_id = task->tk_client->cl_clid; 99 __entry->maj_stat = maj_stat; 100 ), 101 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)) 106 ); 107 108 #define DEFINE_GSSAPI_EVENT(name) \ 109 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \ 110 TP_PROTO( \ 111 const struct rpc_task *task, \ 112 u32 maj_stat \ 113 ), \ 114 TP_ARGS(task, maj_stat)) 115 116 TRACE_EVENT(rpcgss_import_ctx, 117 TP_PROTO( 118 int status 119 ), 120 121 TP_ARGS(status), 122 123 TP_STRUCT__entry( 124 __field(int, status) 125 ), 126 127 TP_fast_assign( 128 __entry->status = status; 129 ), 130 131 TP_printk("status=%d", __entry->status) 132 ); 133 134 DEFINE_GSSAPI_EVENT(get_mic); 135 DEFINE_GSSAPI_EVENT(verify_mic); 136 DEFINE_GSSAPI_EVENT(wrap); 137 DEFINE_GSSAPI_EVENT(unwrap); 138 139 DECLARE_EVENT_CLASS(rpcgss_ctx_class, 140 TP_PROTO( 141 const struct gss_cred *gc 142 ), 143 144 TP_ARGS(gc), 145 146 TP_STRUCT__entry( 147 __field(const void *, cred) 148 __field(unsigned long, service) 149 __string(principal, gc->gc_principal) 150 ), 151 152 TP_fast_assign( 153 __entry->cred = gc; 154 __entry->service = gc->gc_service; 155 __assign_str(principal, gc->gc_principal) 156 ), 157 158 TP_printk("cred=%p service=%s principal='%s'", 159 __entry->cred, show_gss_service(__entry->service), 160 __get_str(principal)) 161 ); 162 163 #define DEFINE_CTX_EVENT(name) \ 164 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \ 165 TP_PROTO( \ 166 const struct gss_cred *gc \ 167 ), \ 168 TP_ARGS(gc)) 169 170 DEFINE_CTX_EVENT(init); 171 DEFINE_CTX_EVENT(destroy); 172 173 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class, 174 TP_PROTO( 175 const struct svc_rqst *rqstp, 176 u32 maj_stat 177 ), 178 179 TP_ARGS(rqstp, maj_stat), 180 181 TP_STRUCT__entry( 182 __field(u32, xid) 183 __field(u32, maj_stat) 184 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 185 ), 186 187 TP_fast_assign( 188 __entry->xid = __be32_to_cpu(rqstp->rq_xid); 189 __entry->maj_stat = maj_stat; 190 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 191 ), 192 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)) 197 ); 198 199 #define DEFINE_SVC_GSSAPI_EVENT(name) \ 200 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \ 201 TP_PROTO( \ 202 const struct svc_rqst *rqstp, \ 203 u32 maj_stat \ 204 ), \ 205 TP_ARGS(rqstp, maj_stat)) 206 207 DEFINE_SVC_GSSAPI_EVENT(unwrap); 208 DEFINE_SVC_GSSAPI_EVENT(mic); 209 210 TRACE_EVENT(rpcgss_svc_unwrap_failed, 211 TP_PROTO( 212 const struct svc_rqst *rqstp 213 ), 214 215 TP_ARGS(rqstp), 216 217 TP_STRUCT__entry( 218 __field(u32, xid) 219 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 220 ), 221 222 TP_fast_assign( 223 __entry->xid = be32_to_cpu(rqstp->rq_xid); 224 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 225 ), 226 227 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid) 228 ); 229 230 TRACE_EVENT(rpcgss_svc_seqno_bad, 231 TP_PROTO( 232 const struct svc_rqst *rqstp, 233 u32 expected, 234 u32 received 235 ), 236 237 TP_ARGS(rqstp, expected, received), 238 239 TP_STRUCT__entry( 240 __field(u32, expected) 241 __field(u32, received) 242 __field(u32, xid) 243 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 244 ), 245 246 TP_fast_assign( 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); 251 ), 252 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) 256 ); 257 258 TRACE_EVENT(rpcgss_svc_accept_upcall, 259 TP_PROTO( 260 const struct svc_rqst *rqstp, 261 u32 major_status, 262 u32 minor_status 263 ), 264 265 TP_ARGS(rqstp, major_status, minor_status), 266 267 TP_STRUCT__entry( 268 __field(u32, minor_status) 269 __field(unsigned long, major_status) 270 __field(u32, xid) 271 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 272 ), 273 274 TP_fast_assign( 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); 279 ), 280 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 286 ) 287 ); 288 289 TRACE_EVENT(rpcgss_svc_authenticate, 290 TP_PROTO( 291 const struct svc_rqst *rqstp, 292 const struct rpc_gss_wire_cred *gc 293 ), 294 295 TP_ARGS(rqstp, gc), 296 297 TP_STRUCT__entry( 298 __field(u32, seqno) 299 __field(u32, xid) 300 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 301 ), 302 303 TP_fast_assign( 304 __entry->xid = be32_to_cpu(rqstp->rq_xid); 305 __entry->seqno = gc->gc_seq; 306 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 307 ), 308 309 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr), 310 __entry->xid, __entry->seqno) 311 ); 312 313 314 /** 315 ** GSS auth unwrap failures 316 **/ 317 318 TRACE_EVENT(rpcgss_unwrap_failed, 319 TP_PROTO( 320 const struct rpc_task *task 321 ), 322 323 TP_ARGS(task), 324 325 TP_STRUCT__entry( 326 __field(unsigned int, task_id) 327 __field(unsigned int, client_id) 328 ), 329 330 TP_fast_assign( 331 __entry->task_id = task->tk_pid; 332 __entry->client_id = task->tk_client->cl_clid; 333 ), 334 335 TP_printk("task:%u@%u", __entry->task_id, __entry->client_id) 336 ); 337 338 TRACE_EVENT(rpcgss_bad_seqno, 339 TP_PROTO( 340 const struct rpc_task *task, 341 u32 expected, 342 u32 received 343 ), 344 345 TP_ARGS(task, expected, received), 346 347 TP_STRUCT__entry( 348 __field(unsigned int, task_id) 349 __field(unsigned int, client_id) 350 __field(u32, expected) 351 __field(u32, received) 352 ), 353 354 TP_fast_assign( 355 __entry->task_id = task->tk_pid; 356 __entry->client_id = task->tk_client->cl_clid; 357 __entry->expected = expected; 358 __entry->received = received; 359 ), 360 361 TP_printk("task:%u@%u expected seqno %u, received seqno %u", 362 __entry->task_id, __entry->client_id, 363 __entry->expected, __entry->received) 364 ); 365 366 TRACE_EVENT(rpcgss_seqno, 367 TP_PROTO( 368 const struct rpc_task *task 369 ), 370 371 TP_ARGS(task), 372 373 TP_STRUCT__entry( 374 __field(unsigned int, task_id) 375 __field(unsigned int, client_id) 376 __field(u32, xid) 377 __field(u32, seqno) 378 ), 379 380 TP_fast_assign( 381 const struct rpc_rqst *rqst = task->tk_rqstp; 382 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; 387 ), 388 389 TP_printk("task:%u@%u xid=0x%08x seqno=%u", 390 __entry->task_id, __entry->client_id, 391 __entry->xid, __entry->seqno) 392 ); 393 394 TRACE_EVENT(rpcgss_need_reencode, 395 TP_PROTO( 396 const struct rpc_task *task, 397 u32 seq_xmit, 398 bool ret 399 ), 400 401 TP_ARGS(task, seq_xmit, ret), 402 403 TP_STRUCT__entry( 404 __field(unsigned int, task_id) 405 __field(unsigned int, client_id) 406 __field(u32, xid) 407 __field(u32, seq_xmit) 408 __field(u32, seqno) 409 __field(bool, ret) 410 ), 411 412 TP_fast_assign( 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; 418 __entry->ret = ret; 419 ), 420 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") 425 ); 426 427 TRACE_EVENT(rpcgss_update_slack, 428 TP_PROTO( 429 const struct rpc_task *task, 430 const struct rpc_auth *auth 431 ), 432 433 TP_ARGS(task, auth), 434 435 TP_STRUCT__entry( 436 __field(unsigned int, task_id) 437 __field(unsigned int, client_id) 438 __field(u32, xid) 439 __field(const void *, auth) 440 __field(unsigned int, rslack) 441 __field(unsigned int, ralign) 442 __field(unsigned int, verfsize) 443 ), 444 445 TP_fast_assign( 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; 453 ), 454 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, 458 __entry->verfsize) 459 ); 460 461 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class, 462 TP_PROTO( 463 const struct svc_rqst *rqstp, 464 u32 seqno 465 ), 466 467 TP_ARGS(rqstp, seqno), 468 469 TP_STRUCT__entry( 470 __field(u32, xid) 471 __field(u32, seqno) 472 ), 473 474 TP_fast_assign( 475 __entry->xid = be32_to_cpu(rqstp->rq_xid); 476 __entry->seqno = seqno; 477 ), 478 479 TP_printk("xid=0x%08x seqno=%u", 480 __entry->xid, __entry->seqno) 481 ); 482 483 #define DEFINE_SVC_SEQNO_EVENT(name) \ 484 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \ 485 TP_PROTO( \ 486 const struct svc_rqst *rqstp, \ 487 u32 seqno \ 488 ), \ 489 TP_ARGS(rqstp, seqno)) 490 491 DEFINE_SVC_SEQNO_EVENT(large); 492 DEFINE_SVC_SEQNO_EVENT(seen); 493 494 TRACE_EVENT(rpcgss_svc_seqno_low, 495 TP_PROTO( 496 const struct svc_rqst *rqstp, 497 u32 seqno, 498 u32 min, 499 u32 max 500 ), 501 502 TP_ARGS(rqstp, seqno, min, max), 503 504 TP_STRUCT__entry( 505 __field(u32, xid) 506 __field(u32, seqno) 507 __field(u32, min) 508 __field(u32, max) 509 ), 510 511 TP_fast_assign( 512 __entry->xid = be32_to_cpu(rqstp->rq_xid); 513 __entry->seqno = seqno; 514 __entry->min = min; 515 __entry->max = max; 516 ), 517 518 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]", 519 __entry->xid, __entry->seqno, __entry->min, __entry->max) 520 ); 521 522 /** 523 ** gssd upcall related trace events 524 **/ 525 526 TRACE_EVENT(rpcgss_upcall_msg, 527 TP_PROTO( 528 const char *buf 529 ), 530 531 TP_ARGS(buf), 532 533 TP_STRUCT__entry( 534 __string(msg, buf) 535 ), 536 537 TP_fast_assign( 538 __assign_str(msg, buf) 539 ), 540 541 TP_printk("msg='%s'", __get_str(msg)) 542 ); 543 544 TRACE_EVENT(rpcgss_upcall_result, 545 TP_PROTO( 546 u32 uid, 547 int result 548 ), 549 550 TP_ARGS(uid, result), 551 552 TP_STRUCT__entry( 553 __field(u32, uid) 554 __field(int, result) 555 556 ), 557 558 TP_fast_assign( 559 __entry->uid = uid; 560 __entry->result = result; 561 ), 562 563 TP_printk("for uid %u, result=%d", __entry->uid, __entry->result) 564 ); 565 566 TRACE_EVENT(rpcgss_context, 567 TP_PROTO( 568 u32 window_size, 569 unsigned long expiry, 570 unsigned long now, 571 unsigned int timeout, 572 unsigned int len, 573 const u8 *data 574 ), 575 576 TP_ARGS(window_size, expiry, now, timeout, len, data), 577 578 TP_STRUCT__entry( 579 __field(unsigned long, expiry) 580 __field(unsigned long, now) 581 __field(unsigned int, timeout) 582 __field(u32, window_size) 583 __field(int, len) 584 __string(acceptor, data) 585 ), 586 587 TP_fast_assign( 588 __entry->expiry = expiry; 589 __entry->now = now; 590 __entry->timeout = timeout; 591 __entry->window_size = window_size; 592 __entry->len = len; 593 strncpy(__get_str(acceptor), data, len); 594 ), 595 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)) 599 ); 600 601 602 /** 603 ** Miscellaneous events 604 */ 605 606 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 607 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 608 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 609 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" }) 615 616 617 TRACE_EVENT(rpcgss_createauth, 618 TP_PROTO( 619 unsigned int flavor, 620 int error 621 ), 622 623 TP_ARGS(flavor, error), 624 625 TP_STRUCT__entry( 626 __field(unsigned int, flavor) 627 __field(int, error) 628 629 ), 630 631 TP_fast_assign( 632 __entry->flavor = flavor; 633 __entry->error = error; 634 ), 635 636 TP_printk("flavor=%s error=%d", 637 show_pseudoflavor(__entry->flavor), __entry->error) 638 ); 639 640 TRACE_EVENT(rpcgss_oid_to_mech, 641 TP_PROTO( 642 const char *oid 643 ), 644 645 TP_ARGS(oid), 646 647 TP_STRUCT__entry( 648 __string(oid, oid) 649 ), 650 651 TP_fast_assign( 652 __assign_str(oid, oid); 653 ), 654 655 TP_printk("mech for oid %s was not found", __get_str(oid)) 656 ); 657 658 #endif /* _TRACE_RPCGSS_H */ 659 660 #include <trace/define_trace.h> 661