public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>,
	mjt@tls.msk.ru, linux-kernel@vger.kernel.org,
	autofs@vger.kernel.org, raven@themaw.net, thomas@m3y3r.de,
	stable@kernel.org
Subject: Re: [PATCH v2] Introduce a version6 of autofs interface, to fix design error.
Date: Fri, 27 Apr 2012 17:03:11 -0700	[thread overview]
Message-ID: <4F9B33BF.908@zytor.com> (raw)
In-Reply-To: <CA+55aFyCpiU5_nG-3Nra5q9x0-71amAQVetZTxxP6waR1ueYNQ@mail.gmail.com>

On 04/27/2012 04:07 PM, Linus Torvalds wrote:
> 
> The important change is actually to make the read return the size requested.
> 
> So broken user space does a read() with the wrong size - and then
> checks that it gets *exactly* that many bytes. Not more, not less.
> 
> The way to handle that is to
>  - make sure the kernel always writes the maximally padded data
>  - make the packetization simply drop any data that was in the packet
> that the reader didn't ask for.
> 
> This is very much a semantic change, in that any client that tries to
> read the packet with multiple reads (one 4-byte read to see the size,
> followed by one "right-sized" read of the data) would be totally
> screwed. The first read would indeed read the size, but it also -
> because of the packetized interface - would simply drop the data, and
> the next read would read the first bytes of the next packet.
> 
> But that's not what the autofs users actually do anyway. They just
> read the whole packet.  So we can make *them* work. And the new
> interface will be fairly robust (in fact, you could pass it some big
> buffer and just know you always get exactly one packet, and never have
> that whole stupid "sizeof()" at all).
> 

OK, I follow you now.  That would work for autofs; I presume it is not
something we would export to other users though?  If so I'd worry about
opening up new security issues.

Still, I have to admit... we have a grand total of three users of this
interface as far as we know (autofs, systemd, and am-utils if they ever
revved that one to v5.)  Would it really not be better to do the
zero-eating user space fix?

	-hpa



  reply	other threads:[~2012-04-28  0:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 13:34 [PATCH v2] Introduce a version6 of autofs interface, to fix design error Michael Tokarev
2012-04-26 13:44 ` Michael Tokarev
2012-04-27  0:37 ` Linus Torvalds
2012-04-27  9:45   ` Michael Tokarev
2012-04-27 15:47     ` Mark Lord
2012-04-27 20:37       ` H. Peter Anvin
2012-04-28 22:20         ` Mark Lord
2012-04-27 16:22     ` David Miller
2012-04-27 17:10       ` Michael Tokarev
2012-04-27 17:28         ` David Miller
2012-04-27 18:19     ` Linus Torvalds
2012-04-27 18:34       ` David Miller
2012-04-27 18:42         ` Linus Torvalds
2012-04-27 18:55           ` Linus Torvalds
2012-04-27 19:14             ` David Miller
2012-04-27 19:16               ` David Miller
2012-04-27 19:19                 ` Linus Torvalds
2012-04-27 19:24                   ` David Miller
2012-04-27 19:56                     ` Linus Torvalds
2012-04-27 20:13                       ` Stef Bon
2012-04-27 20:29                       ` David Miller
2012-04-27 22:40                         ` Linus Torvalds
2012-04-27 20:43                       ` H. Peter Anvin
2012-04-27 22:42                         ` Linus Torvalds
2012-04-27 22:56                           ` H. Peter Anvin
2012-04-27 23:07                             ` Linus Torvalds
2012-04-28  0:03                               ` H. Peter Anvin [this message]
2012-04-28  0:17                                 ` Linus Torvalds
2012-04-27 22:42                       ` Alan Cox
2012-04-27 22:49                         ` Linus Torvalds
2012-04-27 23:27                         ` Linus Torvalds
2012-04-28 16:10                           ` Linus Torvalds
2012-04-29  6:37                             ` Michael Tokarev
2012-04-29  7:19                               ` Linus Torvalds
2012-04-29  7:45                                 ` Michael Tokarev
2012-04-29 18:29                                   ` Linus Torvalds
2012-04-29 19:09                                     ` Linus Torvalds
2012-04-29 19:53                                       ` Michael Tokarev
2012-04-29 20:53                                         ` Linus Torvalds
2012-04-30  8:41                                         ` Thomas Meyer
2012-04-28  1:56               ` Ian Kent
2012-04-27 19:08           ` David Miller
2012-04-27 20:45             ` H. Peter Anvin
2012-04-27 20:42       ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F9B33BF.908@zytor.com \
    --to=hpa@zytor.com \
    --cc=autofs@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=raven@themaw.net \
    --cc=stable@kernel.org \
    --cc=thomas@m3y3r.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox