Re: context switch vs. signal delivery [was: Re: Accelerating user mode

Udo A. Steinberg
2002-08-06T08:09:23Z

On Mon, 05 Aug 2002 21:55:05 -0500
>
> > If you have one process per task and a kernel process, the kernel
> > process cannot change socket ownership over to the next task's
> > process, because it's not allowed to.
>
> Why not? I see nothing at all in the implementation of F_SETOWN that requires
> that it be called by the current owner:
>
> case F_SETOWN:
> lock_kernel();
> filp->f_owner.pid = arg;
> filp->f_owner.uid = current->uid;
> filp->f_owner.euid = current->euid;
> ...

Ok, I was looking at sockets and not tty's and that has the following in
net/core/sock.c
case F_SETOWN:
/*
* This is a little restrictive, but it's the only
* way to make sure that you can't send a sigurg to
* another process.
*/
if (current->pgrp != -arg &&
current->pid != arg &&
!capable(CAP_KILL)) return(-EPERM);
sk->proc = arg;
return(0);

So it wouldn't work with socketpairs, but with tty's it should.

-Udo.