From: "Arnd Bergmann" <arnd@arndb.de>
To: "Michael S. Tsirkin" <mst@redhat.com>,
"Linfeng Sun" <linfeng.sun.dev@gmail.com>
Cc: "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, 08 Sep 2026 10:08:46 +0200 [thread overview]
Message-ID: <ea3ba5cc-ae68-4c1d-a3a9-c2840a1cb9e7@app.fastmail.com> (raw)
In-Reply-To: <20260908035646-mutt-send-email-mst@kernel.org>
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
next prev parent reply other threads:[~2026-09-08 8:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 7:31 Linfeng Sun
2026-09-08 7:57 ` Michael S. Tsirkin
2026-09-08 8:08 ` Arnd Bergmann [this message]
2026-09-08 8:32 ` Michael S. Tsirkin
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=ea3ba5cc-ae68-4c1d-a3a9-c2840a1cb9e7@app.fastmail.com \
--to=arnd@arndb.de \
--cc=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=linfeng.sun.dev@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®