mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Fix monitor for Android-ARM64
PiperOrigin-RevId: 431926820 Change-Id: Ie5adc1ec6accc7e68782c26b65fac0c32cded498
This commit is contained in:
parent
692f0260b3
commit
3f042fa54f
|
@ -598,10 +598,17 @@ bool Monitor::InitSendCwd() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Monitor::InitApplyLimit(pid_t pid, __rlimit_resource resource,
|
bool Monitor::InitApplyLimit(pid_t pid, int resource,
|
||||||
const rlimit64& rlim) const {
|
const rlimit64& rlim) const {
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
using RlimitResource = int;
|
||||||
|
#else
|
||||||
|
using RlimitResource = __rlimit_resource;
|
||||||
|
#endif
|
||||||
|
|
||||||
rlimit64 curr_limit;
|
rlimit64 curr_limit;
|
||||||
if (prlimit64(pid, resource, nullptr, &curr_limit) == -1) {
|
if (prlimit64(pid, static_cast<RlimitResource>(resource), nullptr,
|
||||||
|
&curr_limit) == -1) {
|
||||||
PLOG(ERROR) << "prlimit64(" << pid << ", " << util::GetRlimitName(resource)
|
PLOG(ERROR) << "prlimit64(" << pid << ", " << util::GetRlimitName(resource)
|
||||||
<< ")";
|
<< ")";
|
||||||
} else if (rlim.rlim_cur > curr_limit.rlim_max) {
|
} else if (rlim.rlim_cur > curr_limit.rlim_max) {
|
||||||
|
@ -613,7 +620,8 @@ bool Monitor::InitApplyLimit(pid_t pid, __rlimit_resource resource,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prlimit64(pid, resource, &rlim, nullptr) == -1) {
|
if (prlimit64(pid, static_cast<RlimitResource>(resource), &rlim, nullptr) ==
|
||||||
|
-1) {
|
||||||
PLOG(ERROR) << "prlimit64(" << pid << ", " << util::GetRlimitName(resource)
|
PLOG(ERROR) << "prlimit64(" << pid << ", " << util::GetRlimitName(resource)
|
||||||
<< ", " << rlim.rlim_cur << ")";
|
<< ", " << rlim.rlim_cur << ")";
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -94,8 +94,7 @@ class Monitor final {
|
||||||
bool InitApplyLimits();
|
bool InitApplyLimits();
|
||||||
|
|
||||||
// Applies individual limit on the sandboxee.
|
// Applies individual limit on the sandboxee.
|
||||||
bool InitApplyLimit(pid_t pid, __rlimit_resource resource,
|
bool InitApplyLimit(pid_t pid, int resource, const rlimit64& rlim) const;
|
||||||
const rlimit64& rlim) const;
|
|
||||||
|
|
||||||
// Kills the main traced PID with PTRACE_KILL.
|
// Kills the main traced PID with PTRACE_KILL.
|
||||||
void KillSandboxee();
|
void KillSandboxee();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user