mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
syz-manager: fix logical races in rpc request handling
It is possible that we already called shutdownInstance, but have some requests from this instance already in-flight. Handle this case gracefully.
This commit is contained in:
parent
1c1eb4919d
commit
4dc0927070
@ -223,9 +223,11 @@ func (serv *RPCServer) NewInput(a *rpctype.NewInputArgs, r *int) error {
|
|||||||
defer serv.mu.Unlock()
|
defer serv.mu.Unlock()
|
||||||
|
|
||||||
f := serv.fuzzers[a.Name]
|
f := serv.fuzzers[a.Name]
|
||||||
|
// Note: f may be nil if we called shutdownInstance,
|
||||||
|
// but this request is already in-flight.
|
||||||
genuine := !serv.corpusSignal.Diff(inputSignal).Empty()
|
genuine := !serv.corpusSignal.Diff(inputSignal).Empty()
|
||||||
rotated := false
|
rotated := false
|
||||||
if !genuine && f.rotatedSignal != nil {
|
if !genuine && f != nil && f.rotatedSignal != nil {
|
||||||
rotated = !f.rotatedSignal.Diff(inputSignal).Empty()
|
rotated = !f.rotatedSignal.Diff(inputSignal).Empty()
|
||||||
}
|
}
|
||||||
if !genuine && !rotated {
|
if !genuine && !rotated {
|
||||||
@ -235,7 +237,7 @@ func (serv *RPCServer) NewInput(a *rpctype.NewInputArgs, r *int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.rotatedSignal != nil {
|
if f != nil && f.rotatedSignal != nil {
|
||||||
f.rotatedSignal.Merge(inputSignal)
|
f.rotatedSignal.Merge(inputSignal)
|
||||||
}
|
}
|
||||||
serv.corpusCover.Merge(a.Cover)
|
serv.corpusCover.Merge(a.Cover)
|
||||||
@ -268,7 +270,10 @@ func (serv *RPCServer) Poll(a *rpctype.PollArgs, r *rpctype.PollRes) error {
|
|||||||
|
|
||||||
f := serv.fuzzers[a.Name]
|
f := serv.fuzzers[a.Name]
|
||||||
if f == nil {
|
if f == nil {
|
||||||
log.Fatalf("fuzzer %v is not connected", a.Name)
|
// This is possible if we called shutdownInstance,
|
||||||
|
// but already have a pending request from this instance in-flight.
|
||||||
|
log.Logf(1, "poll: fuzzer %v is not connected", a.Name)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
newMaxSignal := serv.maxSignal.Diff(a.MaxSignal.Deserialize())
|
newMaxSignal := serv.maxSignal.Diff(a.MaxSignal.Deserialize())
|
||||||
if !newMaxSignal.Empty() {
|
if !newMaxSignal.Empty() {
|
||||||
|
Loading…
Reference in New Issue
Block a user