linux/include/trace/stages
Steven Rostedt (Google) 24f5bb9f24 tracing: Just use strcmp() for testing __string() and __assign_str() match
As __assign_str() no longer uses its "src" parameter, there's a check to
make sure nothing depends on it being different than what was passed to
__string(). It originally just compared the pointer passed to __string()
with the pointer passed into __assign_str() via the "src" parameter. But
there's a couple of outliers that just pass in a quoted string constant,
where comparing the pointers is UB to the compiler, as the compiler is
free to create multiple copies of the same string constant.

Instead, just use strcmp(). It may slow down the trace event, but this
will eventually be removed.

Also, fix the issue of passing NULL to strcmp() by adding a WARN_ON() to
make sure that both "src" and the pointer saved in __string() are either
both NULL or have content, and then checking if "src" is not NULL before
performing the strcmp().

Link: https://lore.kernel.org/all/CAHk-=wjxX16kWd=uxG5wzqt=aXoYDf1BgWOKk+qVmAO0zh7sjA@mail.gmail.com/

Fixes: b1afefa62c ("tracing: Use strcmp() in __assign_str() WARN_ON() check")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-03-19 11:23:30 -07:00
..
init.h
stage1_struct_define.h tracing: Add __cpumask to denote a trace event field that is a cpumask_t 2022-11-23 19:08:30 -05:00
stage2_data_offsets.h tracing: Rework __assign_str() and __string() to not duplicate getting the string 2024-03-18 10:32:27 -04:00
stage3_trace_output.h tracing: Acquire buffer from temparary trace sequence 2023-02-07 12:42:54 -05:00
stage4_event_fields.h tracing: Fix TASK_COMM_LEN in trace event format file 2023-02-12 10:23:39 -05:00
stage5_get_offsets.h tracing: Add __string_src() helper to help compilers not to get confused 2024-03-18 10:33:06 -04:00
stage6_event_callback.h tracing: Just use strcmp() for testing __string() and __assign_str() match 2024-03-19 11:23:30 -07:00
stage7_class_define.h tracing: Acquire buffer from temparary trace sequence 2023-02-07 12:42:54 -05:00