public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Zack Weinberg <zackw@panix.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	 Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH 2/3] network: recvmsg and sendmsg standard compliance (BZ#16919)
Date: Wed, 08 Jun 2016 20:15:00 -0000	[thread overview]
Message-ID: <CAKCAbMgk7vtMFoXKJ45TwnFv7gqNesNk0AuSRHvg58XMSMaQTg@mail.gmail.com> (raw)
In-Reply-To: <5756D873.1000701@linaro.org>

On Tue, Jun 7, 2016 at 10:21 AM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 07/06/2016 10:31, Zack Weinberg wrote:
>>
>> send/recv(m)msg are kernel primitives, and the fundamental basis of my
>> objection is that I think the C library should always faithfully expose
>> all the true kernel interfaces, *even if they are in some way wrong*.
>> This conformance violation should be addressed by the kernel first, and
>> only then should the C library follow suit.  That means that neither
>> this patch, nor the follow-up patch tackling cmsgbuf, should be applied
>> at all.  If either has already been applied, they should be backed out.
>
> I strongly disagree with this definition, the C library is still an
> abstraction on underlying kernel and GLIBC should and follows POSIX
> standards even when it deviates from the kernel primitives.  The same
> idea of standard is what drove the various fixes on both math library
> conformance and various primitives (quick_exit is an example).

You are going to have a very hard time persuading me to change my
position, and this ain't gonna do it. This is circular logic.  "We
should follow POSIX because we should follow POSIX."

I would consider a real (not made up for the purpose, and ideally,
already existing) program that is broken by not having these types be
as POSIX specifies to be a *valid argument* for changing the types,
but even that might not be a *persuasive* argument for changing the
types, especially since Florian has pointed out actual breakage from
changing them.  (Frankly, I think Florian's report of actual breakage
should be the last word on the subject - back the patch out already,
and let us never speak of this again.)

What would persuade you to accept *my* position on this issue?

(I'm cc:ing some of the usual standards-compliance gurus.  I'm
slightly more likely to be convinced by someone who is not advocating
for their own patch.)

> And it is also why some from community view explicit exposing some
> Linux primitives (such as gettid) to be a controversial subject.

As soon as I get some spare time (probably not in the 2.24 time frame)
I am going to post a patch that makes glibc expose every single one of
the Linux primitives that we don't already expose, because that's what
I think we should do.  But that's a tangent from this discussion.

...
>> Earlier, I said that I didn't like copying cmsgbuf because it wasn't
>> possible to be sure that no cmsg opcodes cared (now or in the future)
>> about the address of the buffer, and Adhemerval said (effectively) that
>> such an opcode would not make sense.  That's not true.  Imagine, if you
>> will, a cmsg that expects the ancillary buffer to be overlaid on a
>> shared memory area, and rewrites the *non*-ancillary buffer to reflect
>> the location of that memory area in the receiver.
>
> Again, I see to no problem in this scenario: the function prototype states
> a constant cmsghdr and it will not change its state. Even if the ancillary
> buffer might change, it is up to application to synchronize its access
> and call sendmsg in a flow where the data is a consistent state.  I personally
> see that calling a syscall with a buffer in racy condition does not make
> sense.

You clearly still don't get it.  It's not about the buffer being in a
racy condition.  It's that the *address might be part of the message.*
 "Nobody should do that" is NOT a valid objection, because this is an
arbitrarily extensible interface.

Let me try again with another example.  Imagine that there exists a
SCM_CREATE_SHMEM ancillary message whose effect is to *convert that
chunk of the ancillary buffer into a shared memory area*.  The kernel
will remap the data portion of the cmsg into the receiver, and supply
the receiver with the address at which it was mapped.  (You might be
about to object that it doesn't make sense to embed the desired shared
memory area in the cmsg, but, again, that is not a valid objection.
This is an arbitrarily extensible interface.  People can, will, and
*have* done arbitrarily bizarre things with it.)  Copying the
ancillary buffer, *in and of itself*, would break this message.  So
would applying any small size limit to the length of an ancillary
buffer.  And come to think of it, this hypothetical cmsg would also
justify the kernel's insisting to continue to use size_t for both
cmsg_len and msg_controllen.

zw

  reply	other threads:[~2016-06-08 20:15 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28 14:34 [PATCH v4 0/3] Fix {recv,send}{m}msg " Adhemerval Zanella
2016-03-28 14:34 ` [PATCH 3/3] network: recvmmsg and sendmmsg " Adhemerval Zanella
2016-03-28 14:34 ` [PATCH 1/3] Adjust kernel-features.h defaults for recvmsg and sendmsg Adhemerval Zanella
2016-03-29 21:32   ` Joseph Myers
2016-03-29 21:50     ` Adhemerval Zanella
2016-03-29 21:53     ` Adhemerval Zanella
2016-03-29 22:16       ` Andreas Schwab
2016-03-28 14:34 ` [PATCH 2/3] network: recvmsg and sendmsg standard compliance (BZ#16919) Adhemerval Zanella
2016-04-07  9:28   ` Szabolcs Nagy
2016-04-07 12:23     ` Adhemerval Zanella
2016-04-07  9:56   ` Florian Weimer
2016-04-07 11:37     ` Szabolcs Nagy
2016-04-07 12:29       ` Adhemerval Zanella
2016-04-21 14:01   ` Szabolcs Nagy
2016-04-21 20:07     ` Adhemerval Zanella
2016-04-22  8:04     ` Michael Kerrisk (man-pages)
2016-04-22 10:25       ` Szabolcs Nagy
2016-04-22 13:20         ` Michael Kerrisk (man-pages)
2016-04-22 13:40           ` Szabolcs Nagy
2016-04-21 17:15   ` Rich Felker
2016-05-02 19:17     ` Adhemerval Zanella
2016-06-07 13:31   ` Zack Weinberg
2016-06-07 14:21     ` Adhemerval Zanella
2016-06-08 20:15       ` Zack Weinberg [this message]
2016-06-08 20:58         ` Adhemerval Zanella
2016-06-09  3:18           ` Carlos O'Donell
2016-06-09 13:35             ` Zack Weinberg
2016-06-10 18:01               ` Carlos O'Donell
2016-06-10 18:19                 ` Joseph Myers
2016-06-10 18:45                   ` Carlos O'Donell
2016-06-10 20:17                     ` Joseph Myers
2016-06-13 14:43                       ` Carlos O'Donell
2016-06-09 14:21             ` Joseph Myers
2016-06-09 13:25           ` Zack Weinberg
2016-06-09 14:25             ` Adhemerval Zanella
2016-04-01 13:51 ` [PATCH v4 0/3] Fix {recv,send}{m}msg " Adhemerval Zanella
2016-04-06 18:24   ` Adhemerval Zanella
2016-04-21 13:21     ` Adhemerval Zanella
2016-05-24 19:44       ` Adhemerval Zanella
2016-05-26 13:50         ` Joseph Myers
2016-05-26 14:23           ` Adhemerval Zanella
2016-05-26 14:37             ` Adhemerval Zanella
2016-05-27  9:13         ` Florian Weimer
2016-06-08  8:36 ` Florian Weimer
2016-06-08 12:37   ` Joseph Myers
2016-06-08 15:57     ` Mike Frysinger
2016-06-08 19:45       ` Florian Weimer
2016-06-08 20:19         ` Adhemerval Zanella
2016-06-08 20:27           ` Florian Weimer
2016-06-08 21:05             ` Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2016-03-25 13:57 [PATCH v3 " Adhemerval Zanella
2016-03-25 13:57 ` [PATCH 2/3] network: recvmsg and sendmsg " Adhemerval Zanella
2016-03-23 14:31 [PATCH v2 0/3] Fix {recv,send}{m}msg " Adhemerval Zanella
2016-03-23 14:31 ` [PATCH 2/3] network: recvmsg and sendmsg " Adhemerval Zanella
2016-03-23 15:00   ` Andreas Schwab
2016-03-23 18:20     ` Adhemerval Zanella
2016-03-23 21:51   ` Joseph Myers
2016-03-24 12:58     ` Adhemerval Zanella

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=CAKCAbMgk7vtMFoXKJ45TwnFv7gqNesNk0AuSRHvg58XMSMaQTg@mail.gmail.com \
    --to=zackw@panix.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).