rpcgss.h (14711B)
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_RPCGSS_H) || defined(TRACE_HEADER_MULTI_READ) 12#define _TRACE_RPCGSS_H 13 14#include <linux/tracepoint.h> 15 16#include <trace/events/sunrpc_base.h> 17 18/** 19 ** GSS-API related trace events 20 **/ 21 22TRACE_DEFINE_ENUM(RPC_GSS_SVC_NONE); 23TRACE_DEFINE_ENUM(RPC_GSS_SVC_INTEGRITY); 24TRACE_DEFINE_ENUM(RPC_GSS_SVC_PRIVACY); 25 26#define show_gss_service(x) \ 27 __print_symbolic(x, \ 28 { RPC_GSS_SVC_NONE, "none" }, \ 29 { RPC_GSS_SVC_INTEGRITY, "integrity" }, \ 30 { RPC_GSS_SVC_PRIVACY, "privacy" }) 31 32TRACE_DEFINE_ENUM(GSS_S_BAD_MECH); 33TRACE_DEFINE_ENUM(GSS_S_BAD_NAME); 34TRACE_DEFINE_ENUM(GSS_S_BAD_NAMETYPE); 35TRACE_DEFINE_ENUM(GSS_S_BAD_BINDINGS); 36TRACE_DEFINE_ENUM(GSS_S_BAD_STATUS); 37TRACE_DEFINE_ENUM(GSS_S_BAD_SIG); 38TRACE_DEFINE_ENUM(GSS_S_NO_CRED); 39TRACE_DEFINE_ENUM(GSS_S_NO_CONTEXT); 40TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_TOKEN); 41TRACE_DEFINE_ENUM(GSS_S_DEFECTIVE_CREDENTIAL); 42TRACE_DEFINE_ENUM(GSS_S_CREDENTIALS_EXPIRED); 43TRACE_DEFINE_ENUM(GSS_S_CONTEXT_EXPIRED); 44TRACE_DEFINE_ENUM(GSS_S_FAILURE); 45TRACE_DEFINE_ENUM(GSS_S_BAD_QOP); 46TRACE_DEFINE_ENUM(GSS_S_UNAUTHORIZED); 47TRACE_DEFINE_ENUM(GSS_S_UNAVAILABLE); 48TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_ELEMENT); 49TRACE_DEFINE_ENUM(GSS_S_NAME_NOT_MN); 50TRACE_DEFINE_ENUM(GSS_S_CONTINUE_NEEDED); 51TRACE_DEFINE_ENUM(GSS_S_DUPLICATE_TOKEN); 52TRACE_DEFINE_ENUM(GSS_S_OLD_TOKEN); 53TRACE_DEFINE_ENUM(GSS_S_UNSEQ_TOKEN); 54TRACE_DEFINE_ENUM(GSS_S_GAP_TOKEN); 55 56#define show_gss_status(x) \ 57 __print_flags(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" }) 81 82 83DECLARE_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_id) 94 __field(u32, maj_stat) 95 96 ), 97 98 TP_fast_assign( 99 __entry->task_id = task->tk_pid; 100 __entry->client_id = task->tk_client->cl_clid; 101 __entry->maj_stat = maj_stat; 102 ), 103 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)) 108); 109 110#define DEFINE_GSSAPI_EVENT(name) \ 111 DEFINE_EVENT(rpcgss_gssapi_event, rpcgss_##name, \ 112 TP_PROTO( \ 113 const struct rpc_task *task, \ 114 u32 maj_stat \ 115 ), \ 116 TP_ARGS(task, maj_stat)) 117 118TRACE_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 136DEFINE_GSSAPI_EVENT(get_mic); 137DEFINE_GSSAPI_EVENT(verify_mic); 138DEFINE_GSSAPI_EVENT(wrap); 139DEFINE_GSSAPI_EVENT(unwrap); 140 141DECLARE_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_principal) 152 ), 153 154 TP_fast_assign( 155 __entry->cred = gc; 156 __entry->service = gc->gc_service; 157 __assign_str(principal, gc->gc_principal); 158 ), 159 160 TP_printk("cred=%p service=%s principal='%s'", 161 __entry->cred, show_gss_service(__entry->service), 162 __get_str(principal)) 163); 164 165#define DEFINE_CTX_EVENT(name) \ 166 DEFINE_EVENT(rpcgss_ctx_class, rpcgss_ctx_##name, \ 167 TP_PROTO( \ 168 const struct gss_cred *gc \ 169 ), \ 170 TP_ARGS(gc)) 171 172DEFINE_CTX_EVENT(init); 173DEFINE_CTX_EVENT(destroy); 174 175DECLARE_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->xpt_remotebuf) 187 ), 188 189 TP_fast_assign( 190 __entry->xid = __be32_to_cpu(rqstp->rq_xid); 191 __entry->maj_stat = maj_stat; 192 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 193 ), 194 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)) 199); 200 201#define DEFINE_SVC_GSSAPI_EVENT(name) \ 202 DEFINE_EVENT(rpcgss_svc_gssapi_class, rpcgss_svc_##name, \ 203 TP_PROTO( \ 204 const struct svc_rqst *rqstp, \ 205 u32 maj_stat \ 206 ), \ 207 TP_ARGS(rqstp, maj_stat)) 208 209DEFINE_SVC_GSSAPI_EVENT(unwrap); 210DEFINE_SVC_GSSAPI_EVENT(mic); 211 212TRACE_EVENT(rpcgss_svc_unwrap_failed, 213 TP_PROTO( 214 const struct svc_rqst *rqstp 215 ), 216 217 TP_ARGS(rqstp), 218 219 TP_STRUCT__entry( 220 __field(u32, xid) 221 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 222 ), 223 224 TP_fast_assign( 225 __entry->xid = be32_to_cpu(rqstp->rq_xid); 226 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 227 ), 228 229 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid) 230); 231 232TRACE_EVENT(rpcgss_svc_seqno_bad, 233 TP_PROTO( 234 const struct svc_rqst *rqstp, 235 u32 expected, 236 u32 received 237 ), 238 239 TP_ARGS(rqstp, expected, received), 240 241 TP_STRUCT__entry( 242 __field(u32, expected) 243 __field(u32, received) 244 __field(u32, xid) 245 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 246 ), 247 248 TP_fast_assign( 249 __entry->expected = expected; 250 __entry->received = received; 251 __entry->xid = __be32_to_cpu(rqstp->rq_xid); 252 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 253 ), 254 255 TP_printk("addr=%s xid=0x%08x expected seqno %u, received seqno %u", 256 __get_str(addr), __entry->xid, 257 __entry->expected, __entry->received) 258); 259 260TRACE_EVENT(rpcgss_svc_accept_upcall, 261 TP_PROTO( 262 const struct svc_rqst *rqstp, 263 u32 major_status, 264 u32 minor_status 265 ), 266 267 TP_ARGS(rqstp, major_status, minor_status), 268 269 TP_STRUCT__entry( 270 __field(u32, minor_status) 271 __field(unsigned long, major_status) 272 __field(u32, xid) 273 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 274 ), 275 276 TP_fast_assign( 277 __entry->minor_status = minor_status; 278 __entry->major_status = major_status; 279 __entry->xid = be32_to_cpu(rqstp->rq_xid); 280 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 281 ), 282 283 TP_printk("addr=%s xid=0x%08x major_status=%s (0x%08lx) minor_status=%u", 284 __get_str(addr), __entry->xid, 285 (__entry->major_status == 0) ? "GSS_S_COMPLETE" : 286 show_gss_status(__entry->major_status), 287 __entry->major_status, __entry->minor_status 288 ) 289); 290 291TRACE_EVENT(rpcgss_svc_authenticate, 292 TP_PROTO( 293 const struct svc_rqst *rqstp, 294 const struct rpc_gss_wire_cred *gc 295 ), 296 297 TP_ARGS(rqstp, gc), 298 299 TP_STRUCT__entry( 300 __field(u32, seqno) 301 __field(u32, xid) 302 __string(addr, rqstp->rq_xprt->xpt_remotebuf) 303 ), 304 305 TP_fast_assign( 306 __entry->xid = be32_to_cpu(rqstp->rq_xid); 307 __entry->seqno = gc->gc_seq; 308 __assign_str(addr, rqstp->rq_xprt->xpt_remotebuf); 309 ), 310 311 TP_printk("addr=%s xid=0x%08x seqno=%u", __get_str(addr), 312 __entry->xid, __entry->seqno) 313); 314 315 316/** 317 ** GSS auth unwrap failures 318 **/ 319 320TRACE_EVENT(rpcgss_unwrap_failed, 321 TP_PROTO( 322 const struct rpc_task *task 323 ), 324 325 TP_ARGS(task), 326 327 TP_STRUCT__entry( 328 __field(unsigned int, task_id) 329 __field(unsigned int, client_id) 330 ), 331 332 TP_fast_assign( 333 __entry->task_id = task->tk_pid; 334 __entry->client_id = task->tk_client->cl_clid; 335 ), 336 337 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 338 __entry->task_id, __entry->client_id) 339); 340 341TRACE_EVENT(rpcgss_bad_seqno, 342 TP_PROTO( 343 const struct rpc_task *task, 344 u32 expected, 345 u32 received 346 ), 347 348 TP_ARGS(task, expected, received), 349 350 TP_STRUCT__entry( 351 __field(unsigned int, task_id) 352 __field(unsigned int, client_id) 353 __field(u32, expected) 354 __field(u32, received) 355 ), 356 357 TP_fast_assign( 358 __entry->task_id = task->tk_pid; 359 __entry->client_id = task->tk_client->cl_clid; 360 __entry->expected = expected; 361 __entry->received = received; 362 ), 363 364 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 365 " expected seqno %u, received seqno %u", 366 __entry->task_id, __entry->client_id, 367 __entry->expected, __entry->received) 368); 369 370TRACE_EVENT(rpcgss_seqno, 371 TP_PROTO( 372 const struct rpc_task *task 373 ), 374 375 TP_ARGS(task), 376 377 TP_STRUCT__entry( 378 __field(unsigned int, task_id) 379 __field(unsigned int, client_id) 380 __field(u32, xid) 381 __field(u32, seqno) 382 ), 383 384 TP_fast_assign( 385 const struct rpc_rqst *rqst = task->tk_rqstp; 386 387 __entry->task_id = task->tk_pid; 388 __entry->client_id = task->tk_client->cl_clid; 389 __entry->xid = be32_to_cpu(rqst->rq_xid); 390 __entry->seqno = rqst->rq_seqno; 391 ), 392 393 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x seqno=%u", 394 __entry->task_id, __entry->client_id, 395 __entry->xid, __entry->seqno) 396); 397 398TRACE_EVENT(rpcgss_need_reencode, 399 TP_PROTO( 400 const struct rpc_task *task, 401 u32 seq_xmit, 402 bool ret 403 ), 404 405 TP_ARGS(task, seq_xmit, ret), 406 407 TP_STRUCT__entry( 408 __field(unsigned int, task_id) 409 __field(unsigned int, client_id) 410 __field(u32, xid) 411 __field(u32, seq_xmit) 412 __field(u32, seqno) 413 __field(bool, ret) 414 ), 415 416 TP_fast_assign( 417 __entry->task_id = task->tk_pid; 418 __entry->client_id = task->tk_client->cl_clid; 419 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 420 __entry->seq_xmit = seq_xmit; 421 __entry->seqno = task->tk_rqstp->rq_seqno; 422 __entry->ret = ret; 423 ), 424 425 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 426 " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded", 427 __entry->task_id, __entry->client_id, 428 __entry->xid, __entry->seqno, __entry->seq_xmit, 429 __entry->ret ? "" : "un") 430); 431 432TRACE_EVENT(rpcgss_update_slack, 433 TP_PROTO( 434 const struct rpc_task *task, 435 const struct rpc_auth *auth 436 ), 437 438 TP_ARGS(task, auth), 439 440 TP_STRUCT__entry( 441 __field(unsigned int, task_id) 442 __field(unsigned int, client_id) 443 __field(u32, xid) 444 __field(const void *, auth) 445 __field(unsigned int, rslack) 446 __field(unsigned int, ralign) 447 __field(unsigned int, verfsize) 448 ), 449 450 TP_fast_assign( 451 __entry->task_id = task->tk_pid; 452 __entry->client_id = task->tk_client->cl_clid; 453 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 454 __entry->auth = auth; 455 __entry->rslack = auth->au_rslack; 456 __entry->ralign = auth->au_ralign; 457 __entry->verfsize = auth->au_verfsize; 458 ), 459 460 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 461 " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n", 462 __entry->task_id, __entry->client_id, __entry->xid, 463 __entry->auth, __entry->rslack, __entry->ralign, 464 __entry->verfsize) 465); 466 467DECLARE_EVENT_CLASS(rpcgss_svc_seqno_class, 468 TP_PROTO( 469 const struct svc_rqst *rqstp, 470 u32 seqno 471 ), 472 473 TP_ARGS(rqstp, seqno), 474 475 TP_STRUCT__entry( 476 __field(u32, xid) 477 __field(u32, seqno) 478 ), 479 480 TP_fast_assign( 481 __entry->xid = be32_to_cpu(rqstp->rq_xid); 482 __entry->seqno = seqno; 483 ), 484 485 TP_printk("xid=0x%08x seqno=%u", 486 __entry->xid, __entry->seqno) 487); 488 489#define DEFINE_SVC_SEQNO_EVENT(name) \ 490 DEFINE_EVENT(rpcgss_svc_seqno_class, rpcgss_svc_seqno_##name, \ 491 TP_PROTO( \ 492 const struct svc_rqst *rqstp, \ 493 u32 seqno \ 494 ), \ 495 TP_ARGS(rqstp, seqno)) 496 497DEFINE_SVC_SEQNO_EVENT(large); 498DEFINE_SVC_SEQNO_EVENT(seen); 499 500TRACE_EVENT(rpcgss_svc_seqno_low, 501 TP_PROTO( 502 const struct svc_rqst *rqstp, 503 u32 seqno, 504 u32 min, 505 u32 max 506 ), 507 508 TP_ARGS(rqstp, seqno, min, max), 509 510 TP_STRUCT__entry( 511 __field(u32, xid) 512 __field(u32, seqno) 513 __field(u32, min) 514 __field(u32, max) 515 ), 516 517 TP_fast_assign( 518 __entry->xid = be32_to_cpu(rqstp->rq_xid); 519 __entry->seqno = seqno; 520 __entry->min = min; 521 __entry->max = max; 522 ), 523 524 TP_printk("xid=0x%08x seqno=%u window=[%u..%u]", 525 __entry->xid, __entry->seqno, __entry->min, __entry->max) 526); 527 528/** 529 ** gssd upcall related trace events 530 **/ 531 532TRACE_EVENT(rpcgss_upcall_msg, 533 TP_PROTO( 534 const char *buf 535 ), 536 537 TP_ARGS(buf), 538 539 TP_STRUCT__entry( 540 __string(msg, buf) 541 ), 542 543 TP_fast_assign( 544 __assign_str(msg, buf); 545 ), 546 547 TP_printk("msg='%s'", __get_str(msg)) 548); 549 550TRACE_EVENT(rpcgss_upcall_result, 551 TP_PROTO( 552 u32 uid, 553 int result 554 ), 555 556 TP_ARGS(uid, result), 557 558 TP_STRUCT__entry( 559 __field(u32, uid) 560 __field(int, result) 561 562 ), 563 564 TP_fast_assign( 565 __entry->uid = uid; 566 __entry->result = result; 567 ), 568 569 TP_printk("for uid %u, result=%d", __entry->uid, __entry->result) 570); 571 572TRACE_EVENT(rpcgss_context, 573 TP_PROTO( 574 u32 window_size, 575 unsigned long expiry, 576 unsigned long now, 577 unsigned int timeout, 578 unsigned int len, 579 const u8 *data 580 ), 581 582 TP_ARGS(window_size, expiry, now, timeout, len, data), 583 584 TP_STRUCT__entry( 585 __field(unsigned long, expiry) 586 __field(unsigned long, now) 587 __field(unsigned int, timeout) 588 __field(u32, window_size) 589 __field(int, len) 590 __string(acceptor, data) 591 ), 592 593 TP_fast_assign( 594 __entry->expiry = expiry; 595 __entry->now = now; 596 __entry->timeout = timeout; 597 __entry->window_size = window_size; 598 __entry->len = len; 599 strncpy(__get_str(acceptor), data, len); 600 ), 601 602 TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s", 603 __entry->window_size, __entry->expiry, __entry->now, 604 __entry->timeout, __entry->len, __get_str(acceptor)) 605); 606 607 608/** 609 ** Miscellaneous events 610 */ 611 612TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5); 613TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5I); 614TRACE_DEFINE_ENUM(RPC_AUTH_GSS_KRB5P); 615 616#define show_pseudoflavor(x) \ 617 __print_symbolic(x, \ 618 { RPC_AUTH_GSS_KRB5, "RPC_AUTH_GSS_KRB5" }, \ 619 { RPC_AUTH_GSS_KRB5I, "RPC_AUTH_GSS_KRB5I" }, \ 620 { RPC_AUTH_GSS_KRB5P, "RPC_AUTH_GSS_KRB5P" }) 621 622 623TRACE_EVENT(rpcgss_createauth, 624 TP_PROTO( 625 unsigned int flavor, 626 int error 627 ), 628 629 TP_ARGS(flavor, error), 630 631 TP_STRUCT__entry( 632 __field(unsigned int, flavor) 633 __field(int, error) 634 635 ), 636 637 TP_fast_assign( 638 __entry->flavor = flavor; 639 __entry->error = error; 640 ), 641 642 TP_printk("flavor=%s error=%d", 643 show_pseudoflavor(__entry->flavor), __entry->error) 644); 645 646TRACE_EVENT(rpcgss_oid_to_mech, 647 TP_PROTO( 648 const char *oid 649 ), 650 651 TP_ARGS(oid), 652 653 TP_STRUCT__entry( 654 __string(oid, oid) 655 ), 656 657 TP_fast_assign( 658 __assign_str(oid, oid); 659 ), 660 661 TP_printk("mech for oid %s was not found", __get_str(oid)) 662); 663 664#endif /* _TRACE_RPCGSS_H */ 665 666#include <trace/define_trace.h>