All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] objtool/x86: Fixup frame-pointer vs rethunk
Date: Thu, 17 Aug 2023 08:39:20 -0000	[thread overview]
Message-ID: <169226156036.27769.8460741923496477919.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20230816115921.GH980931@hirez.programming.kicks-ass.net>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     dbf46008775516f7f25c95b7760041c286299783
Gitweb:        https://git.kernel.org/tip/dbf46008775516f7f25c95b7760041c286299783
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Wed, 16 Aug 2023 13:59:21 +02:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 17 Aug 2023 00:44:35 +02:00

objtool/x86: Fixup frame-pointer vs rethunk

For stack-validation of a frame-pointer build, objtool validates that
every CALL instruction is preceded by a frame-setup. The new SRSO
return thunks violate this with their RSB stuffing trickery.

Extend the __fentry__ exception to also cover the embedded_insn case
used for this. This cures:

  vmlinux.o: warning: objtool: srso_untrain_ret+0xd: call without frame pointer save/setup

Fixes: 4ae68b26c3ab ("objtool/x86: Fix SRSO mess")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20230816115921.GH980931@hirez.programming.kicks-ass.net
---
 tools/objtool/check.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 7a9aaf4..1384090 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2650,12 +2650,17 @@ static int decode_sections(struct objtool_file *file)
 	return 0;
 }
 
-static bool is_fentry_call(struct instruction *insn)
+static bool is_special_call(struct instruction *insn)
 {
-	if (insn->type == INSN_CALL &&
-	    insn_call_dest(insn) &&
-	    insn_call_dest(insn)->fentry)
-		return true;
+	if (insn->type == INSN_CALL) {
+		struct symbol *dest = insn_call_dest(insn);
+
+		if (!dest)
+			return false;
+
+		if (dest->fentry || dest->embedded_insn)
+			return true;
+	}
 
 	return false;
 }
@@ -3656,7 +3661,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
 			if (ret)
 				return ret;
 
-			if (opts.stackval && func && !is_fentry_call(insn) &&
+			if (opts.stackval && func && !is_special_call(insn) &&
 			    !has_valid_stack_frame(&state)) {
 				WARN_INSN(insn, "call without frame pointer save/setup");
 				return 1;

  parent reply	other threads:[~2023-08-17  8:40 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 11:44 [PATCH v2 00/11] Fix up SRSO stuff Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 01/11] x86/cpu: Fixup __x86_return_thunk Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] x86/cpu: Fix __x86_return_thunk symbol type tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 02/11] x86/cpu: Fix up srso_safe_ret() and __x86_return_thunk() Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 03/11] objtool/x86: Fix SRSO mess Peter Zijlstra
2023-08-14 12:54   ` Andrew.Cooper3
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 11:59     ` Peter Zijlstra
2023-08-16 20:31       ` Josh Poimboeuf
2023-08-16 22:08         ` [PATCH] objtool/x86: Fixup frame-pointer vs rethunk Peter Zijlstra
2023-08-16 22:22           ` Josh Poimboeuf
2023-08-17  8:39       ` tip-bot2 for Peter Zijlstra [this message]
2023-08-14 11:44 ` [PATCH v2 04/11] x86/alternative: Make custom return thunk unconditional Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 05/11] x86/cpu: Clean up SRSO return thunk mess Peter Zijlstra
2023-08-14 13:02   ` Borislav Petkov
2023-08-14 17:48   ` Borislav Petkov
2023-08-15 21:29   ` Nathan Chancellor
2023-08-15 22:43     ` Peter Zijlstra
2023-08-16  7:38       ` Borislav Petkov
2023-08-16 14:52         ` Nathan Chancellor
2023-08-16 15:08           ` Borislav Petkov
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 18:58     ` Nathan Chancellor
2023-08-16 19:24       ` Borislav Petkov
2023-08-16 19:30         ` Nathan Chancellor
2023-08-16 19:42           ` Borislav Petkov
2023-08-16 19:57             ` Borislav Petkov
2023-08-16 21:20   ` tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 06/11] x86/cpu: Rename original retbleed methods Peter Zijlstra
2023-08-14 19:41   ` Josh Poimboeuf
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 21:20   ` tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 07/11] x86/cpu: Rename srso_(.*)_alias to srso_alias_\1 Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 21:20   ` tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 08/11] x86/cpu: Cleanup the untrain mess Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 21:20   ` tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 09/11] x86/cpu/kvm: Provide UNTRAIN_RET_VM Peter Zijlstra
2023-08-16  7:55   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2023-08-16 21:20   ` tip-bot2 for Peter Zijlstra
2023-08-14 11:44 ` [PATCH v2 10/11] x86/alternatives: Simplify ALTERNATIVE_n() Peter Zijlstra
2023-08-15 20:49   ` Nikolay Borisov
2023-08-15 22:44     ` Peter Zijlstra
2023-09-07  8:31   ` Borislav Petkov
2023-09-07 11:09     ` Peter Zijlstra
2023-09-07 11:11       ` Peter Zijlstra
2023-09-07 11:16         ` Peter Zijlstra
2023-09-07 15:06       ` Borislav Petkov
2023-09-07 15:30         ` Borislav Petkov
2023-09-09  7:50           ` Borislav Petkov
2023-09-09  9:25             ` Peter Zijlstra
2023-09-09  9:42               ` Peter Zijlstra
2023-09-10 14:42               ` Borislav Petkov
2023-09-12  9:27                 ` Peter Zijlstra
2023-09-12  9:44                   ` Peter Zijlstra
2023-09-13  4:37                     ` Borislav Petkov
2023-09-13  8:46                       ` Peter Zijlstra
2023-09-13 14:38                         ` Borislav Petkov
2023-09-13 16:14                           ` Peter Zijlstra
2023-09-15  7:46                           ` Peter Zijlstra
2023-09-15  7:51                             ` Peter Zijlstra
2023-09-15 12:05                               ` Borislav Petkov
2023-09-13  4:24                   ` Borislav Petkov
2023-08-14 11:44 ` [PATCH v2 11/11] x86/cpu: Use fancy alternatives to get rid of entry_untrain_ret() Peter Zijlstra
2023-08-14 16:44 ` [PATCH v2 00/11] Fix up SRSO stuff Borislav Petkov
2023-08-14 19:51   ` Josh Poimboeuf
2023-08-14 19:57     ` Borislav Petkov
2023-08-14 20:01     ` Josh Poimboeuf
2023-08-14 20:09       ` Borislav Petkov
2023-08-15 14:26         ` [PATCH] x86/srso: Explain the untraining sequences a bit more Borislav Petkov
2023-08-15 15:41           ` Nikolay Borisov

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=169226156036.27769.8460741923496477919.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@alien8.de \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.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.