mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
tpuproxy: cap VFIO_DEVICE_GET_INFO copy-out size to appArgsz
len(buf) may be larger than appArgsz since it's required to be at least deviceInfo.SizeBytes(). PiperOrigin-RevId: 916048743
This commit is contained in:
@@ -220,7 +220,7 @@ retry:
|
||||
// gVisor is not supposed to change any device information that is
|
||||
// returned from the host since gVisor doesn't own the device.
|
||||
// Passing the device info back to the caller will be just fine.
|
||||
if _, err := t.CopyOutBytes(arg, buf); err != nil {
|
||||
if _, err := t.CopyOutBytes(arg, buf[:min(len(buf), appArgsz)]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return ret, nil
|
||||
|
||||
Reference in New Issue
Block a user