sysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE
authormjg <mjg@FreeBSD.org>
Thu, 19 Oct 2017 01:38:31 +0000 (01:38 +0000)
committermjg <mjg@FreeBSD.org>
Thu, 19 Oct 2017 01:38:31 +0000 (01:38 +0000)
commit2b6199af16cde441fb9de45a418c339dfa798030
tree316b4b3325bbaf6f93f760a1200b76ecece74af8
parenta5e44043cac010d71682703ed40ec6a88062d3c5
sysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE

The previous limit of just one page is hit by ps.

The entire mechanism should be reworked, if not whacked. It seems the intent
is to reduce kernel dos-ability - some handlers wire the amount of memory
passed here. Handlers should probably stop wiring in the first place or in
the worst case indicate they are doing so so that the check is done only if
necessary. It should also probably be a counter, not a lock.

MFC after: 1 week
sys/kern/kern_sysctl.c