With unret validation enabled and IBT/LTO disabled, objtool runs on TUs
with --rethunk and on vmlinux.o with --unret. So this dependency isn't
valid as they don't always run on the same object.
This error never triggered before because --unret is always coupled with
--noinstr, so the first conditional in opts_valid() returns early due to
opts.noinstr being true.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
tools/objtool/builtin-check.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 387d56a7f5fb..c7275cf7641b 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -151,11 +151,6 @@ static bool opts_valid(void)
return true;
}
- if (opts.unret && !opts.rethunk) {
- ERROR("--unret requires --rethunk");
- return false;
- }
-
if (opts.dump_orc)
return true;
--
2.48.1
On Fri, Mar 14, 2025 at 12:29:04PM -0700, Josh Poimboeuf wrote:
> With unret validation enabled and IBT/LTO disabled, objtool runs on TUs
> with --rethunk and on vmlinux.o with --unret. So this dependency isn't
> valid as they don't always run on the same object.
>
> This error never triggered before because --unret is always coupled with
> --noinstr, so the first conditional in opts_valid() returns early due to
> opts.noinstr being true.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
> tools/objtool/builtin-check.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> index 387d56a7f5fb..c7275cf7641b 100644
> --- a/tools/objtool/builtin-check.c
> +++ b/tools/objtool/builtin-check.c
> @@ -151,11 +151,6 @@ static bool opts_valid(void)
> return true;
> }
>
> - if (opts.unret && !opts.rethunk) {
> - ERROR("--unret requires --rethunk");
> - return false;
> - }
But but but, the whole UNTRAIN_RET stuff relies on return thunks. Even
though objtool can do that VALUDATE_UNRET_BEGIN -> VALIDATE_UNRET_END
check without there being return thunks, it simply doesn't make sense.
On Fri, Mar 14, 2025 at 08:38:48PM +0100, Peter Zijlstra wrote:
> On Fri, Mar 14, 2025 at 12:29:04PM -0700, Josh Poimboeuf wrote:
> > With unret validation enabled and IBT/LTO disabled, objtool runs on TUs
> > with --rethunk and on vmlinux.o with --unret. So this dependency isn't
> > valid as they don't always run on the same object.
> >
> > This error never triggered before because --unret is always coupled with
> > --noinstr, so the first conditional in opts_valid() returns early due to
> > opts.noinstr being true.
> >
> > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > ---
> > tools/objtool/builtin-check.c | 5 -----
> > 1 file changed, 5 deletions(-)
> >
> > diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> > index 387d56a7f5fb..c7275cf7641b 100644
> > --- a/tools/objtool/builtin-check.c
> > +++ b/tools/objtool/builtin-check.c
> > @@ -151,11 +151,6 @@ static bool opts_valid(void)
> > return true;
> > }
> >
> > - if (opts.unret && !opts.rethunk) {
> > - ERROR("--unret requires --rethunk");
> > - return false;
> > - }
>
> But but but, the whole UNTRAIN_RET stuff relies on return thunks. Even
> though objtool can do that VALUDATE_UNRET_BEGIN -> VALIDATE_UNRET_END
> check without there being return thunks, it simply doesn't make sense.
That's at least enforced by kconfig dependencies as
MITIGATION_UNRET_ENTRY depends on MITIGATION_RETHUNK.
If you wanted to enforce it on the objtool level, we might need to do
some makefile acrobatics to defer --rethunk to vmlinux link time for the
above mentioned case.
--
Josh
Hi,
On Fri, 14 Mar 2025, Josh Poimboeuf wrote:
> On Fri, Mar 14, 2025 at 08:38:48PM +0100, Peter Zijlstra wrote:
> > On Fri, Mar 14, 2025 at 12:29:04PM -0700, Josh Poimboeuf wrote:
> > > With unret validation enabled and IBT/LTO disabled, objtool runs on TUs
> > > with --rethunk and on vmlinux.o with --unret. So this dependency isn't
> > > valid as they don't always run on the same object.
> > >
> > > This error never triggered before because --unret is always coupled with
> > > --noinstr, so the first conditional in opts_valid() returns early due to
> > > opts.noinstr being true.
> > >
> > > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > > ---
> > > tools/objtool/builtin-check.c | 5 -----
> > > 1 file changed, 5 deletions(-)
> > >
> > > diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> > > index 387d56a7f5fb..c7275cf7641b 100644
> > > --- a/tools/objtool/builtin-check.c
> > > +++ b/tools/objtool/builtin-check.c
> > > @@ -151,11 +151,6 @@ static bool opts_valid(void)
> > > return true;
> > > }
> > >
> > > - if (opts.unret && !opts.rethunk) {
> > > - ERROR("--unret requires --rethunk");
> > > - return false;
> > > - }
> >
> > But but but, the whole UNTRAIN_RET stuff relies on return thunks. Even
> > though objtool can do that VALUDATE_UNRET_BEGIN -> VALIDATE_UNRET_END
> > check without there being return thunks, it simply doesn't make sense.
>
> That's at least enforced by kconfig dependencies as
> MITIGATION_UNRET_ENTRY depends on MITIGATION_RETHUNK.
could you add it to the changelog, please? My future self would definitely
welcome it.
Miroslav
On Fri, Mar 14, 2025 at 12:52:32PM -0700, Josh Poimboeuf wrote:
> On Fri, Mar 14, 2025 at 08:38:48PM +0100, Peter Zijlstra wrote:
> > On Fri, Mar 14, 2025 at 12:29:04PM -0700, Josh Poimboeuf wrote:
> > > With unret validation enabled and IBT/LTO disabled, objtool runs on TUs
> > > with --rethunk and on vmlinux.o with --unret. So this dependency isn't
> > > valid as they don't always run on the same object.
> > >
> > > This error never triggered before because --unret is always coupled with
> > > --noinstr, so the first conditional in opts_valid() returns early due to
> > > opts.noinstr being true.
> > >
> > > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > > ---
> > > tools/objtool/builtin-check.c | 5 -----
> > > 1 file changed, 5 deletions(-)
> > >
> > > diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> > > index 387d56a7f5fb..c7275cf7641b 100644
> > > --- a/tools/objtool/builtin-check.c
> > > +++ b/tools/objtool/builtin-check.c
> > > @@ -151,11 +151,6 @@ static bool opts_valid(void)
> > > return true;
> > > }
> > >
> > > - if (opts.unret && !opts.rethunk) {
> > > - ERROR("--unret requires --rethunk");
> > > - return false;
> > > - }
> >
> > But but but, the whole UNTRAIN_RET stuff relies on return thunks. Even
> > though objtool can do that VALUDATE_UNRET_BEGIN -> VALIDATE_UNRET_END
> > check without there being return thunks, it simply doesn't make sense.
>
> That's at least enforced by kconfig dependencies as
> MITIGATION_UNRET_ENTRY depends on MITIGATION_RETHUNK.
>
> If you wanted to enforce it on the objtool level, we might need to do
> some makefile acrobatics to defer --rethunk to vmlinux link time for the
> above mentioned case.
Nah, I suppose it should all work like this. Its just weird seeing this.
© 2016 - 2025 Red Hat, Inc.