-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
elfwriter: Unsupported compression types #543
Comments
Do we want to extract the debug information in the case of having a separate DWARF already? parca-agent/pkg/debuginfo/debuginfo.go Line 116 in 6b67638
|
With diff --git a/pkg/elfwriter/elfwriter.go b/pkg/elfwriter/elfwriter.go
index ff9d28b..517a741 100644
--- a/pkg/elfwriter/elfwriter.go
+++ b/pkg/elfwriter/elfwriter.go
@@ -812,6 +812,11 @@ func (w *Writer) compressionHeader(s *elf.Section) *compressionInfo {
default:
w.err = fmt.Errorf("unknown ELF class: %v", w.fhdr.Class)
}
+
+ if c.compressionType != 0 && c.compressionType != elf.COMPRESS_ZLIB {
+ fmt.Println("... Section name=", s.Name, "compression type", c.compressionType, "at addr", fmt.Sprintf("%x", w.here()))
+ }
+
return c
}
we can see we are getting bogus
|
A hypothesis I have been exploring without much success so far is that perhaps the parca-agent/pkg/elfwriter/elfwriter.go Line 565 in 6b67638
and that Offset might be wrong, perhaps we need to use diff --git a/pkg/elfwriter/elfwriter.go b/pkg/elfwriter/elfwriter.go
index ff9d28b..2138cf1 100644
--- a/pkg/elfwriter/elfwriter.go
+++ b/pkg/elfwriter/elfwriter.go
@@ -554,17 +554,17 @@ func (w *Writer) writeSections() {
if sec.Type == elf.SHT_NULL {
continue
}
- // TODO(kakkoyun): Next iterations: Compress DWARF sections when enabled.
- // if w.debugCompressionEnabled {}
+
r := sec.Open()
- if sec.Flags&elf.SHF_COMPRESSED != 0 {
- w.writeCompressedFrom(r, w.compressionHeader(sec))
+ if sec.Flags&elf.SHF_COMPRESSED == 0 {
+ sec.Size = sec.FileSize
+ w.writeFrom(r)
+ } else {
+ header := w.compressionHeader(sec)
+ w.writeCompressedFrom(r, header)
+ sec.FileSize = uint64(w.here()) - uint64(header.compressionOffset)
}
- w.writeFrom(r)
}
- sec.FileSize = uint64(w.here()) - sec.Offset
- // Unless the section is not compressed, the Size and FileSize is the same.
- sec.Size = sec.FileSize
}
// Start writing the section header table.
@@ -812,6 +812,11 @@ func (w *Writer) compressionHeader(s *elf.Section) *compressionInfo {
default:
w.err = fmt.Errorf("unknown ELF class: %v", w.fhdr.Class)
}
+
+ if c.compressionType != 0 && c.compressionType != elf.COMPRESS_ZLIB {
+ fmt.Println("... Section name=", s.Name, "compression type", c.compressionType, "at addr", fmt.Sprintf("%x", w.here()))
+ }
+
return c
} but unfortunately this did not do it |
We actually need to implement a compression writer. AFAIR, it was left as future work. Sorry if I haven't opened the issue for that. |
Using our testing binary from https://github.com/parca-dev/parca-demo/tree/main/cpp and running it with
make -C cpp clang-with-fp && docker run -it parca-demo:cpp-clang-with-fp
we can see that we failed to write sections in the extracted elf file, this isI believe this is what's causing some frames (libc's in this case) to not get symbolised #533
cc @kakkoyun
The text was updated successfully, but these errors were encountered: