All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] More objtool fixes
@ 2025-03-28  5:04 Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn() Josh Poimboeuf
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2025-03-28  5:04 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Arnd Bergmann

Patch 1 fixes an objtool seg fault which was seen in the error path of
another bug fixed by patch 2.

Patch 3 removes an unnecessary function ignore for ORC.

Josh Poimboeuf (3):
  objtool: Fix seg fault in ignore_unreachable_insn()
  objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions
  objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC

 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 tools/objtool/check.c               | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn()
  2025-03-28  5:04 [PATCH 0/3] More objtool fixes Josh Poimboeuf
@ 2025-03-28  5:04 ` Josh Poimboeuf
  2025-03-28 13:59   ` [tip: objtool/urgent] objtool: Fix segfault " tip-bot2 for Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 2/3] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 3/3] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC Josh Poimboeuf
  2 siblings, 1 reply; 7+ messages in thread
From: Josh Poimboeuf @ 2025-03-28  5:04 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Arnd Bergmann

Check prev_insn before dereferencing it.

Fixes: bd841d6154f5 ("objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Closes: https://lore.kernel.org/d86b4cc6-0b97-4095-8793-a7384410b8ab@app.fastmail.com
Reported-by: Ingo Molnar <mingo@kernel.org>
Closes: https://lore.kernel.org/Z-V_rruKY0-36pqA@gmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 3bf29923d5c0..29de1709ea00 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4037,7 +4037,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
 	 * It may also insert a UD2 after calling a __noreturn function.
 	 */
 	prev_insn = prev_insn_same_sec(file, insn);
-	if (prev_insn->dead_end &&
+	if (prev_insn && prev_insn->dead_end &&
 	    (insn->type == INSN_BUG ||
 	     (insn->type == INSN_JUMP_UNCONDITIONAL &&
 	      insn->jump_dest && insn->jump_dest->type == INSN_BUG)))
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions
  2025-03-28  5:04 [PATCH 0/3] More objtool fixes Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn() Josh Poimboeuf
@ 2025-03-28  5:04 ` Josh Poimboeuf
  2025-03-28 13:59   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 3/3] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC Josh Poimboeuf
  2 siblings, 1 reply; 7+ messages in thread
From: Josh Poimboeuf @ 2025-03-28  5:04 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Arnd Bergmann

The recent STACK_FRAME_NON_STANDARD refactoring forgot about .cold
subfunctions.  They must also be ignored.

Fixes the following warning:

  drivers/gpu/drm/vmwgfx/vmwgfx_msg.o: warning: objtool: vmw_recv_msg.cold+0x0: unreachable instruction

Fixes: c84301d706c5 ("objtool: Ignore entire functions rather than instructions")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 29de1709ea00..fff9d7a2947a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1014,6 +1014,8 @@ static int add_ignores(struct objtool_file *file)
 		}
 
 		func->ignore = true;
+		if (func->cfunc)
+			func->cfunc->ignore = true;
 	}
 
 	return 0;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC
  2025-03-28  5:04 [PATCH 0/3] More objtool fixes Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn() Josh Poimboeuf
  2025-03-28  5:04 ` [PATCH 2/3] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions Josh Poimboeuf
@ 2025-03-28  5:04 ` Josh Poimboeuf
  2025-03-28 13:59   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
  2 siblings, 1 reply; 7+ messages in thread
From: Josh Poimboeuf @ 2025-03-28  5:04 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Arnd Bergmann

The following commit:

  0b0d81e3b733 ("objtool, drm/vmwgfx: Fix "duplicate frame pointer save" warning")

... marked vmw_send_msg() STACK_FRAME_NON_STANDARD because it uses RBP
in a non-standard way which violates frame pointer convention.

That issue only affects the frame pointer unwinder.  Remove the
annotation for ORC.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index 1f15990d3934..1d9a42cbc88f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -289,7 +289,7 @@ static int vmw_send_msg(struct rpc_channel *channel, const char *msg)
 
 	return -EINVAL;
 }
-STACK_FRAME_NON_STANDARD(vmw_send_msg);
+STACK_FRAME_NON_STANDARD_FP(vmw_send_msg);
 
 
 /**
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: objtool/urgent] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC
  2025-03-28  5:04 ` [PATCH 3/3] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC Josh Poimboeuf
@ 2025-03-28 13:59   ` tip-bot2 for Josh Poimboeuf
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-28 13:59 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

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

Commit-ID:     ae958b12940bcd4ffa32c44684e4f2878bc5e140
Gitweb:        https://git.kernel.org/tip/ae958b12940bcd4ffa32c44684e4f2878bc5e140
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Thu, 27 Mar 2025 22:04:23 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Mar 2025 14:47:02 +01:00

objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC

The following commit:

  0b0d81e3b733 ("objtool, drm/vmwgfx: Fix "duplicate frame pointer save" warning")

... marked vmw_send_msg() STACK_FRAME_NON_STANDARD because it uses RBP
in a non-standard way which violates frame pointer convention.

That issue only affects the frame pointer unwinder.  Remove the
annotation for ORC.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/eff3102a7eeb77b4420fcb5e9d9cd9dd81d4514a.1743136205.git.jpoimboe@kernel.org
---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index 1f15990..1d9a42c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -289,7 +289,7 @@ static int vmw_send_msg(struct rpc_channel *channel, const char *msg)
 
 	return -EINVAL;
 }
-STACK_FRAME_NON_STANDARD(vmw_send_msg);
+STACK_FRAME_NON_STANDARD_FP(vmw_send_msg);
 
 
 /**

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: objtool/urgent] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions
  2025-03-28  5:04 ` [PATCH 2/3] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions Josh Poimboeuf
@ 2025-03-28 13:59   ` tip-bot2 for Josh Poimboeuf
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-28 13:59 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

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

Commit-ID:     b5e2cc57f551a1a1e2c0ea36f77c1e26d3d13c35
Gitweb:        https://git.kernel.org/tip/b5e2cc57f551a1a1e2c0ea36f77c1e26d3d13c35
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Thu, 27 Mar 2025 22:04:22 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Mar 2025 14:47:02 +01:00

objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions

The recent STACK_FRAME_NON_STANDARD refactoring forgot about .cold
subfunctions.  They must also be ignored.

Fixes the following warning:

  drivers/gpu/drm/vmwgfx/vmwgfx_msg.o: warning: objtool: vmw_recv_msg.cold+0x0: unreachable instruction

Fixes: c84301d706c5 ("objtool: Ignore entire functions rather than instructions")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/70a09ec0b0704398b2bbfb3153ce3d7cb8a381be.1743136205.git.jpoimboe@kernel.org
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 29de170..fff9d7a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1014,6 +1014,8 @@ static int add_ignores(struct objtool_file *file)
 		}
 
 		func->ignore = true;
+		if (func->cfunc)
+			func->cfunc->ignore = true;
 	}
 
 	return 0;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [tip: objtool/urgent] objtool: Fix segfault in ignore_unreachable_insn()
  2025-03-28  5:04 ` [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn() Josh Poimboeuf
@ 2025-03-28 13:59   ` tip-bot2 for Josh Poimboeuf
  0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-28 13:59 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arnd Bergmann, Ingo Molnar, Josh Poimboeuf, x86, linux-kernel

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

Commit-ID:     69d41d6dafff0967565b971d950bd10443e4076c
Gitweb:        https://git.kernel.org/tip/69d41d6dafff0967565b971d950bd10443e4076c
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Thu, 27 Mar 2025 22:04:21 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Mar 2025 14:47:02 +01:00

objtool: Fix segfault in ignore_unreachable_insn()

Check 'prev_insn' before dereferencing it.

Fixes: bd841d6154f5 ("objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/5df4ff89c9e4b9e788b77b0531234ffa7ba03e9e.1743136205.git.jpoimboe@kernel.org

Closes: https://lore.kernel.org/d86b4cc6-0b97-4095-8793-a7384410b8ab@app.fastmail.com
Closes: https://lore.kernel.org/Z-V_rruKY0-36pqA@gmail.com
---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 3bf2992..29de170 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4037,7 +4037,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
 	 * It may also insert a UD2 after calling a __noreturn function.
 	 */
 	prev_insn = prev_insn_same_sec(file, insn);
-	if (prev_insn->dead_end &&
+	if (prev_insn && prev_insn->dead_end &&
 	    (insn->type == INSN_BUG ||
 	     (insn->type == INSN_JUMP_UNCONDITIONAL &&
 	      insn->jump_dest && insn->jump_dest->type == INSN_BUG)))

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-28 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28  5:04 [PATCH 0/3] More objtool fixes Josh Poimboeuf
2025-03-28  5:04 ` [PATCH 1/3] objtool: Fix seg fault in ignore_unreachable_insn() Josh Poimboeuf
2025-03-28 13:59   ` [tip: objtool/urgent] objtool: Fix segfault " tip-bot2 for Josh Poimboeuf
2025-03-28  5:04 ` [PATCH 2/3] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions Josh Poimboeuf
2025-03-28 13:59   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-03-28  5:04 ` [PATCH 3/3] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC Josh Poimboeuf
2025-03-28 13:59   ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf

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.