Re: [PATCH] tracing: Use strcmp() in __assign_str() WARN_ON() check

From
Steven Rostedt <rostedt@goodmis.org>
Date
2024-03-13 17:43:43
Also in
lkml, llvm
Reply to
Nathan Chancellor, 2024-03-13
On Wed, 13 Mar 2024 09:59:03 -0700
Nathan Chancellor [off-list ref] wrote:
quoted
Reported-by: kernel test robot <redacted>
Closes: https://lore.kernel.org/oe-kbuild-all/202402292111.KIdExylU-lkp@intel.com/ (local)
Fixes: 433e1d88a3be ("tracing: Add warning if string in __assign_str() does not match __string()")  
Is this change destined for 6.9 or 6.10? I applied it to current
trace/core (eb1533d156d3) along with 51270d573a8d but the warning is
still present. I even tried

    __builtin_choose_expr(__is_constexpr((src)),
                         strcmp((src), __data_offsets.dst##_ptr_),
                         (src) != __data_offsets.dst##_ptr_));

but not even that silenced the warning. I think we will still need a
diag directive to fully silence this warning.
Yes, you said that the warning is still there, but the bug it shows should
not be.

I believe that's because clang still evaluates the (src) != ... even when
the source is a contast and it warns about it. But if src is a constant, we
do not want to do the !=, we want to do the slower strcmp().

Let me test to make sure that when src is a string "like this" that it does
the strcmp(). Otherwise, we may have to always do the strcmp(), which I
really would like to avoid.

BTW, I triggered another bug with strcmp():

  https://lore.kernel.org/all/20240313093454.3909afe7@gandalf.local.home/ (local)

-- Steve
Thread (4 messages) 4 messages, 2 authors, last reply 2024-03-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help