Re: [RFC PATCH] SELinux: differentiate between open and r/w operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 22 Feb 2008, Eric Paris wrote:

> +	if (selinux_policycap_openperm) {
> +		/*
> +		 * lnk files and socks do not really have an 'open'
> +		 */
> +		if (S_ISREG(inode->i_mode))
> +			av |= FILE__OPEN;
> +		else if (S_ISCHR(inode->i_mode))
> +			av |= CHR_FILE__OPEN;
> +		else if (S_ISBLK(inode->i_mode))
> +			av |= BLK_FILE__OPEN;
> +		else if (S_ISFIFO(inode->i_mode))
> +			av |= FIFO_FILE__OPEN;
> +		else if (S_ISDIR(inode->i_mode))
> +			av |= DIR__OPEN;
> +		else {
> +			printk(KERN_EMERG "inside open_file_to_av with unknown mode:%x\n", inode->i_mode);
> +			BUG();
> +		}
> +	}
> +	return av;

I don't think we should BUG() here, makes it too easy for a DoS attack 
if there is ever a possible further value for i_mode.

I suggest just printing a warning via printk_ratelimit and returning the 
value of file_to_av(), which simply preserves existing behavior.


- Ja,es
-- 
James Morris
<jmorris@xxxxxxxxx>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux