mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Replace ESRCH error with panic in procfs Readlink methods.
Use of RootFromContext(ctx) should always return a valid root in these cases. The comment about "racing with process deletion" and ESRCH return value was erroniously copy-pastad from the task.FSContext().RootDirectory() usage, where such a race is possible. PiperOrigin-RevId: 474885394
This commit is contained in:
committed by
gVisor bot
parent
8e0dc959b4
commit
757e15ce22
@@ -935,8 +935,7 @@ func (s *exeSymlink) Readlink(ctx context.Context, _ *vfs.Mount) (string, error)
|
||||
|
||||
root := vfs.RootFromContext(ctx)
|
||||
if !root.Ok() {
|
||||
// It could have raced with process deletion.
|
||||
return "", linuxerr.ESRCH
|
||||
panic("procfs Readlink requires context with root value")
|
||||
}
|
||||
defer s.fs.SafeDecRef(ctx, root)
|
||||
|
||||
@@ -1008,8 +1007,7 @@ func (s *cwdSymlink) Readlink(ctx context.Context, _ *vfs.Mount) (string, error)
|
||||
|
||||
root := vfs.RootFromContext(ctx)
|
||||
if !root.Ok() {
|
||||
// It could have raced with process deletion.
|
||||
return "", linuxerr.ESRCH
|
||||
panic("procfs Readlink requires context with root value")
|
||||
}
|
||||
defer s.fs.SafeDecRef(ctx, root)
|
||||
|
||||
@@ -1070,8 +1068,7 @@ func (s *rootSymlink) Readlink(ctx context.Context, _ *vfs.Mount) (string, error
|
||||
|
||||
vfsRoot := vfs.RootFromContext(ctx)
|
||||
if !vfsRoot.Ok() {
|
||||
// It could have raced with process deletion.
|
||||
return "", linuxerr.ESRCH
|
||||
panic("procfs Readlink requires context with root value")
|
||||
}
|
||||
defer s.fs.SafeDecRef(ctx, vfsRoot)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user