Re: A PRIV_* flag for /dev/mem?

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Sun, 16 Jun 2013 09:20:57 +0300
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)
> _at__at_ -67,8 +67,14 _at__at_
>  {
>  	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);
>  }


Received on Sun Jun 16 2013 - 04:21:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:38 UTC