From: Arnd Bergmann <arnd@arndb.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Doug Gilbert <dgilbert@interlog.com>
Subject: Re: [GIT PULL] first round of SCSI updates for the 5.4+ merge window
Date: Wed, 4 Dec 2019 15:05:09 +0100 [thread overview]
Message-ID: <CAK8P3a33oETbN-60VjpNNeuW1U1Wzb4juVzdiw1ESdses6m3bw@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wjWNpPW91wyEj4FC4pOimWEUtLVb_RwQgB+9h2OO6ynyA@mail.gmail.com>
On Mon, Dec 2, 2019 at 10:58 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Anyway, the sg copyin/out changes by Al conflicted fairly badly with
> Arnd's compat_ioctl changes.
>
> Al did
>
> c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of
> userland sg_io_hdr_t")
>
> which avoided doing a whole allocation of an 'sg_io_hdr_t' to just
> read the one field of it.
>
> But Arnd did
>
> 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling")
>
> which created a get_sg_io_hdr() helper that copied the 'sg_io_hdr_t'
> from user space the right way for both compat and native, which
> basically relied on the old approach.
Right, I also failed to notice that the linux-next conflict resolution
was breaking my changes, the fixup looked simple enough there. :-(
> since it turns out that the one 'pack_id' field we want does have the
> same format in compat mode as in native mode ("int" and
> "compat_int_t" are the same), it's just at different offsets. But the
> definition of 'compat_sg_io_hdr' isn't available in that place.
>
> I'm leaving it to Al and Arnd to decide if they want to fix the
> stupidity. I tried to make the minimally invasive merge resolution.
>
> Al, Arnd? Comments?
>
> It looks like linux-next punted on this entirely, and took Al's
> simplified version that doesn't work with the compat case. Maybe I
> should have done the same - if you use read() on the /dev/sg* device,
> you deserve to get broken for the compat case. And it didn't
> historically work anyway. But it was kind of sad to see how Arnd fixed
> it, and then it got broken again.
I've tried now to move the pack_id logic into a separate function
and, in doing so noticed a bug in my own patch: sg_new_read()
needs to check for the compat_sg_io_hdr size, which also
depends on the struct definition. I've drafted a patch that should
do this right, but we could also just -EINVAL in compat mode here
if that's too complex.
Arnd
next prev parent reply other threads:[~2019-12-04 14:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-30 18:10 [GIT PULL] first round of SCSI updates for the 5.4+ merge window James Bottomley
2019-12-02 21:57 ` Linus Torvalds
2019-12-02 22:40 ` James Bottomley
2019-12-04 14:05 ` Arnd Bergmann [this message]
2019-12-04 14:08 ` [PATCH] scsi: sg: fix v3 compat read/write interface Arnd Bergmann
2019-12-04 18:32 ` Linus Torvalds
2019-12-04 20:35 ` Arnd Bergmann
2019-12-02 22:00 ` [GIT PULL] first round of SCSI updates for the 5.4+ merge window pr-tracker-bot
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=CAK8P3a33oETbN-60VjpNNeuW1U1Wzb4juVzdiw1ESdses6m3bw@mail.gmail.com \
--to=arnd@arndb.de \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=dgilbert@interlog.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).