lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F9E3474.2050405@msgid.tls.msk.ru>
Date:	Mon, 30 Apr 2012 10:43:00 +0400
From:	Michael Tokarev <mjt@....msk.ru>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
CC:	"H. Peter Anvin" <hpa@...or.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Ian Kent <raven@...maw.net>, Thomas Meyer <thomas@...3r.de>,
	autofs@...r.kernel.org
Subject: Re: autofs: make the autofsv5 packet file descriptor use a packetized
 pipe

On 30.04.2012 10:27, Michael Tokarev wrote:
>> On 04/29/2012 01:54 PM, Linux Kernel Mailing List wrote:
>>>     However, a prettier solution exists now thanks to the packetized pipe
>>>     mode.  By marking the communication pipe as being packetized (by simply
>>>     setting the O_DIRECT flag), we can always just write the bigger packet
>>>     size, and if user-space does a smaller read, it will just get that
>>>     partial end result and the extra alignment padding will simply be thrown
>>>     away.
> 
>> +static inline int autofs_prepare_pipe(struct file *pipe)
>> +{
>> +	if (!pipe->f_op || !pipe->f_op->write)
>> +		return -EINVAL;
>> +	if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
>> +		return -EINVAL;
>> +	/* We want a packet pipe */
>> +	pipe->f_flags |= O_DIRECT;
>> +	return 0;
>> +}
>> +
> 
> @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(st
>  			err = -EBADF;
>  			goto out;
>  		}
> -		if (!pipe->f_op || !pipe->f_op->write) {
> +		if (autofs_prepare_pipe(pipe) < 0) {
>  			err = -EPIPE;
>  			fput(pipe);
>  			goto out;
> 
> I've one more concern.  I'm not sure but I think there's some
> risk still.  This packetizing gets applied to all VERSIONS of
> the autofs PROTOCOL.  Which means it will be applied to the
> lowest supported version (3) TOO, but did that version read
> whole packets too?

I think this is a false alarm.  I checked autofs v3 and v4
userspace code (found on  http://www.kernel.org/pub/linux/daemons/autofs )
and they both read whole packet at once, not piece-wise.

I didn't test if any of these actually work with any current
kernel, however ;)

Thanks,

/mjt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ