Date: Fri, 28 Jan 2011 15:29:36 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218019 - head/sys/kern Message-ID: <201101281529.p0SFTair084884@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Fri Jan 28 15:29:35 2011 New Revision: 218019 URL: http://svn.freebsd.org/changeset/base/218019 Log: Do not trip a KASSERT if /dev/null cannot be opened for a setuid program. The fdcheckstd() function makes sure fds 0, 1 and 2 are open by opening /dev/null. If this fails (e.g. missing devfs or wrong permissions), fdcheckstd() will return failure and the process will exit as if it received SIGABRT. The KASSERT is only to check that kern_open() returns the expected fd, given that it succeeded. Tripping the KASSERT is most likely if fd 0 is open but fd 1 or 2 are not. MFC after: 2 weeks Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jan 28 15:25:46 2011 (r218018) +++ head/sys/kern/kern_descrip.c Fri Jan 28 15:29:35 2011 (r218019) @@ -2024,10 +2024,10 @@ fdcheckstd(struct thread *td) error = kern_open(td, "/dev/null", UIO_SYSSPACE, O_RDWR, 0); devnull = td->td_retval[0]; - KASSERT(devnull == i, ("oof, we didn't get our fd")); td->td_retval[0] = save; if (error) break; + KASSERT(devnull == i, ("oof, we didn't get our fd")); } else { error = do_dup(td, DUP_FIXED, devnull, i, &retval); if (error != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101281529.p0SFTair084884>