On Thu, 30 Nov 2017, Philippe Mikoyan wrote:The patch appears to be good. I'll try to perform some tests, but I'm not sure when I will be able to.
As described in the title, this patch fixes <ipc>id_ds inconsistency
when <ipc>ctl_stat runs concurrently with some ds-changing function,
e.g. shmat, msgsnd or whatever.
For instance, if shmctl(IPC_STAT) is running concurrently with shmat,
following data structure can be returned:
{... shm_lpid = 0, shm_nattch = 1, ...}
Hmm yeah that's pretty fishy, also shm_atime = 0, no?I don't like rwlock, they add complexity without reducing the cache line pressure.
So I think this patch is fine as we can obviously race at a user level.
This is another justification for converting the ipc lock to rwlock;
performance wise they are the pretty much the same (being queued)...
but that's irrelevant to this patch. I like that you manage to do
security and such checks still only under rcu, like all ipc calls
work; *_stat() is no longer special.