Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 1995 15:29:43 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        peter@jhome.dialix.com, phk@critter.tfs.com
Cc:        CVS-commiters@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, phk@freefall.freebsd.org
Subject:   Re: cvs commit: src/sys/kern kern_sysctl.c
Message-ID:  <199511150429.PAA17458@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
I noticed a whole class of (old) sysctl bugs.  Consider e.g.,
setdomainname().  The string is copied in directly over the
old string.  If the copyin() faults, the old string is trashed.
sysctl() returns EFAULT but the caller has no way of knowing
if the old value is trashed.

To avoid this, all copyin()s should go to temporary storage.
The bad malloc() method worked better here :-).

>The interface is badly designed, how about this one:

>	get some variable
>		old buffer too small,
>		new buffer correct.

>it should return ENOMEM because it cannot copyout, but should the
>new value be installed ?

mpp and I fixed sysctl_string() to copyout as much as fits.
4.4lite2 is still broken here (it returns immediately).  We decided
to install the new value in the ENOMEM case.  This is probably
wrong.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511150429.PAA17458>