mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Do not use fs.FileOwnerFromContext in fs/proc.file.UnstableAttr().
From //pkg/sentry/context/context.go: // - It is *not safe* to retain a Context passed to a function beyond the scope // of that function call. Passing a stored kernel.Task as a context.Context to fs.FileOwnerFromContext violates this requirement. PiperOrigin-RevId: 211143021 Change-Id: I4c5b02bd941407be4c9cfdbcbdfe5a26acaec037
This commit is contained in:
@@ -51,7 +51,8 @@ func (f *file) UnstableAttr(ctx context.Context, inode *fs.Inode) (fs.UnstableAt
|
||||
return fs.UnstableAttr{}, err
|
||||
}
|
||||
if f.t != nil {
|
||||
uattr.Owner = fs.FileOwnerFromContext(f.t)
|
||||
creds := f.t.Credentials()
|
||||
uattr.Owner = fs.FileOwner{creds.EffectiveKUID, creds.EffectiveKGID}
|
||||
}
|
||||
return uattr, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user