Re: [PATCH] perf dso: Fix kallsyms DSO detection with fallback logic

tshah <[email protected]>
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thanks for the suggestion. The missing closing bracket is intentional. I 
Will rename it to DSO__PREFIX_GUEST_KALLSYMS to make this intent 
explicit and avoid confusion with complete name macros like 
DSO__NAME_KALLSYMS

On 10/04/26 13:47, [email protected] wrote:
> Sashiko AI review found 1 potential issue(s):
> - [Low] The macro `DSO__NAME_GUEST_KALLSYMS` is defined with an unbalanced bracket, which is deceptive and prone to misuse.
> --
> 
> commit bff739892129d9369935f2dfb42b44d83b2f857d
> Author: Tanushree Shah <[email protected]>
> 
> perf dso: Fix kallsyms DSO detection with fallback logic
> 
> This commit fixes kallsyms DSO detection during build-id injection when
> the binary type is not yet explicitly set. It implements a fallback that
> matches the long_name against known kallsyms strings to correctly identify
> the kernel DSO.
> 
>> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
>> index ede691e9a2495..e44071998c499 100644
>> --- a/tools/perf/util/dso.h
>> +++ b/tools/perf/util/dso.h
> [ ... ]
>> @@ -20,6 +21,7 @@ struct perf_env;
>>   
>>   #define DSO__NAME_KALLSYMS	"[kernel.kallsyms]"
>>   #define DSO__NAME_KCORE		"[kernel.kcore]"
>> +#define DSO__NAME_GUEST_KALLSYMS	"[guest.kernel.kallsyms"
> 
> This isn't a bug, but there is a missing closing bracket in this macro
> definition.
> 
> While it looks like this was done intentionally to allow prefix matching
> against dynamic guest kallsyms names (which append a PID) using strncmp
> later in the patch, naming it DSO__NAME_GUEST_KALLSYMS implies it represents
> a complete, well-formed identifier like DSO__NAME_KALLSYMS.
> 
> Could this macro be renamed to something like DSO__PREFIX_GUEST_KALLSYMS
> to make its intended use as a prefix clear, preventing it from being
> accidentally used in contexts expecting a full name?
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.