Skip to contentSkip to conversation

new setprocuid syscall

PATCH Bernd Jendrissek 1 participant 1 message Feb 23, 2001

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(Please CC me - I am not subscribed)

Quoted 2 lines · BERECZ Szabolcs

Here is a new syscall. With this you can change the owner of a running procces.

Stupid question: why? Not so stupid: why, giving examples? Does the target process expect to be re-owned? Remember that a process can easily remember its original uid, and become confused later after you stole it.

Quoted 1 line

+++ linux-2.4.1-setprocuid/kernel/sys.c Mon Feb 19 21:52:51 2001

[...]

Quoted 11 lines

+asmlinkage long sys_setprocuid(pid_t pid, uid_t uid) +{
+ struct task_struct *p;
+
+ if (current->euid)
+ return -EPERM;
+
+ p = find_task_by_pid(pid);
+ p->fsuid = p->euid = p->suid = p->uid = uid;
+ return 0;
+}

How about a *slow* (for everyone) setprocuid(2)? Is it still possible in current kernels to "lock out" all other processes even on SMP boxen? If so, make sure the target is not in a syscall (EAGAIN until it's out), then change the world. Or, ...

A gross hack: make a special case in do_signal that overloads some rarely-used signal. Send that signal with needed magic to the target. When the target wants to re-enter userland for whatever reason, it notices that this ain't a signal, but a backdoor to make it change its uid *itself* so the assumption

Quoted 2 lines · Alan Cox

There is an assumption in the kernel that only the task changes its own uid and other related data.

remains true. setprocuid(2) blocks until the signal is delivered. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6lppADaF1aCTutCYRAiKnAJ4jHUTN9XfsaVXlOnuhQy4JtS/slACcCr17 1g5KvyDY7LCFGFKG/BZIfC4=
=DUal
-----END PGP SIGNATURE-----