From: Petr Pavlu <petr.pavlu@suse.com>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Daniel Gomez <da.gomez@samsung.com>,
linux-modules@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org,
Giuliano Procida <gprocida@google.com>
Subject: Re: [PATCH] gendwarfksyms: Fix structure type overrides
Date: Fri, 13 Jun 2025 14:52:17 +0200 [thread overview]
Message-ID: <dec42b04-b76f-4a2e-b060-9ac999fe1462@suse.com> (raw)
In-Reply-To: <20250609154926.1237033-2-samitolvanen@google.com>
On 6/9/25 5:49 PM, Sami Tolvanen wrote:
> As we always iterate through the entire die_map when expanding
> type strings, recursively processing referenced types in
> type_expand_child() is not actually necessary. Furthermore,
> the type_string kABI rule added in commit c9083467f7b9
> ("gendwarfksyms: Add a kABI rule to override type strings") can
> fail to override type strings for structures due to a missing
> kabi_get_type_string() check in this function.
>
> Fix the issue by dropping the unnecessary recursion and moving
> the override check to type_expand(). Note that symbol versions
> are otherwise unchanged with this patch.
>
> Fixes: c9083467f7b9 ("gendwarfksyms: Add a kABI rule to override type strings")
> Reported-by: Giuliano Procida <gprocida@google.com>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> scripts/gendwarfksyms/types.c | 65 ++++++++++-------------------------
> 1 file changed, 19 insertions(+), 46 deletions(-)
>
> diff --git a/scripts/gendwarfksyms/types.c b/scripts/gendwarfksyms/types.c
> index 39ce1770e463..7bd459ea6c59 100644
> --- a/scripts/gendwarfksyms/types.c
> +++ b/scripts/gendwarfksyms/types.c
> @@ -333,37 +333,11 @@ static void calculate_version(struct version *version,
> cache_free(&expansion_cache);
> }
>
> -static void __type_expand(struct die *cache, struct type_expansion *type,
> - bool recursive);
> -
> -static void type_expand_child(struct die *cache, struct type_expansion *type,
> - bool recursive)
> -{
> - struct type_expansion child;
> - char *name;
> -
> - name = get_type_name(cache);
> - if (!name) {
> - __type_expand(cache, type, recursive);
> - return;
> - }
> -
> - if (recursive && !__cache_was_expanded(&expansion_cache, cache->addr)) {
> - __cache_mark_expanded(&expansion_cache, cache->addr);
> - type_expansion_init(&child);
> - __type_expand(cache, &child, true);
> - type_map_add(name, &child);
> - type_expansion_free(&child);
> - }
Nit: This code was the only user of __cache_was_expanded() and
__cache_mark_expanded(). It is now possible to merge
__cache_was_expanded() into cache_was_expanded() and
__cache_mark_expanded() into cache_mark_expanded().
Looks ok to me otherwise, feel free to add:
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
--
Thanks,
Petr
next prev parent reply other threads:[~2025-06-13 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 15:49 [PATCH] gendwarfksyms: Fix structure type overrides Sami Tolvanen
2025-06-13 12:52 ` Petr Pavlu [this message]
2025-06-14 0:53 ` Sami Tolvanen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dec42b04-b76f-4a2e-b060-9ac999fe1462@suse.com \
--to=petr.pavlu@suse.com \
--cc=da.gomez@samsung.com \
--cc=gprocida@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox