mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Create a convencience function to set the name of a thread/process
PiperOrigin-RevId: 436661002 Change-Id: Ia66cef2f3eda829c65bc07e2ac43a0b2c878eb7b
This commit is contained in:
parent
df8a2f77eb
commit
ab9c4afb15
|
@ -21,6 +21,7 @@
|
|||
#include <linux/net.h> // For SYS_CONNECT
|
||||
#include <linux/random.h> // For GRND_NONBLOCK
|
||||
#include <sys/mman.h> // For mmap arguments
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <syscall.h>
|
||||
|
@ -646,6 +647,11 @@ PolicyBuilder& PolicyBuilder::AllowRename() {
|
|||
return *this;
|
||||
}
|
||||
|
||||
PolicyBuilder& PolicyBuilder::AllowPrctlSetName() {
|
||||
AddPolicyOnSyscall(__NR_prctl, {ARG_32(0), JEQ32(PR_SET_NAME, ALLOW)});
|
||||
return *this;
|
||||
}
|
||||
|
||||
PolicyBuilder& PolicyBuilder::AllowFutexOp(int op) {
|
||||
return AddPolicyOnSyscall(
|
||||
__NR_futex, {
|
||||
|
|
|
@ -379,6 +379,11 @@ class PolicyBuilder final {
|
|||
// - renameat2
|
||||
PolicyBuilder& AllowRename();
|
||||
|
||||
// Appends code to allow setting the name of a thread
|
||||
// Allows the following
|
||||
// - prctl(PR_SET_NAME, ...)
|
||||
PolicyBuilder& AllowPrctlSetName();
|
||||
|
||||
// Enables the syscalls necessary to start a statically linked binary
|
||||
//
|
||||
// NOTE: This will call BlockSyscallWithErrno(__NR_readlink, ENOENT). If you
|
||||
|
|
Loading…
Reference in New Issue
Block a user