safing / portmaster

🏔 Love Freedom - ❌ Block Mass Surveillance
https://safing.io
GNU General Public License v3.0
9.31k stars 299 forks source link

Invalid memory address or nil pointer dereference #1711

Open dazu89 opened 1 week ago

dazu89 commented 1 week ago

What happened:

No internet access on Windows 10, Version 10.0.19045 using Portmaster 1.6.24 after waking from prolonged sleep. Sub-process msedgewebview2.exe showed high memory usage, >4GB. Portmaster UI could no longer be opened, and portmaster related processes not successfully terminated from the taskmanager. Similar circumstances in past versions have led to a BSOD as described in https://github.com/safing/portmaster/issues/1297.

Debug Information:

executing core/portmaster-core.exe version 1.6.24 on windows amd64
===== PANIC =====
runtime error: invalid memory address or nil pointer dereference

goroutine 26 [running]:
runtime/debug.Stack()
    /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
github.com/safing/portmaster/service/mgr.(*Manager).runWorker.func1()
    /go-workdir/service/mgr/worker.go:304 +0xbb
panic({0x1638b20?, 0x215ce20?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
github.com/safing/portmaster/windows_kext/kextinterface.(*KextFile).Write(0xc000047ad0?, {0xc000047aa7?, 0xb3f909?, 0x1697b611548?})
    /go-workdir/windows_kext/kextinterface/kext_file.go:57 +0x27
github.com/safing/portmaster/windows_kext/kextinterface.SendShutdownCommand(...)
    /go-workdir/windows_kext/kextinterface/command.go:69
github.com/safing/portmaster/service/firewall/interception/windowskext2.shutdownRequest(...)
    /go-workdir/service/firewall/interception/windowskext2/kext.go:91
github.com/safing/portmaster/service/firewall/interception/windowskext2.Stop()
    /go-workdir/service/firewall/interception/windowskext2/kext.go:66 +0x36
github.com/safing/portmaster/service/firewall/interception.stopInterception()
    /go-workdir/service/firewall/interception/interception_windows.go:128 +0x1f
github.com/safing/portmaster/service/firewall/interception.stop()
    /go-workdir/service/firewall/interception/module.go:76 +0x2b
github.com/safing/portmaster/service/firewall/interception.(*Interception).Stop(0xc000572190?)
    /go-workdir/service/firewall/interception/module.go:31 +0xf
github.com/safing/portmaster/service/mgr.(*Group).stopFrom.func1(0x1957f58?)
    /go-workdir/service/mgr/group.go:198 +0x1f
github.com/safing/portmaster/service/mgr.(*Manager).runWorker(0xc000219260?, 0xc0005be700, 0xc000aa62d0)
    /go-workdir/service/mgr/worker.go:332 +0xfb
github.com/safing/portmaster/service/mgr.(*Manager).Do(0xc000219260, {0xc000c10588, 0x18}, 0xc000aa62d0)
    /go-workdir/service/mgr/worker.go:264 +0x1f3
github.com/safing/portmaster/service/mgr.(*Group).stopFrom(0xc0005a8740, 0x1784429?)
    /go-workdir/service/mgr/group.go:197 +0x153
github.com/safing/portmaster/service/mgr.(*Group).Start(0x0?)
    /go-workdir/service/mgr/group.go:148 +0x469
github.com/safing/portmaster/service.(*Instance).Start(...)
    /go-workdir/service/instance.go:572
main.main.func1()
    /go-workdir/cmds/portmaster-core/main.go:90 +0x28
created by main.main in goroutine 1
    /go-workdir/cmds/portmaster-core/main.go:89 +0x40d
=====  END  =====
dhaavi commented 1 week ago

Hey @dazu89, thanks for reporting this and thank you for Beta testing!

We will look into it. The good news is, this is in the core service and will be much easier to fix than the previous issues in the kext.

dazu89 commented 1 week ago

Thank you, for looking into this @dhaavi and @vlabo. Nice to here that the core-rewrite eases the debugging. To be completely honest, I moved to the beta, because the stable version was worse than the beta version leading to frequent and serious BSOD entailing data loss. While BSOD have become less frequent with the kext rewrite, I still experienced one last week, but could not extract any useful debug information from the logs. Issues tend to surface after prolonged sleep of several hours when connected to a VPN via openconnect.

dhaavi commented 8 hours ago

We've just released Portmaster v1.6.25 to beta, which includes a fix for the bluescreen issue. Please test if this resolves the issue for you too.