Skip to contentSkip to conversation

objtool: continue if find_insn() fails in decode_instructions()

PATCH In review Sathvika Vasireddy 2 participants 5 messages Dec 8, 2022 – Jan 9, 2023 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: continue if find_insn() fails in decode_instructions()

Currently, decode_instructions() is failing if it is not able to find instruction, and this is happening since commit dbcdbdfdf137b4 ("objtool: Rework instruction -> symbol mapping") because it is expecting instruction for STT_NOTYPE symbols.

Due to this, the following objtool warnings are seen:
[1] arch/powerpc/kernel/optprobes_head.o: warning: objtool: optprobe_template_end(): can't find starting instruction
[2] arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't find starting instruction
[3] arch/powerpc/kernel/head_64.o: warning: objtool: end_first_256B(): can't find starting instruction

The warnings are thrown because find_insn() is failing for symbols that are at the end of the file, or at the end of the section. Given how STT_NOTYPE symbols are currently handled in decode_instructions(), continue if the instruction is not found, instead of throwing warning and returning.

---
 tools/objtool/check.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
tools/objtool/check.c +2 -5
index 4350be739f4f..bce2be5ebf36 100644
@@ -430,11 +430,8 @@ static int decode_instructions(struct objtool_file *file)
 			if (func->return_thunk || func->alias != func)
 				continue;
 
-			if (!find_insn(file, sec, func->offset)) {
-				WARN("%s(): can't find starting instruction",
-				     func->name);
-				return -1;
-			}
+			if (!find_insn(file, sec, func->offset))
+				continue;
 
 			sym_for_each_insn(file, func, insn) {
 				insn->sym = func;
Signature · 1 line
2.31.1
#1 lore raw
Quoted 10 lines · Sathvika Vasireddy

Currently, decode_instructions() is failing if it is not able to find instruction, and this is happening since commit dbcdbdfdf137b4 ("objtool: Rework instruction -> symbol mapping") because it is expecting instruction for STT_NOTYPE symbols.

Due to this, the following objtool warnings are seen:
[1] arch/powerpc/kernel/optprobes_head.o: warning: objtool: optprobe_template_end(): can't find starting instruction
[2] arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't find starting instruction
[3] arch/powerpc/kernel/head_64.o: warning: objtool: end_first_256B(): can't find starting instruction

Quoted 8 lines

The warnings are thrown because find_insn() is failing for symbols that are at the end of the file, or at the end of the section. Given how STT_NOTYPE symbols are currently handled in decode_instructions(), continue if the instruction is not found, instead of throwing warning and returning.

The SOB chain doesn't look valid: is Naveen N. Rao, the first SOB line, the author of the patch? If yes then a matching From: line is needed.

Or if two people developed the patch, then Co-developed-by should be used:

[ In this SOB sequence "Second Co-Author" is the one who submits the patch. ]

[ Please only use Co-developed-by if actual lines of code were written by
the co-author that created copyrightable material - it's not a courtesy tag. Reviewed-by/Acked-by/Tested-by can be used to credit non-code contributions. ]

Thanks,

Ingo

#2 lore raw

Hi Ingo, Happy New Year!

Quoted 30 lines · Ingo Molnar
Quoted 10 lines · Sathvika Vasireddy

Currently, decode_instructions() is failing if it is not able to find instruction, and this is happening since commit dbcdbdfdf137b4 ("objtool: Rework instruction -> symbol mapping") because it is expecting instruction for STT_NOTYPE symbols.

Due to this, the following objtool warnings are seen:
[1] arch/powerpc/kernel/optprobes_head.o: warning: objtool: optprobe_template_end(): can't find starting instruction
[2] arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't find starting instruction
[3] arch/powerpc/kernel/head_64.o: warning: objtool: end_first_256B(): can't find starting instruction

Quoted 8 lines

The warnings are thrown because find_insn() is failing for symbols that are at the end of the file, or at the end of the section. Given how STT_NOTYPE symbols are currently handled in decode_instructions(), continue if the instruction is not found, instead of throwing warning and returning.

The SOB chain doesn't look valid: is Naveen N. Rao, the first SOB line, the author of the patch? If yes then a matching From: line is needed.

Or if two people developed the patch, then Co-developed-by should be used:

Quoted 6 lines

[ In this SOB sequence "Second Co-Author" is the one who submits the patch. ]

[ Please only use Co-developed-by if actual lines of code were written by
the co-author that created copyrightable material - it's not a courtesy tag. Reviewed-by/Acked-by/Tested-by can be used to credit non-code contributions. ]

Thank you for the clarification, and for bringing these points to my attention. I'll keep these things in mind. In this case, since both Naveen N. Rao and I developed the patch, the below tags are applicable.

However, I would be dropping this particular patch, since I think Nick's patch [1] is better to fix the objtool issue.

[1] - https://lore.kernel.org/linuxppc-dev/[email protected]/

Thanks for reviewing!

- Sathvika

Acked-by Sathvika Vasireddy
#3 lore raw
Quoted 1 line · Sathvika Vasireddy

Hi Ingo, Happy New Year!

Happy New Year to you too! :-)

Quoted 42 lines · Ingo Molnar
Quoted 30 lines · Sathvika Vasireddy
Quoted 11 lines

Currently, decode_instructions() is failing if it is not able to find instruction, and this is happening since commit dbcdbdfdf137b4 ("objtool: Rework instruction -> symbol mapping") because it is expecting instruction for STT_NOTYPE symbols.

Due to this, the following objtool warnings are seen:
[1] arch/powerpc/kernel/optprobes_head.o: warning: objtool: optprobe_template_end(): can't find starting instruction
[2] arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't find starting instruction
[3] arch/powerpc/kernel/head_64.o: warning: objtool: end_first_256B(): can't find starting instruction

Quoted 8 lines

The warnings are thrown because find_insn() is failing for symbols that are at the end of the file, or at the end of the section. Given how STT_NOTYPE symbols are currently handled in decode_instructions(), continue if the instruction is not found, instead of throwing warning and returning.

The SOB chain doesn't look valid: is Naveen N. Rao, the first SOB line, the author of the patch? If yes then a matching From: line is needed.

Or if two people developed the patch, then Co-developed-by should be used:

Quoted 6 lines

[ In this SOB sequence "Second Co-Author" is the one who submits the patch. ]

[ Please only use Co-developed-by if actual lines of code were written by
the co-author that created copyrightable material - it's not a courtesy tag. Reviewed-by/Acked-by/Tested-by can be used to credit non-code contributions. ]

Thank you for the clarification, and for bringing these points to my attention. I'll keep these things in mind. In this case, since both Naveen N. Rao and I developed the patch, the below tags
are applicable.

Quoted 4 lines

... while filling in your real names & email addresses I suppose. ;-)

Quoted 5 lines

However, I would be dropping this particular patch, since I think Nick's patch [1] is better to fix the objtool issue.

[1] - https://lore.kernel.org/linuxppc-dev/[email protected]/

Ok, I'll pick up Nick's fix, with these tags added for the PowerPC regression aspect and your review:

To document & credit the efforts of your patch.

Thanks,

Ingo

#4 lore raw
Quoted 47 lines · Ingo Molnar
Quoted 1 line · Sathvika Vasireddy

Hi Ingo, Happy New Year!

Happy New Year to you too! :-)

Quoted 42 lines · Ingo Molnar
Quoted 30 lines · Sathvika Vasireddy
Quoted 11 lines

Currently, decode_instructions() is failing if it is not able to find instruction, and this is happening since commit dbcdbdfdf137b4 ("objtool: Rework instruction -> symbol mapping") because it is expecting instruction for STT_NOTYPE symbols.

Due to this, the following objtool warnings are seen:
[1] arch/powerpc/kernel/optprobes_head.o: warning: objtool: optprobe_template_end(): can't find starting instruction
[2] arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't find starting instruction
[3] arch/powerpc/kernel/head_64.o: warning: objtool: end_first_256B(): can't find starting instruction

Quoted 8 lines

The warnings are thrown because find_insn() is failing for symbols that are at the end of the file, or at the end of the section. Given how STT_NOTYPE symbols are currently handled in decode_instructions(), continue if the instruction is not found, instead of throwing warning and returning.

The SOB chain doesn't look valid: is Naveen N. Rao, the first SOB line, the author of the patch? If yes then a matching From: line is needed.

Or if two people developed the patch, then Co-developed-by should be used:

Quoted 6 lines

[ In this SOB sequence "Second Co-Author" is the one who submits the patch. ]

[ Please only use Co-developed-by if actual lines of code were written by
the co-author that created copyrightable material - it's not a courtesy tag. Reviewed-by/Acked-by/Tested-by can be used to credit non-code contributions. ]

Thank you for the clarification, and for bringing these points to my attention. I'll keep these things in mind. In this case, since both Naveen N. Rao and I developed the patch, the below tags
are applicable.

Quoted 5 lines
Quoted 4 lines

... while filling in your real names & email addresses I suppose. ;-)

Indeed :-)

Quoted 5 lines
Quoted 5 lines

However, I would be dropping this particular patch, since I think Nick's patch [1] is better to fix the objtool issue.

[1] - https://lore.kernel.org/linuxppc-dev/[email protected]/

Quoted 8 lines

Ok, I'll pick up Nick's fix, with these tags added for the PowerPC regression aspect and your review:

To document & credit the efforts of your patch.

Sure, thank you!

- Sathvika