Re: [PATCH] RLIMIT_MEMLOCK accounting of shmctl() SHM_LOCK isbroken

From: Andrew Morton
Date: Tue Nov 30 2004 - 02:46:38 EST


Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
>
> On Mon, 2004-11-29 at 21:38 +0000, Linux Kernel Mailing List wrote:
> > ChangeSet 1.2251, 2004/11/29 13:38:43-08:00, mtk-lkml@xxxxxxx
> >
> > - 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)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/