goretk / redress

Redress - A tool for analyzing stripped Go binaries
GNU Affero General Public License v3.0
907 stars 58 forks source link

panic: Unsupported architecture (ARM related?) #35

Closed 0xdevalias closed 9 months ago

0xdevalias commented 9 months ago
$ /opt/homebrew/Cellar/redress/1.1.1/bin/redress info /opt/homebrew/Cellar/redress/1.1.1/bin/redress
panic: Unsupported architecture

goroutine 1 [running]:
github.com/goretk/gore.(*machoFile).getFileInfo(0x1400002c4a0)
    github.com/goretk/gore@v0.11.1/macho.go:117 +0xdc
github.com/goretk/gore.Open({0x16f1e6a84, 0x2e})
    github.com/goretk/gore@v0.11.1/file.go:86 +0x348
main.listInfo({0x16f1e6a84?, 0x0?})
    github.com/goretk/redress/info.go:50 +0x90
main.init.1.func1(0x140000e6e00?, {0x1400002c300?, 0x4?, 0x100e4f6df?})
    github.com/goretk/redress/info.go:25 +0x30
github.com/spf13/cobra.(*Command).execute(0x140000c4280, {0x1400002c2e0, 0x1, 0x1})
    github.com/spf13/cobra@v1.2.1/command.go:860 +0x53c
github.com/spf13/cobra.(*Command).ExecuteC(0x1010dd2c0)
    github.com/spf13/cobra@v1.2.1/command.go:974 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
    github.com/goretk/redress/main.go:25 +0x24

Potentially related:

Background Context

I believe the below is related to this issue (adding here particularly for context of error messages/etc since this issue didn't show up when I searched originally):


$ /opt/homebrew/Cellar/redress/1.1.1/bin/redress info /opt/homebrew/Cellar/redress/1.1.1/bin/redress
panic: Unsupported architecture

goroutine 1 [running]:
github.com/goretk/gore.(*machoFile).getFileInfo(0x1400002c4a0)
    github.com/goretk/gore@v0.11.1/macho.go:117 +0xdc
github.com/goretk/gore.Open({0x16f1e6a84, 0x2e})
    github.com/goretk/gore@v0.11.1/file.go:86 +0x348
main.listInfo({0x16f1e6a84?, 0x0?})
    github.com/goretk/redress/info.go:50 +0x90
main.init.1.func1(0x140000e6e00?, {0x1400002c300?, 0x4?, 0x100e4f6df?})
    github.com/goretk/redress/info.go:25 +0x30
github.com/spf13/cobra.(*Command).execute(0x140000c4280, {0x1400002c2e0, 0x1, 0x1})
    github.com/spf13/cobra@v1.2.1/command.go:860 +0x53c
github.com/spf13/cobra.(*Command).ExecuteC(0x1010dd2c0)
    github.com/spf13/cobra@v1.2.1/command.go:974 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
    github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
    github.com/goretk/redress/main.go:25 +0x24

is this only for x86?

_Originally posted by @chenrui333 in https://github.com/Homebrew/homebrew-core/pull/155724#discussion_r1407055279_


That seems to be coming from the gore lib that redress depends on:

https://github.com/goretk/gore/blob/78568206ae24043a24fc8bf89443ad6164a7509f/macho.go#L104-L123


What system were you trying to run it on?

_Originally posted by @0xdevalias in https://github.com/Homebrew/homebrew-core/pull/155724#discussion_r1407056976_


I am trying on ventura arm, if does not run for arm, then we probably need depends_on arch: :x86_64 as well as some upstream note on it

_Originally posted by @chenrui333 in https://github.com/Homebrew/homebrew-core/pull/155724#discussion_r1407058050_

Originally posted by @0xdevalias in https://github.com/goretk/gore/issues/21#issuecomment-1829045412

I suspect this issue may be related:

Though based on that, I believe that the CLI can be compiled and run fine on ARM, it just can't process Golang binaries compiled for ARM currently.

@chenrui333 Are you able to confirm by running your local arm compiled version against one of the presumably non-ARM release versions (or any other non-ARM Golang binary)?

If that works.. then I guess we just need to figure out a better way to implement the test on ARM systems. Any ideas?

_Originally posted by @0xdevalias in https://github.com/Homebrew/homebrew-core/pull/155724#discussion_r1407062735_

TcM1911 commented 9 months ago

Please check if it's still an issue with the latest release.

0xdevalias commented 9 months ago

Please check if it's still an issue with the latest release

@TcM1911 From a quick initial test, I don't think so. I'm running the original test that failed currently, so will check if that works.

Looking at the commit changes, I didn't see where/how this would have been fixed though. Are you able to elaborate on where the expected fix came from?

I'm guessing it was probably this one:

Along with this?

0xdevalias commented 9 months ago

@TcM1911 My full test also passed, so I would say this works now:

TcM1911 commented 9 months ago

Analyzing ARM binaries isn't currently fully supported. That patch added arm64 just to prevent crashes... The "basic" functionality should at least work.

0xdevalias commented 9 months ago

Analyzing ARM binaries isn't currently fully supported. That patch added arm64 just to prevent crashes... The "basic" functionality should at least work.

@TcM1911 That makes sense. Thanks for that :)