Skip to content

[v1.14.0]: panic: runtime error: invalid memory address or nil pointer dereference in protocol/direct.(*Outbound).fetchMyAddresses on FreeBSD #4502

Description

@arabesc

Operating system

Others

System version

FreeBSD v14.4

Installation type

Original sing-box Command Line

Description

sing-box crashes on startup with a SIGSEGV / nil pointer dereference on FreeBSD 14.4 when initializing the direct outbound.

In sing-box v1.14.0, fetchMyAddresses() was introduced into direct.Outbound.Start(). On FreeBSD, the interface monitoring subsystem is unsupported/stubbed, causing h.router.InterfaceMonitor() (or the default interface lookup) to return nil. Attempting to query addresses on a nil reference results in a crash.

Nearly the same configuration works as expected on FreeBSD 14.4 under v1.13.x.

Logs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x10669f0]

goroutine 1 [running]:
github.com/sagernet/sing-box/protocol/direct.(*Outbound).fetchMyAddresses(0x87405c300)
        github.com/sagernet/sing-box/protocol/direct/outbound.go:102 +0x30
github.com/sagernet/sing-box/protocol/direct.(*Outbound).Start(0x30c4cf0?, 0xa0?)
        github.com/sagernet/sing-box/protocol/direct/outbound.go:95 +0x37
github.com/sagernet/sing-box/adapter.LegacyStart({0x1cd5ea0?, 0x87405c300}, 0x2?)
        github.com/sagernet/sing-box/adapter/lifecycle_legacy.go:5 +0xa9
github.com/sagernet/sing-box/adapter/outbound.(*Manager).Start(0x8741a8000, 0x2)
        github.com/sagernet/sing-box/adapter/outbound/manager.go:86 +0x39d
github.com/sagernet/sing-box/adapter.Start({0x1eafcd0, 0x86ff52370}, {0x1ed3ad8, 0x874239e48}, 0x2, {0x86fded290?, 0xb, 0x0?})
        github.com/sagernet/sing-box/adapter/lifecycle.go:86 +0x1a8
github.com/sagernet/sing-box.(*Box).start(0x8741aa3c0)
        github.com/sagernet/sing-box/box.go:623 +0x37d
github.com/sagernet/sing-box.(*Box).Start(0x8741aa3c0)
        github.com/sagernet/sing-box/box.go:548 +0x36
main.create({{0x874226000, 0x3a17, 0x4000}, 0x0, {0x0, 0x0}, 0x874266210, 0x8741a3b20, 0x0, 0x0, ...})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:164 +0x4a9
main.run()
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:190 +0x293
main.init.func86(0x8741eae00?, {0x1d6b9ec?, 0x4?, 0x1d6b9f0?})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x17
github.com/spf13/cobra.(*Command).execute(0x3101920, {0x8741804c0, 0x2, 0x2})
        github.com/spf13/cobra@v1.10.2/command.go:1019 +0xafb
github.com/spf13/cobra.(*Command).ExecuteC(0x30f27a0)
        github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.10.2/command.go:1071
main.main()
        github.com/sagernet/sing-box/cmd/sing-box/main.go:8 +0x1e

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions