Permissions to send a signal

Nick Randell (nick@metrica.co.uk)
Fri, 15 Mar 1996 08:02:00 +0000


Hi

I have ported a database system to linux which is used on 9 other
unixes and I think I have found a problem with the send_sig function.

The database system is based on a client server architecture, with the
server checking that the client is still there. The server does this by
sending a signal 0 to the client. The server process has to run under a
different euid to the client and this is where send_sig seems to be
different.

For example.

The client (parent) process: UID = 252, EUID = 252
The server (child) process: UID = 252, EUID = 300

Every 10 seconds the server sends signal 0 to the parent just to check
that it is still alive. On AIX 3.2.5, IRIX 5.2, HPUX 9.04, DEC OSF1,
HP-UX 10.01, SunOs 5.3 (Solaris 2.3) the child can send signal 0 to the
parent with no errors. On Linux however the kill system call returns
EPERM if the parent is there and ESRCH if the parent is not there.

The linux behaviour as far as checking the [E]UID seems to be:

IF child->euid != parent->euid AND child->euid != parent->uid
return EPERM

The kill(2) manual page on HP-UX 10 states that:

> The real or effective user ID of the sending process must match the
> real or saved user ID of the receiving process unless the effective
> user ID of the sending process is a user who has appropriate
> privileges.

whereas linux does

> The effective user ID of the sending process must match the
> real or effective user ID of the receiving process ...

My question is, which is right, Linux or the others?

Thanks

Nick