invalid memory address or nil pointer dereference
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 38.2k
- Forks
- 4.6k
- Avg merge
- 19d 15h
- Merged PRs (30d)
- 1
Description
操作系统
Linux
系统版本
raspberrypi 5
安装类型
sing-box 原始命令行程序
如果您使用图形客户端程序,请提供该程序版本。
No response
版本
sing-box version 1.11.5
Environment: go1.24.1 linux/arm64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: 8e2baf40f11973c7eb7d34fa741f282a5cb275f3
CGO: disabled
描述
错误信息:
panic: runtime error: invalid memory address or nil pointer dereference
Mar 20 10:22:53 raspberrypi sing-box[196972]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xa44e00]
Mar 20 10:22:53 raspberrypi sing-box[196972]: goroutine 62 [running]:
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-box/route.(*dnsHijacker).NewPacketEx(0x0, 0x4000f13980, {{{0x0, 0xffff08080808}, {0x400014a030}}, 0x35>
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-box/route/dns.go:91 +0x50
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing/common/udpnat2.(*Service).NewPacket(0x40001fd1a0, {0x400100a808, 0x2a, 0x0?}, {{{0x0, 0xffffac130001},>
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing@v0.6.3/common/udpnat2/service.go:78 +0x3a0
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun.(*UDPForwarder).HandlePacket(0x40001fd170, {0x35, {{0x8, 0x8, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, ...}, >
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun@v0.6.1/stack_gvisor_udp.go:52 +0x1f0
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/stack.(*nic).DeliverTransportPacket(0x4000214488, 0x11, 0x4000e503c0)
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/stack/nic.go:869 +0x3c4
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/network/ipv4.(*endpoint).deliverPacketLocally(0x4000239b08, {0x4000e1e980, 0x14, 0x80}, 0x>
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/network/ipv4/ipv4.go:1335 +0xb2c
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/network/ipv4.(*endpoint).handleValidatedPacket(0x4000239b08, {0x4000e1e980, 0x14, 0x80}, 0>
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/network/ipv4/ipv4.go:1166 +0x6b4
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/network/ipv4.(*endpoint).HandlePacket(0x4000239b08, 0x4000e503c0)
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/network/ipv4/ipv4.go:874 +0x59c
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/stack.(*nic).DeliverNetworkPacket(0x4000214488, 0x800, 0x4000e503c0)
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/stack/nic.go:769 +0x1ac
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor/pkg/tcpip/link/channel.(*Endpoint).InjectInbound(0x0?, 0x800, 0x4000e503c0)
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/gvisor@v0.0.0-20241123041152-536d05261cff/pkg/tcpip/link/channel/channel.go:208 +0xac
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun.(*Mixed).processIPv4(0x400087af90, {0x4000c10600, 0x45, 0x5dc})
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun@v0.6.1/stack_mixed.go:196 +0x230
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun.(*Mixed).processPacket(0x400087af90, {0x4000c10600?, 0x28?, 0x5dc?})
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun@v0.6.1/stack_mixed.go:168 +0xf4
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun.(*Mixed).tunLoop(0x400087af90)
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun@v0.6.1/stack_mixed.go:93 +0x290
Mar 20 10:22:53 raspberrypi sing-box[196972]: created by github.com/sagernet/sing-tun.(*Mixed).Start in goroutine 1
Mar 20 10:22:53 raspberrypi sing-box[196972]: github.com/sagernet/sing-tun@v0.6.1/stack_mixed.go:48 +0x210
Mar 20 10:22:53 raspberrypi systemd[1]: sing-box.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 20 10:22:53 raspberrypi systemd[1]: sing-box.service: Failed with result 'exit-code'.
配置:
"dns": {
"servers": [
{
"tag": "remote",
"address": "https://8.8.8.8/dns-query",
"detour": "proxy",
"strategy": "ipv4_only"
},
{
"tag": "alidns",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
},
{
"tag": "block",
"address": "rcode://success"
},
{
"tag": "fakedns",
"address": "fakeip",
"strategy": "ipv4_only" }
],
"rules": [
{
"rule_set": "geosite-category-ads-all",
"server": "block"
},
{
"rule_set": "geosite-cn",
"server": "alidns",
"disable_cache": true
},
{
"query_type": [
"A",
"AAAA"
],
"rule_set": [
"geosite-google",
"geosite-custom",
"geosite-github",
"geosite-category-ai-chat-!cn",
"geosite-category-media",
"geosite-wikimedia",
"geosite-nvidia",
"geosite-docker",
"geosite-linkedin",
"geosite-yahoo",
"geosite-category-ipfs"
],
"server": "fakedns",
"rewrite_ttl": 3600,
"disable_cache": false
},
{
"source_ip_cidr":["192.168.251.0/24"],
"query_type": [
"A",
"AAAA"
],
"rule_set": [
"geosite-gfw"
],
"server": "fakedns",
"disable_cache": false
},
{
"clash_mode": "direct",
"server": "alidns"
},
{
"clash_mode": "global",
"server": "remote"
}
],
"fakeip": {
"enabled": true,
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
},
"final": "alidns",
"disable_cache": true
},
"inbounds": [
{
"tag": "tun",
"type": "tun",
"address": [
"172.19.0.1/30"
],
"auto_route": true,
"mtu": 1500
},
{
"tag": "localProxy",
"type": "mixed",
"listen": "0.0.0.0",
"listen_port": 2080,
"users": []
}
],
重现方式
无法重现
日志
支持我们
- 我已经 赞助
完整性要求
- 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
- 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
- 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading route/dns.go:91, where the nil receiver appears in the panic, then trace the UDP path through sing-tun's stack_gvisor_udp.go:52. The report says the failure cannot be reproduced, so first determine the conditions that leave dnsHijacker nil using the supplied DNS, fake-IP, and TUN configuration. Done means the cause is identified and the same path no longer crashes, with regression coverage if reproducible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100