Re: [PATCH] Don't set sempid in semctl syscall.

From: Manfred Spraul
Date: Fri Feb 26 2016 - 15:19:40 EST


Hi,

On 02/26/2016 01:21 PM, PrasannaKumar Muralidharan wrote:
From: PrasannaKumar Muralidharan <prasannatsmkumar@xxxxxxxxx>

As described in bug #112271 (bugzilla.kernel.org/show_bug.cgi?id=112271)
don't set sempid in semctl syscall. Set sempid only when semop is called.
I disagree with the bug report:

sempid is (and always was on Linux) the pid of the last task that modified the semaphore:
It is updated for semop, SETVAL and undo adjustment on process exit.
And - that is a bug: sempid is not updated for SETALL :-(

With regard to setting sempid on SETVAL,

- Opensolaris sets sempid on SETVAL and SETALL
http://minnie.tuhs.org/cgi-bin/utree.pl?file=OpenSolaris_b135/uts/common/syscall/sem.c
- Darwin sets sempid on SETVAL and SETALL
http://fxr.watson.org/fxr/source//bsd/kern/sysv_sem.c?v=xnu-1456.1.26

Note:
For sem_otime and sem_ctime, there are also subtile differences between the sysv implementations.
What should we do there?

Here is my last review (already a few years old - some links may be stale, perhaps a few more implementations are now available)
http://calculix-rpm.sourceforge.net/sysvsem.html

--
Manfred