^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Authors: Thiébaud Weksteen <tweek@google.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Peter Enderborg <Peter.Enderborg@sony.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define TRACE_SYSTEM avc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #if !defined(_TRACE_SELINUX_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _TRACE_SELINUX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) TRACE_EVENT(selinux_audited,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) TP_PROTO(struct selinux_audit_data *sad,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) char *scontext,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) char *tcontext,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) const char *tclass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) TP_ARGS(sad, scontext, tcontext, tclass),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __field(u32, requested)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __field(u32, denied)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) __field(u32, audited)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) __field(int, result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) __string(scontext, scontext)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) __string(tcontext, tcontext)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) __string(tclass, tclass)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) __entry->requested = sad->requested;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) __entry->denied = sad->denied;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) __entry->audited = sad->audited;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) __entry->result = sad->result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __assign_str(tcontext, tcontext);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __assign_str(scontext, scontext);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) __assign_str(tclass, tclass);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) TP_printk("requested=0x%x denied=0x%x audited=0x%x result=%d scontext=%s tcontext=%s tclass=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __entry->requested, __entry->denied, __entry->audited, __entry->result,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __get_str(scontext), __get_str(tcontext), __get_str(tclass)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include <trace/define_trace.h>