mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-26 23:01:05 +08:00
linux: Patch for capget syscall error
Bug: crashpad:332 Change-Id: If867fd1780e4be1567048ad7fab29f5e61560aff Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2120780 Commit-Queue: Mark Mentovai <mark@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
194e23910c
commit
9da2573ca9
@ -93,23 +93,20 @@ PtraceScope GetPtraceScope() {
|
||||
}
|
||||
|
||||
bool HaveCapSysPtrace() {
|
||||
struct __user_cap_header_struct cap_header = {};
|
||||
struct __user_cap_data_struct cap_data = {};
|
||||
|
||||
__user_cap_header_struct cap_header;
|
||||
cap_header.pid = getpid();
|
||||
cap_header.version = _LINUX_CAPABILITY_VERSION_3;
|
||||
|
||||
__user_cap_data_struct cap_data[_LINUX_CAPABILITY_U32S_3];
|
||||
if (syscall(SYS_capget, &cap_header, &cap_data) != 0) {
|
||||
PLOG(ERROR) << "capget";
|
||||
LOG_IF(ERROR, errno == EINVAL) << "cap_header.version " << std::hex
|
||||
<< cap_header.version;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cap_header.version != _LINUX_CAPABILITY_VERSION_3) {
|
||||
LOG(ERROR) << "Unexpected capability version " << std::hex
|
||||
<< cap_header.version;
|
||||
return false;
|
||||
}
|
||||
|
||||
return (cap_data.effective & (1 << CAP_SYS_PTRACE)) != 0;
|
||||
return (cap_data[CAP_TO_INDEX(CAP_SYS_PTRACE)].effective &
|
||||
CAP_TO_MASK(CAP_SYS_PTRACE)) != 0;
|
||||
}
|
||||
|
||||
bool SendMessageToClient(
|
||||
|
Loading…
x
Reference in New Issue
Block a user