A PRIV_* flag for /dev/mem?

Konstantin Belousov kostikbel at gmail.com
Sun Jun 16 06:21:01 UTC 2013


On Sat, Jun 15, 2013 at 05:23:50PM -0600, Jamie Gritton wrote:
> Index: sys/dev/mem/memdev.c
> ===================================================================
> --- sys/dev/mem/memdev.c	(revision 251793)
> +++ sys/dev/mem/memdev.c	(working copy)
> @@ -67,8 +67,14 @@
>  {
>  	int error = 0;
>  
> -	if (flags & FWRITE)
> -		error = securelevel_gt(td->td_ucred, 0);
> +	if (flags & FREAD)
> +		error = priv_check(td, PRIV_KMEM_READ);
> +	if (flags & FWRITE) {
> +		if (error != 0)
> +			error = priv_check(td, PRIV_KMEM_WRITE);
> +		if (error != 0)
Shouldn't this be 'if (error == 0)' ?

> +			error = securelevel_gt(td->td_ucred, 0);
> +	}
>  
>  	return (error);
>  }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20130616/124ead78/attachment.sig>


More information about the freebsd-current mailing list