From: Aaron Plattner <aplattner@nvidia.com>
To: <linux-kernel@vger.kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Aaron Plattner <aplattner@nvidia.com>
Subject: [PATCH 0/2] Fix objtool error reporting and handling of very long symbol names
Date: Wed, 4 Oct 2023 17:08:17 -0700 [thread overview]
Message-ID: <cover.1696355111.git.aplattner@nvidia.com> (raw)
Two patches in this series:
First, when objtool encounters an error, it carefully propagates the return
code all the way up to main(), which proceeds to ignore it and return 0 no
matter what. This can cause problems with objtool to be missed because the
overall build succeeds. This appears to be a regression in commit
b51277eb9775c, which dropped a call to exit(ret) when a subcommand fails.
Fix that by returning the status code from main().
Second, very long symbol names with .cold variants cause objtool to fail.
This is due to using a small max length, which in turn is due to allocating
on the stack. However, there is not actually a requirement to allocate on
the stack in this (user space) code path, and in fact, the code is cleaner
with this fix: MAX_NAME_LEN is gone and the ugly manual NULL termination
is also removed.
The net result is a more capable objtool and slightly cleaner code.
Although this fix technically only applies to drivers that generate
unusually long symbol names, typically due to using C++ (and these cases
only appear to exist outside of the kernel tree so far), I think it's still
worth applying. That's because the net result is a more capable objtool:
one that lacks an arbitrary length limit for symbol names.
For example, Rust support is being added, and drivers will be the first
users of that support. And like C++, Rust also needs to mangle names [1].
So getting rid of the name length constraint is just good hygiene.
[1] https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html
Aaron Plattner (2):
objtool: return the result of objtool_run() so the build fails if
objtool doesn't work
objtool: use strndup() to avoid the need for a maximum symbol name
length
tools/objtool/elf.c | 14 ++++++--------
tools/objtool/objtool.c | 4 +---
2 files changed, 7 insertions(+), 11 deletions(-)
--
2.42.0
next reply other threads:[~2023-10-05 0:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 0:08 Aaron Plattner [this message]
2023-10-05 0:08 ` [PATCH 1/2] objtool: return the result of objtool_run() so the build fails if objtool doesn't work Aaron Plattner
2023-10-05 0:08 ` [PATCH 2/2] objtool: use strndup() to avoid the need for a maximum symbol name length Aaron Plattner
2023-10-05 23:58 ` [PATCH 0/2] Fix objtool error reporting and handling of very long symbol names Josh Poimboeuf
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=cover.1696355111.git.aplattner@nvidia.com \
--to=aplattner@nvidia.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.