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

From: Davidlohr Bueso
Date: Fri Feb 26 2016 - 17:16:20 EST


On Fri, 26 Feb 2016, Manfred Spraul wrote:

This is a user-visible change, adding mtk.

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:

This bug report really lacks any kind of motivation for this patch, not
posix-friendly is pretty bogus. Albeit we are doing some false publicity.


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 :-(

Code-wise yeah, but we have such things in our docs (semctl.2):

GETPID Return the value of sempid for the semnum-th semaphore of the set (i.e., the PID of the
process that executed the last semop(2) call for the semnum-th semaphore of the set). The
calling process must have read permission on the semaphore set.

Furthermore, semop.2 is very explicit about sempid. That said, I am also weary of this
change because we've been setting semval for semctl for so long.
stuff).

Thanks,
Davidlohr