mirror of
https://github.com/safing/portmaster
synced 2025-09-04 19:49:15 +00:00
Merge pull request #1738 from safing/fix/core-deadlocks
Fix deadlocks and process username issue
This commit is contained in:
commit
ee58324aee
4 changed files with 14 additions and 7 deletions
|
@ -3,6 +3,7 @@ package compat
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/safing/portmaster/service/mgr"
|
||||||
"github.com/safing/portmaster/service/network/packet"
|
"github.com/safing/portmaster/service/network/packet"
|
||||||
"github.com/safing/portmaster/service/process"
|
"github.com/safing/portmaster/service/process"
|
||||||
)
|
)
|
||||||
|
@ -31,10 +32,16 @@ func SubmitDNSCheckDomain(subdomain string) (respondWith net.IP) {
|
||||||
|
|
||||||
// ReportSecureDNSBypassIssue reports a DNS bypassing issue for the given process.
|
// ReportSecureDNSBypassIssue reports a DNS bypassing issue for the given process.
|
||||||
func ReportSecureDNSBypassIssue(p *process.Process) {
|
func ReportSecureDNSBypassIssue(p *process.Process) {
|
||||||
secureDNSBypassIssue.notify(p)
|
module.mgr.Go("report secure dns bypass issue", func(w *mgr.WorkerCtx) error {
|
||||||
|
secureDNSBypassIssue.notify(p)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportMultiPeerUDPTunnelIssue reports a multi-peer UDP tunnel for the given process.
|
// ReportMultiPeerUDPTunnelIssue reports a multi-peer UDP tunnel for the given process.
|
||||||
func ReportMultiPeerUDPTunnelIssue(p *process.Process) {
|
func ReportMultiPeerUDPTunnelIssue(p *process.Process) {
|
||||||
multiPeerUDPTunnelIssue.notify(p)
|
module.mgr.Go("report multi-peer udp tunnel issue", func(w *mgr.WorkerCtx) error {
|
||||||
|
multiPeerUDPTunnelIssue.notify(p)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,11 +302,11 @@ func UpdateIPsAndCNAMEs(q *resolver.Query, rrCache *resolver.RRCache, conn *netw
|
||||||
Expires: rrCache.Expires,
|
Expires: rrCache.Expires,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve all CNAMEs in the correct order and add the to the record.
|
// Resolve all CNAMEs in the correct order and add the to the record - up to max 50 layers.
|
||||||
domain := q.FQDN
|
domain := q.FQDN
|
||||||
for {
|
for range 50 {
|
||||||
nextDomain, isCNAME := cnames[domain]
|
nextDomain, isCNAME := cnames[domain]
|
||||||
if !isCNAME {
|
if !isCNAME || nextDomain == domain {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,8 +224,8 @@ func handleRequest(ctx context.Context, w dns.ResponseWriter, request *dns.Msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the request as open, as we don't know if there will be a connection or not.
|
// Save the request as open, as we don't know if there will be a connection or not.
|
||||||
network.SaveOpenDNSRequest(q, rrCache, conn)
|
|
||||||
firewall.UpdateIPsAndCNAMEs(q, rrCache, conn)
|
firewall.UpdateIPsAndCNAMEs(q, rrCache, conn)
|
||||||
|
network.SaveOpenDNSRequest(q, rrCache, conn)
|
||||||
|
|
||||||
case network.VerdictUndeterminable:
|
case network.VerdictUndeterminable:
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|
|
@ -256,7 +256,7 @@ func loadProcess(ctx context.Context, key string, pInfo *processInfo.Process) (*
|
||||||
// Username
|
// Username
|
||||||
process.UserName, err = pInfo.UsernameWithContext(ctx)
|
process.UserName, err = pInfo.UsernameWithContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("process: failed to get Username for p%d: %w", pInfo.Pid, err)
|
log.Tracer(ctx).Warningf("process: failed to get username (PID %d): %s", pInfo.Pid, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: User Home
|
// TODO: User Home
|
||||||
|
|
Loading…
Add table
Reference in a new issue