[PATCH] D134533: [BPF] Fix Segfault in BTFDebug
Dave Tucker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 07:12:53 PDT 2022
dave-tucker created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
dave-tucker requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Found using bpf-linker after linking a binary with debuginfo with a
library with no debuginfo. In this case, `auto *S` may be NULL and
therefore S->getLine() can segfault.
Signed-off-by: Dave Tucker <datucker at redhat.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134533
Files:
llvm/lib/Target/BPF/BTFDebug.cpp
Index: llvm/lib/Target/BPF/BTFDebug.cpp
===================================================================
--- llvm/lib/Target/BPF/BTFDebug.cpp
+++ llvm/lib/Target/BPF/BTFDebug.cpp
@@ -1343,6 +1343,8 @@
// been generated, construct one based on function signature.
if (LineInfoGenerated == false) {
auto *S = MI->getMF()->getFunction().getSubprogram();
+ if (!S) // unable to get subprogram
+ return;
MCSymbol *FuncLabel = Asm->getFunctionBegin();
constructLineInfo(S, FuncLabel, S->getLine(), 0);
LineInfoGenerated = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134533.462470.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220923/b0b27653/attachment.bin>
More information about the llvm-commits
mailing list