You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[lldb][Linux] Fix checking of error values when attach fails
Relates to #161510
(it's not fixing it, it's just making the error not be an
unhandled error)
When we fail to attach to a process we see if we can add more
information about why it happpened:
```
if (status.GetError() == EPERM) {
// Depending on the value of ptrace_scope, we can return a different
// error that suggests how to fix it.
return AddPtraceScopeNote(status.ToError());
}
```
ToError creates a new error value and leaves the one in `status`
unchecked. `status`'s error is ok because it will be checked
by Status' destructor.
The problem happens in `AddPtraceScopeNote`. If we take certain
return paths, this new error, or the one we get when trying to
find the ptrace scope, may be unchecked on destruction when the
function returns.
To fix this, in AddPtraceScopeNote, consume any errors that
we are not going to return. Anything returned will be checked
by some caller.
Reproducing this failure mode is difficult but it can be faked
by calling AddPtraceScopeNote earlier. Which is what I did to
prove the concept of the problem.
0 commit comments