RLIMIT_MEMLOCK accounting of shmctl() SHM_LOCK is broken
A message that is not in the archive (sent off-list or not yet received): [email protected]
Review
Quoted 8 lines · Linux Kernel Mailing List
ChangeSet 1.2251, 2004/11/29 13:38:43-08:00, [email protected]
(quoted diff) +2
-2- spin_lock(&shmlock_user_lock); - locked = size >> PAGE_SHIFT; + locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; lock_limit >>= PAGE_SHIFT; + spin_lock(&shmlock_user_lock);
after this change... isn't the use to the current->signal->rlim[RLIMIT_MEMLOCK] entirely unlocked and thus racey ?
Quoted 4 lines · Arjan van de Ven
Quoted 2 lines · Linux Kernel Mailing List
ChangeSet 1.2251, 2004/11/29 13:38:43-08:00, [email protected]
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +2
-2- spin_lock(&shmlock_user_lock); - locked = size >> PAGE_SHIFT; + locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; lock_limit >>= PAGE_SHIFT; + spin_lock(&shmlock_user_lock);after this change... isn't the use to the current->signal->rlim[RLIMIT_MEMLOCK] entirely unlocked and thus racey ?
It always was - we don't modify rlimits under shmlock_user_lock.
If some other thread goes and changes RLIMIT_MEMLOCK under your feet then this test will use either the old value or the new one, which is to be expected.
(I get the feeling that I'm missing your point here)
Quoted 1 line · Andrew Morton
(I get the feeling that I'm missing your point here)
it's more that I'm missing my own point due to lack of caffeine at 9am