On Wed, 9 Apr 2025 18:29:33 +0800 Jiayuan Chen <[email protected]> wrote:
> +#define trace_sockmap_skmsg_redirect(sk, prog, msg, act) \ > + trace_sockmap_redirect((sk), "msg", (prog), (msg)->sg.size, (act)) > + > +#define trace_sockmap_skb_redirect(sk, prog, skb, act) \ > + trace_sockmap_redirect((sk), "skb", (prog), (skb)->len, (act)) > + > +TRACE_EVENT(sockmap_redirect, > + TP_PROTO(const struct sock *sk, const char *type, > + const struct bpf_prog *prog, int length, int act), > + TP_ARGS(sk, type, prog, length, act), > + > + TP_STRUCT__entry( > + __field(const void *, sk) > + __field(const char *, type) On 64bit, const char * is 8 bytes, and you are pointing it to a string of size 4 bytes (3 chars and '\0'). Why not just make it a constant string, or better yet, an enum? -- Steve > + __field(__u16, family) > + __field(__u16, protocol) > + __field(int, prog_id) > + __field(int, length) > + __field(int, act) > + ), > + > + TP_fast_assign( > + __entry->sk = sk; > + __entry->type = type; > + __entry->family = sk->sk_family; > + __entry->protocol = sk->sk_protocol; > + __entry->prog_id = prog->aux->id; > + __entry->length = length; > + __entry->act = act; > + ), > +
