Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2013 09:21:08 -0600
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
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:  <51BDD7E4.60704@FreeBSD.org>
In-Reply-To: <20130616062057.GR91021@kib.kiev.ua>
References:  <201305202256.r4KMuWpH055366@chez.mckusick.com> <51BCF786.2070603@FreeBSD.org> <20130616062057.GR91021@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On 06/16/13 00:20, Konstantin Belousov wrote:
> 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)' ?

Indeed it should. None of this has even been compiled yet, let alone
tested - still in the thought phase.

- Jamie



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