proc: downgrade loadBuildID errors to warnings (#2893)
Most binaries do not have build-ids and it's fine, there's no reason to report it as an error.
This commit is contained in:
parent
1f0b39eab5
commit
a646d06544
@ -1357,31 +1357,31 @@ func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.Wait
|
|||||||
func (bi *BinaryInfo) loadBuildID(image *Image, file *elf.File) {
|
func (bi *BinaryInfo) loadBuildID(image *Image, file *elf.File) {
|
||||||
buildid := file.Section(".note.gnu.build-id")
|
buildid := file.Section(".note.gnu.build-id")
|
||||||
if buildid == nil {
|
if buildid == nil {
|
||||||
bi.logger.Error("can't find build-id note on binary")
|
bi.logger.Warn("can't find build-id note on binary")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
br := buildid.Open()
|
br := buildid.Open()
|
||||||
bh := new(buildIDHeader)
|
bh := new(buildIDHeader)
|
||||||
if err := binary.Read(br, binary.LittleEndian, bh); err != nil {
|
if err := binary.Read(br, binary.LittleEndian, bh); err != nil {
|
||||||
bi.logger.Errorf("can't read build-id header: %v", err)
|
bi.logger.Warnf("can't read build-id header: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
name := make([]byte, bh.Namesz)
|
name := make([]byte, bh.Namesz)
|
||||||
if err := binary.Read(br, binary.LittleEndian, name); err != nil {
|
if err := binary.Read(br, binary.LittleEndian, name); err != nil {
|
||||||
bi.logger.Errorf("can't read build-id name: %v", err)
|
bi.logger.Warnf("can't read build-id name: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.TrimSpace(string(name)) != "GNU\x00" {
|
if strings.TrimSpace(string(name)) != "GNU\x00" {
|
||||||
bi.logger.Error("invalid build-id signature")
|
bi.logger.Warn("invalid build-id signature")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
descBinary := make([]byte, bh.Descsz)
|
descBinary := make([]byte, bh.Descsz)
|
||||||
if err := binary.Read(br, binary.LittleEndian, descBinary); err != nil {
|
if err := binary.Read(br, binary.LittleEndian, descBinary); err != nil {
|
||||||
bi.logger.Errorf("can't read build-id desc: %v", err)
|
bi.logger.Warnf("can't read build-id desc: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
bi.BuildID = hex.EncodeToString(descBinary)
|
bi.BuildID = hex.EncodeToString(descBinary)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user