mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix PTRACE_GETREGSET write size
The existing logic is backwards and writes iov_len == 0 for a full write. PiperOrigin-RevId: 217560377 Change-Id: I5a39c31bf0ba9063a8495993bfef58dc8ab7c5fa
This commit is contained in:
@@ -921,7 +921,13 @@ func (t *Task) Ptrace(req int64, pid ThreadID, addr, data usermem.Addr) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ar.End -= usermem.Addr(n)
|
||||
|
||||
// Update iovecs to represent the range of the written register set.
|
||||
end, ok := ar.Start.AddLength(uint64(n))
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("%#x + %#x overflows. Invalid reg size > %#x", ar.Start, n, ar.Length()))
|
||||
}
|
||||
ar.End = end
|
||||
return t.CopyOutIovecs(data, usermem.AddrRangeSeqOf(ar))
|
||||
|
||||
case linux.PTRACE_SETREGS:
|
||||
|
||||
Reference in New Issue
Block a user