On 9/3/12 1:20 AM, Garrett Cooper wrote: > On Sun, Sep 2, 2012 at 2:16 PM, Garrett Cooper <yaneg...@gmail.com> wrote: >> On Sun, Sep 2, 2012 at 10:39 AM, Andrey Zonov <z...@freebsd.org> wrote: >>> Author: zont >>> Date: Sun Sep 2 17:39:02 2012 >>> New Revision: 240026 >>> URL: http://svn.freebsd.org/changeset/base/240026 >>> >>> Log: >>> - Make kern.maxtsiz, kern.dfldsiz, kern.maxdsiz, kern.dflssiz, >>> kern.maxssiz >>> and kern.sgrowsiz sysctls writable. >>> >>> Approved by: kib (mentor) >>> >>> Modified: >>> head/sys/kern/subr_param.c > > ... > >> >> Please add some basic sanity checking to init_param1 -- there's >> absolutely nothing preventing me from passing in values <= 0 or other > > Correction: values == 0 with little effort (missed the part where it > was using TUNABLE_ULONG_FETCH). You could get negative values though > if you overflow the value passed in -- in part because the getenv* > functions in kern_environment.c don't check for/handle overflow > gracefully .. I had a patch out for this a while ago that never made > it in. > >> non-performant (non-multiple of PAGE_SIZE, whacky ratios, etc) values. >> Thanks, >> -Garrett
I thought of sanity checking here, but there weren't for tunables and I did't want to add any "magic numbers" in this code. I don't think that we should check for multiple of PAGE_SIZE, may be only for sgrowsiz and even not checking, just rounding up. If you have those "magic numbers" I would love to add it. -- Andrey Zonov
signature.asc
Description: OpenPGP digital signature