推广 热搜: 收购ACF  石英加热管,  800  T型槽试验平台  求购ACF  深圳回收ACF  回收ACF  T型槽装配平台  求购日立ACF  T型槽地梁 

prctl 、PRcTLxJA4vxuMad0 o87mzEkvN

   日期:2023-04-10     浏览:30    评论:0    
核心提示:linux修改一下进程在linux中prctl可以满足这个要求,下满是man手册: PR_SET_NAME (since Linux 2.6.9) Set the

linux修改一下进程

在linux中prctl可以满足这个要求,下满是man手册:

PR_SET_NAME (since Linux 2.6.9)

Set the process name for the calling process, using the value in

the location pointed to by (char *) arg2. The name can be up to

16 bytes long, and should be null terminated if it contains

fewer bytes.

但是prctl修改的进程名,只能是16个字节(包括'')。下面是修改的代码(changetitle.c):

#include stdio.h

#include sys/prctl.h

int main(int argc, char *argv[], char *envp[])

{

char *new_name = "abcdefghijklmnopqrstuvwxyz";

getchar();

prctl(PR_SET_NAME, new_name);

getchar();

return 0;

}

当新名称长度大于16时就会截断,上面的新名字截断后是abcdefghijklmno。这对于我们来说是有缺陷的。而且通过ps -***x 查看,进程名称并没有改变,改变的只是/prco/$(PID)/stat和

/prco/$(PID)/status的值,而/prco/$(PID)/cmdline并没有改变。这种方式使用起来也是不方便的。

下面介绍另一种方式,可以与上面的方式互补。

首先看一下main函数的原型:int main(int argc, char *argv[]);

argv[0]存放的是终端执行的程序名称也就是进程名。argv[1...argc-1]存放的是命令行参数。

linux中main()还有一个隐藏参数就是环境变量信息,存放了运行时所需要的环境变量。

我们可以通过以下来访问这个变量

extern char **environ;

argv与environ是连续存放在栈区的。下面代码可以查看参数信息:

#include stdio.h

#include string.h

extern char **environ;

int main(int argc , char *argv[])

{

int i;

printf("argc:%dn" , argc);

for (i = 0; i argc; ++i)

{

printf("argv[%d](0x%x):%sn" , i , (unsigned int)argv[i], argv[i]);

}

printf("evriron=0x%xn" , (unsigned int)environ[0]);

return 0;

}

通过上面可以看出,我们只需要修改argv[0]所指向的内存空间的内容,就可以修改进程名。但是如果新名称比argv[0]的长度小,我们可以直接修改,并把多余的部分请0,如果新名称

比argv[0]长我们需要两步:

1、申请新内存保存环境变量信息和argv[1...argc-1]参数信息

2、修改argv[0],将新名称往后到environ的最后一项清0

以下是参考代码:

#include unistd.h

#include stdio.h

#include stdarg.h

#include string.h

#include stdlib.h

#include sys/prctl.h

# define MAXLINE 2048

extern char **environ;

static char **g_main_Argv = NULL;

static char *g_main_LastArgv = NULL;

void setproctitle_init(int argc, char **argv, char **envp)

{

int i;

for (i = 0; envp[i] != NULL; i++) // calc envp num

continue;

environ = (char **) malloc(sizeof (char *) * (i + 1)); // malloc envp pointer

for (i = 0; envp[i] != NULL; i++)

{

environ[i] = malloc(sizeof(char) * strlen(envp[i]));

strcpy(environ[i], envp[i]);

}

environ[i] = NULL;

g_main_Argv = argv;

if (i 0)

g_main_LastArgv = envp[i - 1] + strlen(envp[i - 1]);

else

g_main_LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);

}

void setproctitle(const char *fmt, ...)

{

char *p;

int i;

char buf[MAXLINE];

extern char **g_main_Argv;

linux内核提供的能够访问用户指针的api有哪些

4. linux 用户API (内核API,请参考Linux内核API完全手)

一、进程控制:

fork 创建一个新进程

clone 按指定条件创建子进程

execve 运行可执行文件

exit 中止进程

_exit 立即中止当前进程

getdtablesize 进程所能打开的***文件数

getpgid 获取指定进程组标识号

setpgid 设置指定进程组标志号

getpgrp 获取当前进程组标识号

setpgrp 设置当前进程组标志号

getpid 获取进程标识号

getppid 获取父进程标识号

getpriority 获取调度优先级

setpriority 设置调度优先级

modify_ldt 读写进程的本地描述表

nanosleep 使进程睡眠指定的时间

nice 改变分时进程的优先级

p***se 挂起进程,等待信号

personality 设置进程运行域

prctl 对进程进行特定操作

ptrace 进程跟踪

sched_get_priority_max 取得静态优先级的上限

sched_get_priority_min 取得静态优先级的下限

sched_getparam 取得进程的调度参数

sched_getscheduler 取得指定进程的调度策略

sched_rr_get_interval 取得按RR算法调度的实时进程的时间片长度

sched_setparam 设置进程的调度参数

sched_setscheduler 设置指定进程的调度策略和参数

sched_yield 进程主动让出处理器,并将自己等候调度队列队尾

vfork 创建一个子进程,以供执行新程序,常与execve等同时使用

wait 等待子进程终止

wait3 参见wait

waitpid 等待指定子进程终止

wait4 参见waitpid

capget 获取进程权限

capset 设置进程权限

getsid 获取会晤标识号

setsid 设置会晤标识号

如何修改 Linux 中的进程名

在编写网络服务器程序时,为了响应客户端的请求,我们经常需要新建进程来处理业务流程;而且又是为了关闭某个非法请求或者关闭长连接的客户端,这时就需要杀死进程 killall proc_name。 但是在新建进程时,子进程名与父进程名相同。因此需要由进程名及参数来区分客户端连接。

在linux中prctl可以满足这个要求,下满是man手册:

PR_SET_NAME (since Linux 2.6.9)

Set the process name for the calling process, using the value in

the location pointed to by (char *) arg2. The name can be up to

16 bytes long, and should be null terminated if it contains

fewer bytes.

但是prctl修改的进程名,只能是16个字节(包括'')。下面是修改的代码(changetitle.c):

#include stdio.h

#include sys/prctl.h

int main(int argc, char *argv[], char *envp[])

{

char *new_name = "abcdefghijklmnopqrstuvwxyz";

getchar();

prctl(PR_SET_NAME, new_name);

getchar();

return 0;

}

当新名称长度大于16时就会截断,上面的新名字截断后是abcdefghijklmno。这对于我们来说是有缺陷的。而且通过ps -***x 查看,进程名称并没有改变,改变的只是/prco/$(PID)/stat和

/prco/$(PID)/status的值,而/prco/$(PID)/cmdline并没有改变。这种方式使用起来也是不方便的。

下面介绍另一种方式,可以与上面的方式互补。

首先看一下main函数的原型:int main(int argc, char *argv[]);

argv[0]存放的是终端执行的程序名称也就是进程名。argv[1...argc-1]存放的是命令行参数。

linux中main()还有一个隐藏参数就是环境变量信息,存放了运行时所需要的环境变量。

我们可以通过以下来访问这个变量

extern char **environ;

argv与environ是连续存放在栈区的。下面代码可以查看参数信息:

#include stdio.h

#include string.h

extern char **environ;

int main(int argc , char *argv[])

{

int i;

printf("argc:%dn" , argc);

for (i = 0; i argc; ++i)

{

printf("argv[%d](0x%x):%sn" , i , (unsigned int)argv[i], argv[i]);

}

printf("evriron=0x%xn" , (unsigned int)environ[0]);

return 0;

}

通过上面可以看出,我们只需要修改argv[0]所指向的内存空间的内容,就可以修改进程名。但是如果新名称比argv[0]的长度小,我们可以直接修改,并把多余的部分请0,如果新名称

比argv[0]长我们需要两步:

1、申请新内存保存环境变量信息和argv[1...argc-1]参数信息

2、修改argv[0],将新名称往后到environ的最后一项清0

以下是参考代码:

#include unistd.h

#include stdio.h

#include stdarg.h

#include string.h

#include stdlib.h

#include sys/prctl.h

# define MAXLINE 2048

extern char **environ;

static char **g_main_Argv = NULL;

static char *g_main_LastArgv = NULL;

void setproctitle_init(int argc, char **argv, char **envp)

{

int i;

for (i = 0; envp[i] != NULL; i++) // calc envp num

continue;

environ = (char **) malloc(sizeof (char *) * (i + 1)); // malloc envp pointer

for (i = 0; envp[i] != NULL; i++)

{

environ[i] = malloc(sizeof(char) * strlen(envp[i]));

strcpy(environ[i], envp[i]);

}

environ[i] = NULL;

g_main_Argv = argv;

if (i 0)

g_main_LastArgv = envp[i - 1] + strlen(envp[i - 1]);

else

g_main_LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);

}

void setproctitle(const char *fmt, ...)

{

char *p;

int i;

char buf[MAXLINE];

extern char **g_main_Argv;

extern char *g_main_LastArgv;

va_list ap;

p = buf;

va_start(ap, fmt);

vsprintf(p, fmt, ap);

va_end(ap);

i = strlen(buf);

if (i g_main_LastArgv - g_main_Argv[0] - 2)

{

i = g_main_LastArgv - g_main_Argv[0] - 2;

buf[i] = '';

}

(void) strcpy(g_main_Argv[0], buf);

p = g_main_Argv[0][i];

while (p g_main_LastArgv)

*p++ = '';

g_main_Argv[1] = NULL;

prctl(PR_SET_NAME,buf);

}

int main(int argc, char *argv[])

{

char argv_buf[MAXLINE] = {0}; // save argv paramters

for(int i = 1; i argc; i++)

{

strcat(argv_buf, argv[i]);

strcat(argv_buf, " ");

}

setproctitle_init(argc, argv, environ);

setproctitle("%s@%s %s", "new_name", "ip", argv_buf);

for (int i = 0; environ[i] != NULL; i++)

free(environ[i]);

getchar();

return 0;

}

上面的代码使用了prctl和修改argv[0]两种修改方法的结合,通过ps -a 、 ps -ef 、ps -***x、 top 等等命令都只能查询到新进程名,/proc/$PID/ 下的文件也显示了新进程名的信息。

应用场景:

1、标识父子进程名称,防止被误杀

2、构造假的进程名及参数,引导非法进入人员到蜜罐系统,取证

系统调用的系统调用和普通调用的区别

系统调用本质上是一种过程调用,但它是一种特殊的过程调用,与一般用户程序中的过程调用有明显的区别 。 fork 创建一个新进程

clone 按指定条件创建子进程

execve 运行可执行文件

exit 中止进程

_exit 立即中止当前进程

getdtablesize 进程所能打开的***文件数

getpgid 获取指定进程组标识号

setpgid 设置指定进程组标志号

getpgrp 获取当前进程组标识号

setpgrp 设置当前进程组标志号

getpid 获取进程标识号

getppid 获取父进程标识号

getpriority 获取调度优先级

setpriority 设置调度优先级

modify_ldt 读写进程的本地描述表

nanosleep 使进程睡眠指定的时间

nice 改变分时进程的优先级

p***se 挂起进程,等待信号

personality 设置进程运行域

prctl 对进程进行特定操作

ptrace 进程跟踪

sched_get_priority_max 取得静态优先级的上限

sched_get_priority_min 取得静态优先级的下限

sched_getparam 取得进程的调度参数

sched_getscheduler 取得指定进程的调度策略

sched_rr_get_interval 取得按RR算法调度的实时进程的时间片长度

sched_setparam 设置进程的调度参数

sched_setscheduler 设置指定进程的调度策略和参数

sched_yield 进程主动让出处理器,并将自己等候调度队列队尾

vfork 创建一个子进程,以供执行新程序,常与execve等同时使用

wait 等待子进程终止

wait3 参见wait

waitpid 等待指定子进程终止

wait4 参见waitpid

capget 获取进程权限

capset 设置进程权限

getsid 获取会晤标识号

setsid 设置会晤标识号 fcntl 文件控制

open 打开文件

creat 创建新文件

close 关闭文件描述字

read 读文件

write 写文件

readv 从文件读入数据到缓冲数组中

writev 将缓冲数组里的数据写入文件

pread 对文件随机读

pwrite 对文件随机写

lseek 移动文件指针

_llseek 在64位地址空间里移动文件指针

dup 复制已打开的文件描述字

dup2 按指定条件复制文件描述字

flock 文件加/解锁

poll I/O多路转换

truncate 截断文件

ftruncate 参见truncate

umask 设置文件权限掩码

fsync 把文件在内存中的部分写回磁盘 access 确定文件的可存取性

chdir 改变当前工作目录

fchdir 参见chdir

chmod 改变文件方式

fchmod 参见chmod

chown 改变文件的属主或用户组

fchown 参见chown

lchown 参见chown

chroot 改变根目录

stat 取文件状态信息

lstat 参见stat

fstat 参见stat

statfs 取文件系统信息

fstatfs 参见statfs

readdir 读取目录项

getdents 读取目录项

mkdir 创建目录

mknod 创建索引节点

rmdir 删除目录

rename 文件改名

link 创建链接

symlink 创建符号链接

unlink 删除链接

readlink 读符号链接的值

mount 安装文件系统

umount 卸下文件系统

ustat 取文件系统信息

utime 改变文件的访问修改时间

utimes 参见utime

quotactl 控制磁盘配额 ioctl I/O总控制函数

_sysctl 读/写系统参数

acct 启用或***止进程记账

getrlimit 获取系统资源上限

setrlimit 设置系统资源上限

getrusage 获取系统资源使用情况

uselib 选择要使用的二进制函数库

ioperm 设置端口I/O权限

iopl 改变进程I/O权限级别

outb 低级端口操作

reboot 重新启动

swapon 打开交换文件和设备

swapoff 关闭交换文件和设备

bdflush 控制bdflush守护进程

sysfs 取核心支持的文件系统类型

sysinfo 取得系统信息

adjtimex 调整系统时钟

alarm 设置进程的闹钟

getitimer 获取计时器值

setitimer 设置计时器值

gettimeofd*** 取时间和时区

settimeofd*** 设置时间和时区

stime 设置系统日期和时间

time 取得系统时间

times 取进程运行时间

uname 获取当前UNIX系统的名称、版本和主机等信息

vhangup 挂起当前终端

nfsservctl 对NFS守护进程进行控制

vm86 进入模拟8086模式

create_module 创建可装载的模块项

delete_module 删除可装载的模块项

init_module 初始化模块

query_module 查询模块信息

*get_kernel_syms 取得核心符号,已被query_module代替 brk 改变数据段空间的分配

***rk 参见brk

mlock 内存页面加锁

munlock 内存页面解锁

mlockall 调用进程所有内存页面加锁

munlockall 调用进程所有内存页面解锁

mmap 映射虚拟内存页

munmap 去除内存页映射

mremap 重新映射虚拟内存地址

msync 将映射内存中的数据写回磁盘

mprotect 设置内存映像保护

getpagesize 获取页面大小

sync 将内存缓冲区数据写回硬盘

cacheflush 将指定缓冲区中的内容写回磁盘 getdomainname 取域名

setdomainname 设置域名

gethostid 获取主机标识号

sethostid 设置主机标识号

gethostname 获取本主机名称

sethostname 设置主机名称 socketcall socket系统调用

socket 建立socket

bind 绑定socket到端口

connect 连接远程主机

accept 响应socket连接请求

send 通过socket发送信息

sendto 发送UDP信息

sendmsg 参见send

recv 通过socket接收信息

recvfrom 接收UDP信息

recvmsg 参见recv

listen 监听socket端口

select 对多路同步I/O进行轮询

shutdown 关闭socket上的连接

getsockname 取得本地socket名字

getpeername 获取通信对方的socket名字

getsockopt 取端口设置

setsockopt 设置端口参数

sendfile 在文件或端口间传输数据

socketpair 创建一对已联接的无名socket getuid 获取用户标识号

setuid 设置用户标志号

getgid 获取组标识号

setgid 设置组标志号

getegid 获取有效组标识号

setegid 设置有效组标识号

geteuid 获取有效用户标识号

seteuid 设置有效用户标识号

setregid 分别设置真实和有效的的组标识号

setreuid 分别设置真实和有效的用户标识号

getresgid 分别获取真实的,有效的和保存过的组标识号

setresgid 分别设置真实的,有效的和保存过的组标识号

getresuid 分别获取真实的,有效的和保存过的用户标识号

setresuid 分别设置真实的,有效的和保存过的用户标识号

setfsgid 设置文件系统检查时使用的组标识号

setfsuid 设置文件系统检查时使用的用户标识号

getgroups 获取后补组标志清单

setgroups 设置后补组标志清单 sigprocmask 根据参数对信号集中的信号执行阻塞/解除阻塞等操作

sigpending 为指定的被阻塞信号设置队列

sigsuspend 挂起进程等待特定信号

signal 参见signal

kill 向进程或进程组发信号

*sigblock 向被阻塞信号掩码中添加信号,已被sigprocmask代替

*siggetmask 取得现有阻塞信号掩码,已被sigprocmask代替

*sigsetmask 用给定信号掩码替换现有阻塞信号掩码,已被sigprocmask代替

*sigmask 将给定的信号转化为掩码,已被sigprocmask代替

*sigp***se 作用同sigsuspend,已被sigsuspend代替

sigvec 为兼容BSD而设的信号处理函数,作用类似sigaction

ssetmask ANSI C的信号处理函数,作用类似sigaction msgctl 消息控制操作

msgget 获取消息队列

msgsnd 发消息

msgrcv 取消息 semctl 信号量控制

semget 获取一组信号量

semop 信号量操作 shmctl 控制共享内存

shmget 获取共享内存

shmat 连接共享内存

shmdt 拆卸共享内存

Linux 权能综述

为了执行权限检查,传统的 UNIX 实现区分两种类型的进程:特权进程(其有效用户 ID 为0,称为超级用户或 root),和非特权用户(其有效 UID 非0)。特权进程绕过所有的内核权限检查,而非特权进程受基于进程的认证信息(通常是:有效 UID,有效 GID,和补充组列表)的完整权限检查的支配。

自内核 2.2 版本开始,Linux 将传统上与超级用户关联的特权分为几个单元,称为 capabilities (权能),它们可以被独立的启用或***用。权能是每个线程的属性。

下面的列表展示了 Linux 上实现的权能,以及每种权能允许的操作或行为:

权能的完整实现需要:

在内核 2.6.24 之前,只有前两个要求能够满足;自内核 2.6.24 开始,所有三个要求都能满足。

每个线程具有三个包含零个或多个上面的权能的权能集合:

A child created via fork(2) inherits copies of its parent's capability sets. See below for a discussion of the treatment of capabilities during execve(2).

Using capset(2), a thread m*** manipulate its own capability sets (see below).

Since Linux 3.2, the file /proc/sys/kernel/cap_last_cap exposes the numerical value of the highest capability supported by the running kernel; this can be used to determine the highest bit that m*** be set in a capability set.

Since kernel 2.6.24, the kernel supports associating capability sets with an executable file using setcap(8). The file capability sets are stored in an extended attribute (see setxattr(2)) named security.capability. Writing to this extended attribute requires the CAP_SETFCAP capability. The file capability sets, in conjunction with the capability sets of the thread, determine the capabilities of a thread after an execve(2).

The three file capability sets are:

During an execve(2), the kernel calculates the new capabilities of the process using the following algorithm:

其中:

A privileged file is one that has capabilities or has the set-user-ID or set-group-ID bit set.

In order to provide an all-powerful root using capability sets, during an execve(2):

The upshot of the above rules, combined with the capabilities transformations described above, is that when a process execve(2)s a set-user-ID-root program, or when a process with an effective UID of 0 execve(2)s a program, it gains all capabilities in its permitted and effective capability sets, except those masked out by the capability bounding set. This provides semantics that are the same as those provided by traditional UNIX systems.

The capability bounding set is a security mechani*** that can be used to limit the capabilities that can be gained during an execve(2). The bounding set is used in the following w***s:

Note that the bounding set masks the file permitted capabilities, but not the inherited capabilities. If a thread maintains a capability in its inherited set that is not in its bounding set, then it can still gain that capability in its permitted set by executing a file that has the capability in its inherited set.

Depending on the kernel version, the capability bounding set is either a system-wide attribute, or a per-process attribute.

In kernels before 2.6.25, the capability bounding set is a system-wide attribute that affects all threads on the system. The bounding set is accessible via the file /proc/sys/kernel/cap-bound. (Confusingly, this bit mask parameter is expressed as a signed decimal number in /proc/sys/kernel/capbound.)

only the init process m*** set capabilities in the capability bounding set; other than that, the superuser (more precisely: programs with the CAP_SYS_MODULE capability) m*** only clear capabilities from this set.

On a standard system the capability bounding set alw***s masks out the CAP_SETPCAP capability. To remove this restriction (dangerous!), modify the definition of CAP_INIT_EFF_SET in include/linux/capability.h and rebuild the kernel.

The system-wide capability bounding set feature was added to Linux starting with kernel version 2.2.11.

From Linux 2.6.25, the capability bounding set is a per-thread attribute. (There is no longer a systemwide capability bounding set.)

The bounding set is inherited at fork(2) from the thread's parent, and is preserved across an execve(2).

A thread m*** remove capabilities from its capability bounding set using the prctl(2) PR_CAPBSET_DROp operation, provided it has the CAP_SETPCAP capability. once a capability has been dropped from the bounding set, it cannot be restored to that set. A thread can determine if a capability is in its bounding set using the prctl(2) PR_CAPBSET_READ operation.

Removing capabilities from the bounding set is supported only if file capabilities are compiled into the kernel. In kernels before Linux 2.6.33, file capabilities were an optional feature configurable via the CONFIG_SECURITY_FILE_CAPABILITIES option. Since Linux 2.6.33, the configuration option has been removed and file capabilities are alw***s part of the kernel. When file capabilities are compiled into the kernel, the init process (the ancestor of all processes) begins with a full bounding set. If file capabilities are not compiled into the kernel, then init begins with a full bounding set minus CAP_SETPCAP, bec***se this capability has a different meaning when there are no file capabilities.

Removing a capability from the bounding set does not remove it from the thread's inherited set. However it does prevent the capability from being added back into the thread's inherited set in the future.

To preserve the traditional semantics for transitions between 0 and nonzero user IDs, the kernel makes the following changes to a thread's capability sets on changes to the thread's real, effective, saved set, and filesystem user IDs (using setuid(2), setresuid(2), or similar):

If a thread that has a 0 value for one or more of its user IDs wants to prevent its permitted capability set being cleared when it resets all of its user IDs to nonzero values, it can do so using the prctl(2) PR_SET_KEEPCAPS operation or the SECBIT_KEEP_CAPS securebits flag described below.

A thread can retrieve and change its capability sets using the capget(2) and capset(2) system calls. However, the use of cap_get_proc(3) and cap_set_proc(3), both provided in the libcap package, is preferred for this purpose. The following rules govern changes to the thread capability sets:

Starting with kernel 2.6.26, and with a kernel in which file capabilities are enabled, Linux implements a set of per-thread securebits flags that can be used to disable special handling of capabilities for UID 0 (root). These flags are as follows:

Each of the above "base" flags has a companion "locked" flag. Setting any of the "locked" flags is irreversible, and has the effect of preventing further changes to the corresponding "base" flag. The locked flags are: SECBIT_KEEP_CAPS_LOCKED, SECBIT_NO_SETUID_FIXUP_LOCKED, SECBIT_NOROOT_LOCKED, and SECBIT_NO_CAP_AMBIENT_RAISE.

The securebits flags can be modified and retrieved using the prctl(2) PR_SET_SECUREBITS and PR_GET_SECUREBITS operations. The CAP_SETPCAP capability is required to modify the flags.

The securebits flags are inherited by child processes. During an execve(2), all of the flags are preserved, except SECBIT_KEEP_CAPS which is alw***s cleared.

An application can use the following call to lock itself, and all of its descendants, into an environment where the only w*** of gaining capabilities is by executing a program with associated file capabilities:

For a discussion of the interaction of capabilities and user namespaces, see user_namespaces(7).

No standards govern capabilities, but the Linux capability implementation is based on the withdrawn POSIX.1e draft standard; see ⟨ ⟩.

From kernel 2.5.27 to kernel 2.6.26, capabilities were an optional kernel component, and can be enabled/disabled via the CONFIG_SECURITY_CAPABILITIES kernel configuration option.

The /proc/PID/task/TID/status file can be used to view the capability sets of a thread. The /proc/PID/status file shows the capability sets of a process's main thread. Before Linux 3.8, nonexistent capabilities were shown as being enabled (1) in these sets. Since Linux 3.8, all nonexistent capabilities (above CAP_LAST_CAP) are shown as disabled (0).

The libcap package provides a suite of routines for setting and getting capabilities that is more comfortable and less likely to change than the interface provided by capset(2) and capget(2). This package also provides the setcap(8) and getcap(8) programs. It can be found at ⟨ ⟩.

Before kernel 2.6.24, and from kernel 2.6.24 to kernel 2.6.32 if file capabilities are not enabled, a thread with the CAP_SETPCAP capability can manipulate the capabilities of threads other than itself. However, this is only theoretically possible, since no thread ever has CAP_SETPCAP in either of these cases:

capsh(1), setpriv(1), prctl(2), setfsuid(2), cap_clear(3), cap_copy_ext(3), cap_from_text(3), cap_get_file(3), cap_get_proc(3), cap_init(3), capgetp(3), capsetp(3), libcap(3), credentials(7), user_namespaces(7), pthreads(7), getcap(8), setcap(8)

include/linux/capability.h in the Linux kernel source tree

This page is part of release 4.04 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at .

关于prctl和PRcTLxJA4vxuMad0 o87mzEkvN的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

原文链接:http://b.souke.org/news/show-30157.html,转载和复制请保留此链接。
以上就是关于prctl 、PRcTLxJA4vxuMad0 o87mzEkvN全部的内容,关注我们,带您了解更多相关内容。
 
标签: 进程 标识 文件
打赏
 
更多>同类资讯
0相关评论

推荐资讯
网站首页  |  VIP套餐介绍  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  SITEMAPS  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报