From owner-freebsd-current@FreeBSD.ORG Sun Jun 16 06:21:01 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D05F5ED5; Sun, 16 Jun 2013 06:21:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 451F81BCA; Sun, 16 Jun 2013 06:21:01 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r5G6Kvi8039572; Sun, 16 Jun 2013 09:20:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r5G6Kvi8039572 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r5G6KvKu039571; Sun, 16 Jun 2013 09:20:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 16 Jun 2013 09:20:57 +0300 From: Konstantin Belousov To: Jamie Gritton Subject: Re: A PRIV_* flag for /dev/mem? Message-ID: <20130616062057.GR91021@kib.kiev.ua> References: <201305202256.r4KMuWpH055366@chez.mckusick.com> <51BCF786.2070603@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZRLamLUCLuRJXeX8" Content-Disposition: inline In-Reply-To: <51BCF786.2070603@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Kirk McKusick , Robert Watson , FreeBSD Current , Alexander Leidinger X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jun 2013 06:21:01 -0000 --ZRLamLUCLuRJXeX8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 15, 2013 at 05:23:50PM -0600, Jamie Gritton wrote: > Index: sys/dev/mem/memdev.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/dev/mem/memdev.c (revision 251793) > +++ sys/dev/mem/memdev.c (working copy) > @@ -67,8 +67,14 @@ > { > int error =3D 0; > =20 > - if (flags & FWRITE) > - error =3D securelevel_gt(td->td_ucred, 0); > + if (flags & FREAD) > + error =3D priv_check(td, PRIV_KMEM_READ); > + if (flags & FWRITE) { > + if (error !=3D 0) > + error =3D priv_check(td, PRIV_KMEM_WRITE); > + if (error !=3D 0) Shouldn't this be 'if (error =3D=3D 0)' ? > + error =3D securelevel_gt(td->td_ucred, 0); > + } > =20 > return (error); > } --ZRLamLUCLuRJXeX8 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRvVlIAAoJEJDCuSvBvK1Bz5MP/09UG1gtAS0RbSH3F4tgwf8j QoiRHK38rLIOa4zs7GOIiIJ3ykT0vFRqt13Dtnk+vVYERAMstD4Sy9fEA1G75sA5 xpww51jxW+Z3th4NkBAlFTGEfGsf50zGAF+z03KrgSC9RM94j2NCZJz3a35nRPCB IEeZyf4pdlQRIOCStF2J2JpnK7okAikSv7Jvl3/Bir2F/8TQeVHq0EP42/IsE5UJ sx9BgttEzQSg8cHS6Lq7w8d/lT9A8fCMJIDyjm7WGA0pG6VV/ZwQ7xbX0Ljf74SG lll3C+RicbnCoXIjtOb6VOanyEtbxfFZIkqo2v6/mc2B+YYEJxDJ7tDJeZDmCNd2 4UWI0UMt0cHs7TO2FWBs6OOCmnxbrk3Pb6uxYCfgL92FrQRlp0spex31v5cg1gFD pOx4pkLoXX0x2Ojw4FvDz3OMN3Kx+pr4nIq/BcW+H8qt8tP+jv6IhellfljOUiia wOWiztHyHELvldNTk4IVuEH3XZZi5JhN7J0vnTROxTRKowwXFTwJWWFvc/iY2pDX kDOsMXv/W/qTHFxpLGiMBe8Lv662rkTlrEJXjRuCr0fX1OkA22d2uWMiED6HjYzB Mp6FAUZge3cf2ic1ycKwVkoPbTaZsgIAijE4cJFV6qZ7RyikOJTMHeT27f89envP 6NWBx3UwvXDyx9pIqKsl =YxrX -----END PGP SIGNATURE----- --ZRLamLUCLuRJXeX8--