Date: Thu, 19 Mar 2020 16:49:32 +0000 (UTC) From: Gordon Tetlow <gordon@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r359140 - releng/12.1/sys/dev/ixl Message-ID: <202003191649.02JGnWjd024598@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gordon Date: Thu Mar 19 16:49:32 2020 New Revision: 359140 URL: https://svnweb.freebsd.org/changeset/base/359140 Log: Fix insufficient ixl(4) ioctl(2) privilege checking. Approved by: so Security: FreeBSD-SA-20:06.if_ixl_ioctl Security: CVE-2019-15877 Modified: releng/12.1/sys/dev/ixl/if_ixl.c releng/12.1/sys/dev/ixl/ixl.h Modified: releng/12.1/sys/dev/ixl/if_ixl.c ============================================================================== --- releng/12.1/sys/dev/ixl/if_ixl.c Thu Mar 19 16:48:29 2020 (r359139) +++ releng/12.1/sys/dev/ixl/if_ixl.c Thu Mar 19 16:49:32 2020 (r359140) @@ -1625,11 +1625,29 @@ ixl_if_priv_ioctl(if_ctx_t ctx, u_long command, caddr_ struct ifdrv *ifd = (struct ifdrv *)data; int error = 0; - /* NVM update command */ - if (ifd->ifd_cmd == I40E_NVM_ACCESS) - error = ixl_handle_nvmupd_cmd(pf, ifd); - else - error = EINVAL; + /* + * The iflib_if_ioctl forwards SIOCxDRVSPEC and SIOGPRIVATE_0 without + * performing privilege checks. It is important that this function + * perform the necessary checks for commands which should only be + * executed by privileged threads. + */ + + switch(command) { + case SIOCGDRVSPEC: + case SIOCSDRVSPEC: + /* NVM update command */ + if (ifd->ifd_cmd == I40E_NVM_ACCESS) { + error = priv_check(curthread, PRIV_DRIVER); + if (error) + break; + error = ixl_handle_nvmupd_cmd(pf, ifd); + } else { + error = EINVAL; + } + break; + default: + error = EOPNOTSUPP; + } return (error); } Modified: releng/12.1/sys/dev/ixl/ixl.h ============================================================================== --- releng/12.1/sys/dev/ixl/ixl.h Thu Mar 19 16:48:29 2020 (r359139) +++ releng/12.1/sys/dev/ixl/ixl.h Thu Mar 19 16:49:32 2020 (r359140) @@ -52,6 +52,7 @@ #include <sys/sockio.h> #include <sys/eventhandler.h> #include <sys/syslog.h> +#include <sys/priv.h> #include <net/if.h> #include <net/if_var.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003191649.02JGnWjd024598>