From: Paolo Bonzini <pbonzini@redhat.com>
To: Mike Snitzer <snitzer@redhat.com>, hch@lst.de
Cc: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>,
dm-devel@redhat.com, hare@suse.de, linux-scsi@vger.kernel.org
Subject: Re: IBM request to allow unprivledged ioctls [Was: Revert "dm mpath: fix stalls when handling invalid ioctls"]
Date: Sat, 31 Oct 2015 20:07:07 +0100 [thread overview]
Message-ID: <5635115B.7080805@redhat.com> (raw)
In-Reply-To: <20151031181312.GA11587@redhat.com>
On 31/10/2015 19:13, Mike Snitzer wrote:
> > But that's wrong, I think. It's a false positive in
> > scsi_verify_blk_ioctl().
> >
> > If the ioctl is valid when bdev becomes non-NULL (and it will be if
> > ti->len becomes equal to i_size_read(bdev->bd_inode) >> SECTOR_SHIFT),
> > you should not return -ENOIOCTLCMD aka ENOTTY, because userspace doesn't
> > think the ioctls can go away and come back. So Hannes's patch broke the
> > userspace ABI. :(
>
> Huh? All that Hannes' patch did was add early verification of the ioctl
> if there are no paths, since: there is no point queueing an ioctl that
> is invalid.
>
> [snip discussion of Christoph's patches]
>
> The point is scsi_verify_blk_ioctl() is saying the ioctl isn't valid.
> It has nothing to do with the existance of a bdev or not; but everything
> to do with the unprivledged user's request to issue an ioctl.
... but the call is skipped (and all ioctls are valid) if ti->len ==
i_size_read(bdev->bd_inode) >> SECTOR_SHIFT. Therefore, until you have
the bdev you don't know which ioctls are valid, and you must assume all
of them are. You can't do anything unsafe anyway until you have the
bdev. This is the reasoning prior to Hannes's change.
Afterwards, you end up calling scsi_verify_blk_ioctl() when bdev ==
NULL. If the future bdev satisfies the above condition on ti->len, this
means that ioctl(SG_IO) switches from ENOTTY to available. Userspace is
clearly not expecting that.
> Paolo, AFAIK unprivledged ioctls is one of your pet-projects so your
> insight on what, if anything, needs changing to support them is the
> insight I think we need.
I hope the above provides some extra information.
Paolo
next prev parent reply other threads:[~2015-10-31 19:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1446121463-17828-1-git-send-email-mauricfo@linux.vnet.ibm.com>
2015-10-29 13:18 ` IBM request to allow unprivledged ioctls [Was: Revert "dm mpath: fix stalls when handling invalid ioctls"] Mike Snitzer
2015-10-29 14:47 ` [dm-devel] " Mauricio Faria de Oliveira
2015-10-31 15:33 ` Paolo Bonzini
2015-10-31 18:13 ` Mike Snitzer
2015-10-31 18:36 ` Mike Snitzer
2015-10-31 19:07 ` Paolo Bonzini [this message]
2015-10-31 22:47 ` Mike Snitzer
2015-11-02 7:28 ` Hannes Reinecke
2015-11-02 9:57 ` Paolo Bonzini
2015-11-02 13:31 ` Mike Snitzer
2015-11-02 13:56 ` Hannes Reinecke
2015-11-02 14:12 ` Mike Snitzer
2015-11-02 14:36 ` Hannes Reinecke
2015-11-02 15:14 ` Mike Snitzer
2015-11-02 15:29 ` Hannes Reinecke
2015-11-02 14:52 ` Paolo Bonzini
2015-11-02 15:05 ` Mike Snitzer
2015-11-02 15:45 ` Paolo Bonzini
2015-11-02 15:49 ` Mike Snitzer
2015-11-02 15:32 ` Hannes Reinecke
2015-11-02 9:55 ` Paolo Bonzini
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=5635115B.7080805@redhat.com \
--to=pbonzini@redhat.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=mauricfo@linux.vnet.ibm.com \
--cc=snitzer@redhat.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).