Return well-defined error on short payload in FUSE.
Errors from syscalls without a well-defined translation to errnos result in sentry panics. Reported-by: syzbot+907201b840bb25d94e00@syzkaller.appspotmail.com PiperOrigin-RevId: 426248731
This commit is contained in:
parent
237e45d23a
commit
55ef371668
|
@ -15,11 +15,11 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"gvisor.dev/gvisor/pkg/abi/linux"
|
"gvisor.dev/gvisor/pkg/abi/linux"
|
||||||
|
"gvisor.dev/gvisor/pkg/errors/linuxerr"
|
||||||
"gvisor.dev/gvisor/pkg/hostarch"
|
"gvisor.dev/gvisor/pkg/hostarch"
|
||||||
|
"gvisor.dev/gvisor/pkg/log"
|
||||||
"gvisor.dev/gvisor/pkg/marshal"
|
"gvisor.dev/gvisor/pkg/marshal"
|
||||||
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
"gvisor.dev/gvisor/pkg/sentry/kernel"
|
||||||
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
|
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
|
||||||
|
@ -212,7 +212,9 @@ func (r *Response) UnmarshalPayload(m marshal.Marshallable) error {
|
||||||
wantDataLen := uint32(m.SizeBytes())
|
wantDataLen := uint32(m.SizeBytes())
|
||||||
|
|
||||||
if haveDataLen < wantDataLen {
|
if haveDataLen < wantDataLen {
|
||||||
return fmt.Errorf("payload too small. Minimum data lenth required: %d, but got data length %d", wantDataLen, haveDataLen)
|
log.Warningf("fusefs: Payload too small. Minimum data length required: %d, but got data length %d", wantDataLen, haveDataLen)
|
||||||
|
return linuxerr.EINVAL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The response data is empty unless there is some payload. And so, doesn't
|
// The response data is empty unless there is some payload. And so, doesn't
|
||||||
|
|
Loading…
Reference in New Issue