Skip to contentSkip to conversation

More objtool fixes

PATCH Applied Josh Poimboeuf 2 participants 7 messages Mar 28, 2025

Subsystems (4)
lore
Share & tools
lore

Josh Poimboeuf

author maintainer
#0 lore raw

cover More objtool fixes

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(-)
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 1/3 objtool: Fix seg fault in ignore_unreachable_insn()

Check prev_insn before dereferencing it.

---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +1 -1
index 3bf29923d5c0..29de1709ea00 100644
@@ -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)))
Signature · 1 line
2.48.1
author maintainer
#3 lore raw

PATCH 2/3 objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions

In reply to Josh Poimboeuf

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")
---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)
tools/objtool/check.c +2 -0
index 29de1709ea00..fff9d7a2947a 100644
@@ -1014,6 +1014,8 @@ static int add_ignores(struct objtool_file *file)
 		}
 
 		func->ignore = true;
+		if (func->cfunc)
+			func->cfunc->ignore = true;
 	}
 
 	return 0;
Signature · 1 line
2.48.1
author maintainer
#5 lore raw

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

In reply to Josh Poimboeuf

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.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +1 -1
index 1f15990d3934..1d9a42cbc88f 100644
@@ -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);
 
 
 /**
Signature · 1 line
2.48.1
merge bot Applied
#6 lore raw

[tip: objtool/urgent] objtool, drm/vmwgfx: Don't ignore vmw_send_msg() for ORC

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

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 <[email protected]>
AuthorDate:    Thu, 27 Mar 2025 22:04:23 -07:00
Committer:     Ingo Molnar <[email protected]>
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.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +1 -1
index 1f15990..1d9a42c 100644
@@ -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);
 
 
 /**
merge bot Applied
#4 lore raw

[tip: objtool/urgent] objtool: Fix STACK_FRAME_NON_STANDARD for cold subfunctions

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/urgent branch of tip:

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 <[email protected]>
AuthorDate:    Thu, 27 Mar 2025 22:04:22 -07:00
Committer:     Ingo Molnar <[email protected]>
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

---
 tools/objtool/check.c | 2 ++
 1 file changed, 2 insertions(+)
tools/objtool/check.c +2 -0
index 29de170..fff9d7a 100644
@@ -1014,6 +1014,8 @@ static int add_ignores(struct objtool_file *file)
 		}
 
 		func->ignore = true;
+		if (func->cfunc)
+			func->cfunc->ignore = true;
 	}
 
 	return 0;
merge bot Applied
#2 lore raw

[tip: objtool/urgent] objtool: Fix segfault in ignore_unreachable_insn()

In reply to Josh Poimboeuf
The following commit has been merged into the objtool/urgent branch of tip:

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 <[email protected]>
AuthorDate:    Thu, 27 Mar 2025 22:04:21 -07:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Fri, 28 Mar 2025 14:47:02 +01:00

objtool: Fix segfault in ignore_unreachable_insn()

Check 'prev_insn' before dereferencing it.

---
 tools/objtool/check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/objtool/check.c +1 -1
index 3bf2992..29de170 100644
@@ -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)))