我想知道UNIX信号的安全性。
SIGKILL
会杀死进程。那么,当非root用户的进程向root用户的进程发送信号时会发生什么呢?该过程是否仍执行信号处理程序?
我遵循公认的答案(古卢姆语言),然后输入man capabilites
,我发现了很多有关Linux内核的知识。来自man capabilities
:
NAME
capabilities - overview of Linux capabilities
DESCRIPTION
For the purpose of performing permission checks, traditional UNIX
implementations distinguish two categories of processes: privileged
processes (whose effective user ID is 0, referred to as superuser or
root), and unprivileged processes (whose effective UID is nonzero).
Privileged processes bypass all kernel permission checks, while
unprivileged processes are subject to full permission checking based
on the process's credentials (usually: effective UID, effective GID,
and supplementary group list).
Starting with kernel 2.2, Linux divides the privileges traditionally
associated with superuser into distinct units, known as capabilities,
which can be independently enabled and disabled. Capabilities are a
per-thread attribute.
@chepner除了
—
jlliagre
SIGKILL
和 SIGSTOP
...
@chepner接收过程必须主动决定要处理信号。如果接收过程还没有这样做,那么默认情况下,许多信号将以完全相同的方式杀死该过程
—
卡巴斯德(Kasperd)'16
SIGKILL
。最初SIGINT
,SIGKILL
和SIGTERM
具有完全相同的效果,唯一的区别是接收过程可以为其中一些更改此默认设置。
SIGKILL
,它是一种特殊情况,并且完全由内核管理,信号只是一个请求。接收过程可以对他们做任何他们想做的事情。