Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2013 09:20:57 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Jamie Gritton <jamie@FreeBSD.org>
Cc:        Kirk McKusick <mckusick@mckusick.com>, Robert Watson <rwatson@FreeBSD.org>, FreeBSD Current <freebsd-current@FreeBSD.org>, Alexander Leidinger <netchild@FreeBSD.org>
Subject:   Re: A PRIV_* flag for /dev/mem?
Message-ID:  <20130616062057.GR91021@kib.kiev.ua>
In-Reply-To: <51BCF786.2070603@FreeBSD.org>
References:  <201305202256.r4KMuWpH055366@chez.mckusick.com> <51BCF786.2070603@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



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