From: "Darrick J. Wong" <djwong@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Rob Landley <rob@landley.net>,
Denys Vlasenko <vda.linux@googlemail.com>,
David Howells <dhowells@redhat.com>,
Linux API <linux-api@vger.kernel.org>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: lsattr: incorrect size for ioctl result
Date: Tue, 29 Jun 2021 14:04:22 -0700 [thread overview]
Message-ID: <20210629210422.GD13767@locust> (raw)
In-Reply-To: <YNs7KsXJLdPp78Q5@mit.edu>
On Tue, Jun 29, 2021 at 11:24:26AM -0400, Theodore Ts'o wrote:
> On Mon, Jun 28, 2021 at 02:35:24PM -0500, Rob Landley wrote:
> >
> > Let me see if I understand:
> >
> > 1) The API the kernel exports is not what the kernel is doing.
> > 2) Userspace can't reliably use the API the way it's currently exported.
> > 3) Even other kernel devs "didn't understand" it.
> > 4) Fixing it would involve scare quotes and result from a pearl clutching fit.
> >
> > ... no, I'm pretty sure I don't understand.
> >
> > *shrug* I've cc'd Michael Kerrisk in hopes he can update the man pages. "man
> > ioctl_list" already documents these ioctls correctishly (modulo the
> > signed/unsigned part) but might benefit from some sort of "warning, do not trust
> > the kernel headers here, they are wrong" comment.
>
> The philosophical question is whether the encoding of _IO* is actually
> part of an exported "API", or just a way of encoding codepoints such
> that when data structures change size, the codepoint automatically
> changes/breaks.
>
> We have historically speaking, a non-trivial number of ioctl's which
> don't follow the _IO[RW] convention. For example, most of the block
> ioctls predate the _IO[RW] convention, and they set or get memory
> without specifying the size of the type that is set or get. Oh, noos!
> The kernel is (clutchign pearls) *violating* an API "promise".
> (Although, in reality, these code points existed for long before we
> imposed this _IO[RW] "API".) Should we break userspace to "fix" this
> supposed API violation? Or should we go through a huge amount of
> effort to fix them all?
>
> At one point, I had made an attempt to define the "correct" codepoint
> via a definition of EXT4_IOC_GETVERSION and EXT4_IOC_GETVERSION_OLD,
> so the kernel would support the "correct" and "wrong" ioctl codepoint.
> Unfortunate, this got broken when other folks tried to unify
> everything to use FS_IOC_GETVERSION defined in
> include/uapi/linux/fs.h. And given that we would have to support the
> "wrong" codepoint for a decade or more, personally, I've stopped
> caring about it, especially since we've lived with it for a decade or
> more, and very few people been harmed.
>
> If someone wants to fix up all of the ioctl code points, perhaps so it
> would make life easier for strace, or some such, it's not a *terrible*
> idea. (At the very least, it's more useful than KPI-hacking folks
> submitting whitespace fixes that don't even fix all of the
> checkpatch.pl "violations".) But forcing all of the ioctl codepoints
> into the procrustean bed of the _IO[RW] covention is a huge amount of
> work, and would take years before userspace could depend on this
> "API".
Why don't we deprecate FS_IOC_[GS]ETFLAGS and tell everyone to use
FS[GS]ETXATTR? They use the same code paths and vfs helpers now.
--D
>
> Cheers,
>
> - Ted
next prev parent reply other threads:[~2021-06-29 21:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAK1hOcO3qHFO6QOkpjnC_A4LVhwed02XxCYZvEn+8t+HnyGjZA@mail.gmail.com>
[not found] ` <b1b801af-d309-829e-fd48-6487661df809@landley.net>
[not found] ` <CAK1hOcMh3RK_Nd_=W-RgqhMZJh-OGY9qMDfxpALZHpxwriHgAA@mail.gmail.com>
2021-06-25 9:01 ` lsattr: incorrect size for ioctl result Rob Landley
2021-06-25 12:14 ` Denys Vlasenko
2021-06-28 16:33 ` Theodore Ts'o
2021-06-28 19:35 ` Rob Landley
2021-06-29 15:24 ` Theodore Ts'o
2021-06-29 21:04 ` Darrick J. Wong [this message]
2021-06-30 3:57 ` Theodore Ts'o
2021-06-30 18:30 ` Rob Landley
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=20210629210422.GD13767@locust \
--to=djwong@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=rob@landley.net \
--cc=tytso@mit.edu \
--cc=vda.linux@googlemail.com \
/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 NNTP newsgroup(s).