All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Linfeng Sun" <linfeng.sun.dev@gmail.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vduse: return compat ioctl results directly
Date: Tue, 8 Sep 2026 04:32:32 -0400	[thread overview]
Message-ID: <20260908043143-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <ea3ba5cc-ae68-4c1d-a3a9-c2840a1cb9e7@app.fastmail.com>

On Tue, Sep 08, 2026 at 10:08:46AM +0200, Arnd Bergmann wrote:
> On Tue, Sep 8, 2026, at 09:57, Michael S. Tsirkin wrote:
> > On Tue, Sep 08, 2026 at 03:31:51PM +0800, Linfeng Sun wrote:
> >> The compat handler handles VDUSE_IOTLB_GET_FD and VDUSE_VQ_GET_INFO, but
> >> then calls the native handler. Their different command sizes make native
> >> dispatch return -ENOIOCTLCMD.
> >> 
> >> For GET_FD, this overwrites receive_fd()'s return value after the
> >> descriptor is installed, leaking one fd per call. Return handled compat
> >> results directly and use native dispatch only for other commands.
> >> 
> >> Fixes: 455a2a1af926 ("vduse: fix compat handling for VDUSE_IOTLB_GET_FD/VDUSE_VQ_GET_INFO")
> >> Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
> >
> > indeed, I will apply.
> 
> The fix looks correct to me, thanks!
> 
> > But ... how was the original patch working then? Arnd, what gives?
> 
> It looks I either broke it during refactoring from two functions
> into one, or I just didn't do it right in the first place.
> 
> I did write in the extra patch text
> 
> | The code is directly copied from the native ioctl handler, but I
> | did not test this with actual x86-32 userspace, so please review
> | carefully.
> 
> but obviously should have caught this one myself since it is a much
> less subtle bug than the one I was trying to fix in the first place.
> 
>       Arnd

Should teach me not to apply untested code. No amount of
careful review replaces testing)

-- 
MST


      reply	other threads:[~2026-09-08  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  7:31 [PATCH] vduse: return compat ioctl results directly Linfeng Sun
2026-09-08  7:57 ` Michael S. Tsirkin
2026-09-08  8:08   ` Arnd Bergmann
2026-09-08  8:32     ` Michael S. Tsirkin [this message]

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=20260908043143-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=arnd@arndb.de \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=linfeng.sun.dev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.