Re: disable-cap-mlock

From: Chris Wright
Date: Thu Apr 01 2004 - 21:50:27 EST


* Andrea Arcangeli (andrea@xxxxxxx) wrote:
> On Thu, Apr 01, 2004 at 06:21:27PM -0800, Chris Wright wrote:
> > Ah, yes I see what you are saying. This is the same issue with normal
> > pages and SHM_LOCK that I mentioned earlier, I believe. I don't see the
> > best solution, because once you detach w/out any destroy, there could be
> > nobody to assign the accounting to. Do you agree?
>
> yes, rlimit just can't account for shmget(SHM_HUGETLB) and
> shmctl(SHM_LOCK) either, because it can only account the stuff that you
> temporarily have in the address space.
>
> the exploit is simply to shmget tons of 2M hugepage segments, and to
> shmat/shmdt all of them, then you'll pin N times those 2M largepages,
> and they will not be accounted anywhere allowing anybody to pin as much
> memory as they want.

Yup. I had an earlier patch against 2.4 that created a max count for
pages lockable by unprivileged users. So the accounting was done
against a global pool, and mitigated the DoS damage to those trying to
share this pool. I think it was more of a hack, though.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
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/