1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Copyright (c) 2018 Oracle. All rights rese 4 * 5 * Trace point definitions for the "rpcgss" su 6 */ 7 8 #undef TRACE_SYSTEM 9 #define TRACE_SYSTEM rpcgss 10 11 #if !defined(_TRACE_RPCGSS_H) || defined(TRACE 12 #define _TRACE_RPCGSS_H 13 14 #include <linux/tracepoint.h> 15 16 #include <trace/misc/sunrpc.h> 17 18 /** 19 ** GSS-API related trace events 20 **/ 21 22 TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE); 23 TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY); 24 TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY); 25 26 #define show_gss_service(x) 27 __print_symbolic(x, 28 { RPC_GSS_SVC_NONE, 29 { RPC_GSS_SVC_INTEGRITY, 30 { RPC_GSS_SVC_PRIVACY, 31 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); 55 56 #define show_gss_status(x) 57 __print_symbolic(x, 58 { GSS_S_BAD_MECH, "GSS_S_BAD_M 59 { GSS_S_BAD_NAME, "GSS_S_BAD_N 60 { GSS_S_BAD_NAMETYPE, "GSS_S_B 61 { GSS_S_BAD_BINDINGS, "GSS_S_B 62 { GSS_S_BAD_STATUS, "GSS_S_BAD 63 { GSS_S_BAD_SIG, "GSS_S_BAD_SI 64 { GSS_S_NO_CRED, "GSS_S_NO_CRE 65 { GSS_S_NO_CONTEXT, "GSS_S_NO_ 66 { GSS_S_DEFECTIVE_TOKEN, "GSS_ 67 { GSS_S_DEFECTIVE_CREDENTIAL, 68 { GSS_S_CREDENTIALS_EXPIRED, " 69 { GSS_S_CONTEXT_EXPIRED, "GSS_ 70 { GSS_S_FAILURE, "GSS_S_FAILUR 71 { GSS_S_BAD_QOP, "GSS_S_BAD_QO 72 { GSS_S_UNAUTHORIZED, "GSS_S_U 73 { GSS_S_UNAVAILABLE, "GSS_S_UN 74 { GSS_S_DUPLICATE_ELEMENT, "GS 75 { GSS_S_NAME_NOT_MN, "GSS_S_NA 76 { GSS_S_CONTINUE_NEEDED, "GSS_ 77 { GSS_S_DUPLICATE_TOKEN, "GSS_ 78 { GSS_S_OLD_TOKEN, "GSS_S_OLD_ 79 { GSS_S_UNSEQ_TOKEN, "GSS_S_UN 80 { GSS_S_GAP_TOKEN, "GSS_S_GAP_ 81 82 83 DECLARE_EVENT_CLASS(rpcgss_gssapi_event, 84 TP_PROTO( 85 const struct rpc_task *task, 86 u32 maj_stat 87 ), 88 89 TP_ARGS(task, maj_stat), 90 91 TP_STRUCT__entry( 92 __field(unsigned int, task_id) 93 __field(unsigned int, client_i 94 __field(u32, maj_stat) 95 96 ), 97 98 TP_fast_assign( 99 __entry->task_id = task->tk_pi 100 __entry->client_id = task->tk_ 101 __entry->maj_stat = maj_stat; 102 ), 103 104 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 105 __entry->task_id, __entry->cli 106 __entry->maj_stat == 0 ? 107 "GSS_S_COMPLETE" : show_gss_st 108 ); 109 110 #define DEFINE_GSSAPI_EVENT(name) 111 DEFINE_EVENT(rpcgss_gssapi_event, rpcg 112 TP_PROTO( 113 const struct r 114 u32 maj_stat 115 ), 116 TP_ARGS(task, maj_stat 117 118 TRACE_EVENT(rpcgss_import_ctx, 119 TP_PROTO( 120 int status 121 ), 122 123 TP_ARGS(status), 124 125 TP_STRUCT__entry( 126 __field(int, status) 127 ), 128 129 TP_fast_assign( 130 __entry->status = status; 131 ), 132 133 TP_printk("status=%d", __entry->status 134 ); 135 136 DEFINE_GSSAPI_EVENT(get_mic); 137 DEFINE_GSSAPI_EVENT(verify_mic); 138 DEFINE_GSSAPI_EVENT(wrap); 139 DEFINE_GSSAPI_EVENT(unwrap); 140 141 DECLARE_EVENT_CLASS(rpcgss_ctx_class, 142 TP_PROTO( 143 const struct gss_cred *gc 144 ), 145 146 TP_ARGS(gc), 147 148 TP_STRUCT__entry( 149 __field(const void *, cred) 150 __field(unsigned long, service 151 __string(principal, gc->gc_pri 152 ), 153 154 TP_fast_assign( 155 __entry->cred = gc; 156 __entry->service = gc->gc_serv 157 __assign_str(principal); 158 ), 159 160 TP_printk("cred=%p service=%s principa 161 __entry->cred, show_gss_servic 162 __get_str(principal)) 163 ); 164 165 #define DEFINE_CTX_EVENT(name) 166 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ 167 TP_PROTO( 168 const struct g 169 ), 170 TP_ARGS(gc)) 171 172 DEFINE_CTX_EVENT(init); 173 DEFINE_CTX_EVENT(destroy); 174 175 DECLARE_EVENT_CLASS(rpcgss_svc_gssapi_class, 176 TP_PROTO( 177 const struct svc_rqst *rqstp, 178 u32 maj_stat 179 ), 180 181 TP_ARGS(rqstp, maj_stat), 182 183 TP_STRUCT__entry( 184 __field(u32, xid) 185 __field(u32, maj_stat) 186 __string(addr, rqstp->rq_xprt- 187 ), 188 189 TP_fast_assign( 190 __entry->xid = __be32_to_cpu(r 191 __entry->maj_stat = maj_stat; 192 __assign_str(addr); 193 ), 194 195 TP_printk("addr=%s xid=0x%08x maj_stat 196 __get_str(addr), __entry->xid, 197 __entry->maj_stat == 0 ? 198 "GSS_S_COMPLETE" : show_gss_st 199 ); 200 201 #define DEFINE_SVC_GSSAPI_EVENT(name) 202 DEFINE_EVENT(rpcgss_svc_gssapi_class, 203 TP_PROTO( 204 const struct s 205 u32 maj_stat 206 ), 207 TP_ARGS(rqstp, maj_sta 208 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); 213 214 TRACE_EVENT(rpcgss_svc_wrap_failed, 215 TP_PROTO( 216 const struct svc_rqst *rqstp 217 ), 218 219 TP_ARGS(rqstp), 220 221 TP_STRUCT__entry( 222 __field(u32, xid) 223 __string(addr, rqstp->rq_xprt- 224 ), 225 226 TP_fast_assign( 227 __entry->xid = be32_to_cpu(rqs 228 __assign_str(addr); 229 ), 230 231 TP_printk("addr=%s xid=0x%08x", __get_ 232 ); 233 234 TRACE_EVENT(rpcgss_svc_unwrap_failed, 235 TP_PROTO( 236 const struct svc_rqst *rqstp 237 ), 238 239 TP_ARGS(rqstp), 240 241 TP_STRUCT__entry( 242 __field(u32, xid) 243 __string(addr, rqstp->rq_xprt- 244 ), 245 246 TP_fast_assign( 247 __entry->xid = be32_to_cpu(rqs 248 __assign_str(addr); 249 ), 250 251 TP_printk("addr=%s xid=0x%08x", __get_ 252 ); 253 254 TRACE_EVENT(rpcgss_svc_seqno_bad, 255 TP_PROTO( 256 const struct svc_rqst *rqstp, 257 u32 expected, 258 u32 received 259 ), 260 261 TP_ARGS(rqstp, expected, received), 262 263 TP_STRUCT__entry( 264 __field(u32, expected) 265 __field(u32, received) 266 __field(u32, xid) 267 __string(addr, rqstp->rq_xprt- 268 ), 269 270 TP_fast_assign( 271 __entry->expected = expected; 272 __entry->received = received; 273 __entry->xid = __be32_to_cpu(r 274 __assign_str(addr); 275 ), 276 277 TP_printk("addr=%s xid=0x%08x expected 278 __get_str(addr), __entry->xid, 279 __entry->expected, __entry->re 280 ); 281 282 TRACE_EVENT(rpcgss_svc_accept_upcall, 283 TP_PROTO( 284 const struct svc_rqst *rqstp, 285 u32 major_status, 286 u32 minor_status 287 ), 288 289 TP_ARGS(rqstp, major_status, minor_sta 290 291 TP_STRUCT__entry( 292 __field(u32, minor_status) 293 __field(unsigned long, major_s 294 __field(u32, xid) 295 __string(addr, rqstp->rq_xprt- 296 ), 297 298 TP_fast_assign( 299 __entry->minor_status = minor_ 300 __entry->major_status = major_ 301 __entry->xid = be32_to_cpu(rqs 302 __assign_str(addr); 303 ), 304 305 TP_printk("addr=%s xid=0x%08x major_st 306 __get_str(addr), __entry->xid, 307 (__entry->major_status == 0) ? 308 show_gss_status(__entr 309 __entry->major_status, __entry 310 ) 311 ); 312 313 TRACE_EVENT(rpcgss_svc_authenticate, 314 TP_PROTO( 315 const struct svc_rqst *rqstp, 316 const struct rpc_gss_wire_cred 317 ), 318 319 TP_ARGS(rqstp, gc), 320 321 TP_STRUCT__entry( 322 __field(u32, seqno) 323 __field(u32, xid) 324 __string(addr, rqstp->rq_xprt- 325 ), 326 327 TP_fast_assign( 328 __entry->xid = be32_to_cpu(rqs 329 __entry->seqno = gc->gc_seq; 330 __assign_str(addr); 331 ), 332 333 TP_printk("addr=%s xid=0x%08x seqno=%u 334 __entry->xid, __entry->seqno) 335 ); 336 337 338 /** 339 ** GSS auth unwrap failures 340 **/ 341 342 TRACE_EVENT(rpcgss_unwrap_failed, 343 TP_PROTO( 344 const struct rpc_task *task 345 ), 346 347 TP_ARGS(task), 348 349 TP_STRUCT__entry( 350 __field(unsigned int, task_id) 351 __field(unsigned int, client_i 352 ), 353 354 TP_fast_assign( 355 __entry->task_id = task->tk_pi 356 __entry->client_id = task->tk_ 357 ), 358 359 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 360 __entry->task_id, __entry->cli 361 ); 362 363 TRACE_EVENT(rpcgss_bad_seqno, 364 TP_PROTO( 365 const struct rpc_task *task, 366 u32 expected, 367 u32 received 368 ), 369 370 TP_ARGS(task, expected, received), 371 372 TP_STRUCT__entry( 373 __field(unsigned int, task_id) 374 __field(unsigned int, client_i 375 __field(u32, expected) 376 __field(u32, received) 377 ), 378 379 TP_fast_assign( 380 __entry->task_id = task->tk_pi 381 __entry->client_id = task->tk_ 382 __entry->expected = expected; 383 __entry->received = received; 384 ), 385 386 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 387 " expected seqno %u, receive 388 __entry->task_id, __entry->cli 389 __entry->expected, __entry->re 390 ); 391 392 TRACE_EVENT(rpcgss_seqno, 393 TP_PROTO( 394 const struct rpc_task *task 395 ), 396 397 TP_ARGS(task), 398 399 TP_STRUCT__entry( 400 __field(unsigned int, task_id) 401 __field(unsigned int, client_i 402 __field(u32, xid) 403 __field(u32, seqno) 404 ), 405 406 TP_fast_assign( 407 const struct rpc_rqst *rqst = 408 409 __entry->task_id = task->tk_pi 410 __entry->client_id = task->tk_ 411 __entry->xid = be32_to_cpu(rqs 412 __entry->seqno = rqst->rq_seqn 413 ), 414 415 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 416 __entry->task_id, __entry->cli 417 __entry->xid, __entry->seqno) 418 ); 419 420 TRACE_EVENT(rpcgss_need_reencode, 421 TP_PROTO( 422 const struct rpc_task *task, 423 u32 seq_xmit, 424 bool ret 425 ), 426 427 TP_ARGS(task, seq_xmit, ret), 428 429 TP_STRUCT__entry( 430 __field(unsigned int, task_id) 431 __field(unsigned int, client_i 432 __field(u32, xid) 433 __field(u32, seq_xmit) 434 __field(u32, seqno) 435 __field(bool, ret) 436 ), 437 438 TP_fast_assign( 439 __entry->task_id = task->tk_pi 440 __entry->client_id = task->tk_ 441 __entry->xid = be32_to_cpu(tas 442 __entry->seq_xmit = seq_xmit; 443 __entry->seqno = task->tk_rqst 444 __entry->ret = ret; 445 ), 446 447 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 448 " xid=0x%08x rq_seqno=%u seq 449 __entry->task_id, __entry->cli 450 __entry->xid, __entry->seqno, 451 __entry->ret ? "" : "un") 452 ); 453 454 TRACE_EVENT(rpcgss_update_slack, 455 TP_PROTO( 456 const struct rpc_task *task, 457 const struct rpc_auth *auth 458 ), 459 460 TP_ARGS(task, auth), 461 462 TP_STRUCT__entry( 463 __field(unsigned int, task_id) 464 __field(unsigned int, client_i 465 __field(u32, xid) 466 __field(const void *, auth) 467 __field(unsigned int, rslack) 468 __field(unsigned int, ralign) 469 __field(unsigned int, verfsize 470 ), 471 472 TP_fast_assign( 473 __entry->task_id = task->tk_pi 474 __entry->client_id = task->tk_ 475 __entry->xid = be32_to_cpu(tas 476 __entry->auth = auth; 477 __entry->rslack = auth->au_rsl 478 __entry->ralign = auth->au_ral 479 __entry->verfsize = auth->au_v 480 ), 481 482 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 483 " xid=0x%08x auth=%p rslack= 484 __entry->task_id, __entry->cli 485 __entry->auth, __entry->rslack 486 __entry->verfsize) 487 ); 488 489 DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class, 490 TP_PROTO( 491 const struct svc_rqst *rqstp, 492 u32 seqno 493 ), 494 495 TP_ARGS(rqstp, seqno), 496 497 TP_STRUCT__entry( 498 __field(u32, xid) 499 __field(u32, seqno) 500 ), 501 502 TP_fast_assign( 503 __entry->xid = be32_to_cpu(rqs 504 __entry->seqno = seqno; 505 ), 506 507 TP_printk("xid=0x%08x seqno=%u", 508 __entry->xid, __entry->seqno) 509 ); 510 511 #define DEFINE_SVC_SEQNO_EVENT(name) 512 DEFINE_EVENT(rpcgss_svc_seqno_class, r 513 TP_PROTO( 514 const struct s 515 u32 seqno 516 ), 517 TP_ARGS(rqstp, seqno)) 518 519 DEFINE_SVC_SEQNO_EVENT(large); 520 DEFINE_SVC_SEQNO_EVENT(seen); 521 522 TRACE_EVENT(rpcgss_svc_seqno_low, 523 TP_PROTO( 524 const struct svc_rqst *rqstp, 525 u32 seqno, 526 u32 min, 527 u32 max 528 ), 529 530 TP_ARGS(rqstp, seqno, min, max), 531 532 TP_STRUCT__entry( 533 __field(u32, xid) 534 __field(u32, seqno) 535 __field(u32, min) 536 __field(u32, max) 537 ), 538 539 TP_fast_assign( 540 __entry->xid = be32_to_cpu(rqs 541 __entry->seqno = seqno; 542 __entry->min = min; 543 __entry->max = max; 544 ), 545 546 TP_printk("xid=0x%08x seqno=%u window= 547 __entry->xid, __entry->seqno, 548 ); 549 550 /** 551 ** gssd upcall related trace events 552 **/ 553 554 TRACE_EVENT(rpcgss_upcall_msg, 555 TP_PROTO( 556 const char *buf 557 ), 558 559 TP_ARGS(buf), 560 561 TP_STRUCT__entry( 562 __string(msg, buf) 563 ), 564 565 TP_fast_assign( 566 __assign_str(msg); 567 ), 568 569 TP_printk("msg='%s'", __get_str(msg)) 570 ); 571 572 TRACE_EVENT(rpcgss_upcall_result, 573 TP_PROTO( 574 u32 uid, 575 int result 576 ), 577 578 TP_ARGS(uid, result), 579 580 TP_STRUCT__entry( 581 __field(u32, uid) 582 __field(int, result) 583 584 ), 585 586 TP_fast_assign( 587 __entry->uid = uid; 588 __entry->result = result; 589 ), 590 591 TP_printk("for uid %u, result=%d", __e 592 ); 593 594 TRACE_EVENT(rpcgss_context, 595 TP_PROTO( 596 u32 window_size, 597 unsigned long expiry, 598 unsigned long now, 599 unsigned int timeout, 600 unsigned int len, 601 const u8 *data 602 ), 603 604 TP_ARGS(window_size, expiry, now, time 605 606 TP_STRUCT__entry( 607 __field(unsigned long, expiry) 608 __field(unsigned long, now) 609 __field(unsigned int, timeout) 610 __field(u32, window_size) 611 __field(int, len) 612 __string_len(acceptor, data, l 613 ), 614 615 TP_fast_assign( 616 __entry->expiry = expiry; 617 __entry->now = now; 618 __entry->timeout = timeout; 619 __entry->window_size = window_ 620 __entry->len = len; 621 __assign_str(acceptor); 622 ), 623 624 TP_printk("win_size=%u expiry=%lu now= 625 __entry->window_size, __entry- 626 __entry->timeout, __entry->len 627 ); 628 629 630 /** 631 ** Miscellaneous events 632 */ 633 634 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 635 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 636 TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 637 638 #define show_pseudoflavor(x) 639 __print_symbolic(x, 640 { RPC_AUTH_GSS_KRB5, "RPC_AUTH 641 { RPC_AUTH_GSS_KRB5I, "RPC_AUT 642 { RPC_AUTH_GSS_KRB5P, "RPC_AUT 643 644 645 TRACE_EVENT(rpcgss_createauth, 646 TP_PROTO( 647 unsigned int flavor, 648 int error 649 ), 650 651 TP_ARGS(flavor, error), 652 653 TP_STRUCT__entry( 654 __field(unsigned int, flavor) 655 __field(int, error) 656 657 ), 658 659 TP_fast_assign( 660 __entry->flavor = flavor; 661 __entry->error = error; 662 ), 663 664 TP_printk("flavor=%s error=%d", 665 show_pseudoflavor(__entry->fla 666 ); 667 668 TRACE_EVENT(rpcgss_oid_to_mech, 669 TP_PROTO( 670 const char *oid 671 ), 672 673 TP_ARGS(oid), 674 675 TP_STRUCT__entry( 676 __string(oid, oid) 677 ), 678 679 TP_fast_assign( 680 __assign_str(oid); 681 ), 682 683 TP_printk("mech for oid %s was not fou 684 ); 685 686 #endif /* _TRACE_RPCGSS_H */ 687 688 #include <trace/define_trace.h> 689
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.