* API for changing UIDs of other processes
@ 2008-05-02 12:16 Enrico Weigelt
2008-05-02 14:07 ` Jan Engelhardt
0 siblings, 1 reply; 3+ messages in thread
From: Enrico Weigelt @ 2008-05-02 12:16 UTC (permalink / raw)
To: linux kernel list
Hi folks,
I'd like to build some authentication daemon which alters the
privileges of another process (like factotum does on plan9).
But I couldn't find any interface for that (setuid() and friends
only operate on the current process). So I'm now going to create
my own interface.
As a little learning example I just added a few files to the
per-pid dirs: uid, euid, suid, fsuid. This was trivial :)
Now I'd like to add an write capability to these files:
simply writing another number changes the (|s|fs)uid.
But this doesnt seem that trivial. Perhaps someone could give
me some advice ?
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: API for changing UIDs of other processes
2008-05-02 12:16 API for changing UIDs of other processes Enrico Weigelt
@ 2008-05-02 14:07 ` Jan Engelhardt
2008-05-05 13:20 ` Enrico Weigelt
0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2008-05-02 14:07 UTC (permalink / raw)
To: Enrico Weigelt; +Cc: linux kernel list
On Friday 2008-05-02 14:16, Enrico Weigelt wrote:
>Hi folks,
>
>
>I'd like to build some authentication daemon which alters the
>privileges of another process (like factotum does on plan9).
>But I couldn't find any interface for that (setuid() and friends
>only operate on the current process). So I'm now going to create
>my own interface.
>
>As a little learning example I just added a few files to the
>per-pid dirs: uid, euid, suid, fsuid. This was trivial :)
>
>Now I'd like to add an write capability to these files:
>simply writing another number changes the (|s|fs)uid.
>
>But this doesnt seem that trivial. Perhaps someone could give
>me some advice ?
Not really hard, is it? Just look at something like oom_adj
static ssize_t myprocpid_euid_write(struct file *file,
const char __user *inbuf, size_t size)
{
struct task_struct *task;
char buf[sizeof("4294967296")];
unsigned int amount = min(size, sizeof(buf) - 1);
if (copy_from_user(buf, inbuf, amount) != 0)
return -EFAULT;
buf[amount] = '\0';
task = get_proc_task(file->f_path.dentry->d_inode);
if (task == NULL)
return -ESRCH;
/* do error checking */
task->euid = simple_strtoul(buf, NULL, 0);
put_task_struct(task);
return size;
}
So far the theory..
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: API for changing UIDs of other processes
2008-05-02 14:07 ` Jan Engelhardt
@ 2008-05-05 13:20 ` Enrico Weigelt
0 siblings, 0 replies; 3+ messages in thread
From: Enrico Weigelt @ 2008-05-05 13:20 UTC (permalink / raw)
To: linux kernel list
* Jan Engelhardt <jengelh@medozas.de> wrote:
> >Now I'd like to add an write capability to these files:
> >simply writing another number changes the (|s|fs)uid.
> >
> >But this doesnt seem that trivial. Perhaps someone could give
> >me some advice ?
>
> Not really hard, is it? Just look at something like oom_adj
Well, it's not that trivial than just an ro string file.
But not that hard as I first suspected :)
I've introduced a few new helpers for rw integers, which works
quite similar to the ro string stuff, but with anouther handler type.
I'll post a patch in the new testers list.
The next step is actually changing the uid. Can I just write
new values to the uid field(s) in the task struct or is there
something tricky about that ?
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-05 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 12:16 API for changing UIDs of other processes Enrico Weigelt
2008-05-02 14:07 ` Jan Engelhardt
2008-05-05 13:20 ` Enrico Weigelt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox