Re: [RFC] correct flags to f_mode conversion in __dentry_open

From: Al Viro
Date: Wed Mar 12 2008 - 14:34:52 EST


On Wed, Mar 12, 2008 at 02:25:27PM -0400, Eric Paris wrote:
> I recently tried to add an SELinux BUG_ON in the case where the kernel
> made a permission request for no permissions and was able to stumble
> over it with something as simple as
>
> open("/dev/null", 3);
>
> Notice that 3 == (O_RDWR | O_WRONLY)
>
> First question, is 3 ever a valid flag from from userspace to sys_open?

Yes. "Check for both read and write permissions, set neither FMODE_READ
nor FMODE_WRITE".

Don't break drivers, please - some use that for "ioctl-only" opens,
with special semantics for those.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/