linuxboot/fiano

`uefi.Parse` hangs, case #2

xaionaro opened this issue · 0 comments

The symptom is absolutely the same as in issue #311 , but the PR #312 does not help here.

To reproduce:

mkdir /tmp/hang-test
cd /tmp/hang-test
cat > main.go <<EOF
package main
import (
        "io/ioutil"
        "os"
        "log"
        "net/http"
        _ "net/http/pprof"

        "github.com/linuxboot/fiano/pkg/uefi"
)
func main() {
        go func() {
                log.Println(http.ListenAndServe("localhost:6060", nil))
        }()
        b, err := ioutil.ReadAll(os.Stdin)
        if err != nil {
                panic(err)
        }
        b[6147841]++
        _, _ = uefi.Parse(b)
}
EOF
wget 'https://github.com/xaionaro/hack-trash/raw/master/uefi-firmware-example/GALAGOPRO3.fd'
go run main.go < GALAGOPRO3.fd
1 @ 0x4f9ae6 0x4f9a11 0x4f9837 0x4f71a2 0x791101 0x78716a 0x78847c 0x785b28 0x7929a9 0x796f17 0x43225e 0x45f9b1
#       0x4f9ae5        encoding/binary.sizeof+0x285                                    /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/encoding/binary/binary.go:381
#       0x4f9a10        encoding/binary.sizeof+0x1b0                                    /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/encoding/binary/binary.go:391
#       0x4f9836        encoding/binary.dataSize+0x116                                  /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/encoding/binary/binary.go:377
#       0x4f71a1        encoding/binary.Read+0x401                                      /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/encoding/binary/binary.go:231
#       0x791100        github.com/linuxboot/fiano/pkg/uefi.NewSection+0x130            /home/xaionaro/go/src/github.com/linuxboot/fiano/pkg/uefi/section.go:350
#       0x787169        github.com/linuxboot/fiano/pkg/uefi.NewFile+0x409               /home/xaionaro/go/src/github.com/linuxboot/fiano/pkg/uefi/file.go:459
#       0x78847b        github.com/linuxboot/fiano/pkg/uefi.NewFirmwareVolume+0x70b     /home/xaionaro/go/src/github.com/linuxboot/fiano/pkg/uefi/firmwarevolume.go:279
#       0x785b27        github.com/linuxboot/fiano/pkg/uefi.NewBIOSRegion+0x277         /home/xaionaro/go/src/github.com/linuxboot/fiano/pkg/uefi/biosregion.go:115
#       0x7929a8        github.com/linuxboot/fiano/pkg/uefi.Parse+0x78                  /home/xaionaro/go/src/github.com/linuxboot/fiano/pkg/uefi/uefi.go:154
#       0x796f16        main.main+0xa6                                                  /tmp/123/main.go:20
#       0x43225d        runtime.main+0x21d                                              /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/runtime/proc.go:203