diff options
author | David Spickett <david.spickett@linaro.org> | 2025-10-07 09:41:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-07 09:41:51 +0100 |
commit | fb17bc70acd77f1799ee64f6d2a21d8df2944b5a (patch) | |
tree | 9ea5363133aa8c0979e08d911d87c8b53f853f8c /clang/test/Headers/x86-intrinsics-headers.c | |
parent | a81b6c68366927531b9807b43cc79ba1ab4446eb (diff) | |
download | llvm-main.zip llvm-main.tar.gz llvm-main.tar.bz2 |
Relates to #161510
Fixes 6db44e52ce474bbeb66042073a6e3c6c586f78a2
(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 happened:
```
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.
Diffstat (limited to 'clang/test/Headers/x86-intrinsics-headers.c')
0 files changed, 0 insertions, 0 deletions