angel(2) system call, the quest for immortality, aka kill(2) with SIGSTOP/SIGKILL will *not* work
Warm White Wolf
warmwhitewolf at gmail.com
Tue Aug 28 08:58:29 UTC 2018
Greetings !
I have developed a new system call, be it named angel(2),
on Linux operating system (this is what I know), which makes
a program invulnerable to kill(2) calls, including SIGKILL and
SIGSTOP.
The uses may involve fork() + angel(), daemon() + angel(),
setsid() + angel(), exec*() + angel().
Use the intellectual property I give you, as a gift to the BSD
operating system, using 4- 3- 2- BSD licence. That's it, name
me in the sources.
Thank you, FreeBSD !
You are a great Unix operating system !
-------------- next part --------------
06. Syscalls in the linux kernel, and in the glibc library
We write angel() system call, on a 4.14 kernel. We want immortality
for our process (SIGKILL and SIGSTOP ignored), and if we are a daemon()
we can obtain system-life-time processes/daemons. Note that the angel()
syscall can be user also by user-conscious processes, which return 0;
How I've done it :
1. Changed struct task_struct, found in/usr/src/linux/include/sched.h
by adding a int unix_deadly_signals; field. We want this to be 0, and
to be 1, only when called by sys_angel() == angel().
In include/sched.h
2. For this, we must modify do_fork() / _do_fork(), so when we obtain
p = copy_process(), right after it p->unix_deadly_signals = 0;
In kernel/fork.c
3. Remember for what we have created sys_angel() : if someone sends,
using kill(2) system call, SIGSTOP or SIGKILL signal to our process,
he must fail. Look in kernel/signal.c, there is a function
do_sigaction(), and we modify :
if (info == SEND_SIG_FORCED && t->unix_deadly_signals == 1)
return (ret = 0);
4. In kernel/sys.c, or another file, we SYSCALL_DEFINE0(angel) {
current -> unix_deadly_signals = 1;
return 0;
}
5. In syscall_64.tbl, the 333-th system call for 332-system calls
original 4.14.11 Linux kernel, is :
333 common angel sys_angel
6. In include/linux/syscalls.h, add to the end of the file, right
before #endif,
asmlinkage long sys_angel(void);
7. In userspace, the following test program, against SIGKILL == 9
and SIGSTOP == 19 (and other signals I guess, but why I do not know
why):
#include <unistd.h>
#include <sys/syscall.h>
int main()
{
syscall(333);
sleep(66);
return 0;
}
Compile it : $ gcc angel.c -o angel
Run it : $ ./angel &
Test it : $ killall angel
It exists : $ jobs
[1]+ Running ./angel &
8. Conclusion : IT WORKS.
9. What remains to do : to write a wrapper in glibc, and compile the
glibc, by the rules of glibc, as we
10. Compiled our Linux kernel.
whitewolf, 2017/2018
other sources :
http://alexandria-kewl-things.blogspot.ro/2017/
08/operating-systems-unix-myth-bypassed.html
More information about the freebsd-hackers
mailing list