Fix syzkaller panic for unknown error 58.

The errno 58 is not defined and it is the same as deadlock error. Update this
in the host_linux.go file.

Reported-by: syzbot+60bb099bed4694a37f61@syzkaller.appspotmail.com
PiperOrigin-RevId: 667762290
This commit is contained in:
Nayana Bidari
2024-08-26 16:51:29 -07:00
committed by gVisor bot
parent ccc5642b1d
commit 9ecb627726
+21 -3
View File
@@ -185,6 +185,19 @@ type connection struct {
noOpen bool
}
func connError(err error) error {
errno, ok := linuxerr.TranslateError(err)
if !ok {
log.Warningf("fuse: failed with invalid error: %v", err)
return linuxerr.EINVAL
}
if !linuxerr.IsValid(linuxerr.ToUnix(errno)) {
log.Warningf("fuse: failed with invalid error: %v", err)
return linuxerr.EINVAL
}
return err
}
func (conn *connection) saveInitializedChan() bool {
select {
case <-conn.initializedChan:
@@ -255,7 +268,7 @@ func (conn *connection) Call(ctx context.Context, r *Request) (*Response, error)
// Block requests sent before connection is initialized.
if !conn.Initialized() && r.hdr.Opcode != linux.FUSE_INIT {
if err := ctx.Block(conn.initializedChan); err != nil {
return nil, err
return nil, connError(err)
}
}
@@ -278,10 +291,15 @@ func (conn *connection) Call(ctx context.Context, r *Request) (*Response, error)
fut, err := conn.callFuture(ctx, r)
conn.fd.mu.Unlock()
if err != nil {
return nil, err
return nil, connError(err)
}
return fut.resolve(ctx)
var res *Response
res, err = fut.resolve(ctx)
if err != nil {
return res, connError(err)
}
return res, nil
}
// callFuture makes a request to the server and returns a future response.