mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
devpts: IterDirents has to check offset and return if it is out of range
panic: runtime error: slice bounds out of range [124:0]
goroutine 136 [running]:
panic({0x3ef9e0?, 0xc000848b28?})
GOROOT/src/runtime/panic.go:1017
runtime.goPanicSliceB(0x7c, 0x0)
GOROOT/src/runtime/panic.go:154
gvisor.dev/gvisor/pkg/sentry/fsimpl/devpts.(*rootInode).IterDirents
pkg/sentry/fsimpl/devpts/devpts.go:342
gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs.(*GenericDirectoryFD).IterDirents
pkg/sentry/fsimpl/kernfs/fd_impl_util.go:224
Reported-by: syzbot+4c8983831b3b9c7feff6@syzkaller.appspotmail.com
PiperOrigin-RevId: 583183528
This commit is contained in:
@@ -334,6 +334,9 @@ func (i *rootInode) IterDirents(ctx context.Context, mnt *vfs.Mount, cb vfs.Iter
|
||||
i.mu.Lock()
|
||||
defer i.mu.Unlock()
|
||||
i.InodeAttrs.TouchAtime(ctx, mnt)
|
||||
if relOffset >= int64(len(i.replicas)) {
|
||||
return offset, nil
|
||||
}
|
||||
ids := make([]int, 0, len(i.replicas))
|
||||
for id := range i.replicas {
|
||||
ids = append(ids, int(id))
|
||||
|
||||
Reference in New Issue
Block a user