From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: vasileios.almpanis@virtuozzo.com, ptikhomirov@virtuozzo.com,
Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v8 5/6] ovl: Fix leaking fd references in ovl_copyfile
Date: Mon, 16 Nov 2026 21:03:33 +0100 [thread overview]
Message-ID: <7e7d00f0-debe-4294-ac86-63c0b36b22a1@virtuozzo.com> (raw)
In-Reply-To: <010701a1e5d54e35-6c3ca6a1-8743-4db5-89ab-f9888893d9a2-000000@eu-central-1.amazonses.com>
On 11/16/26 20:28, no-reply@sashiko.virtuozzo.com wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] ovl: commit message does not state the actual fd leak in
> ovl_copyfile()
> --
>
> commit 19e71b9ba90a3111ae72b566162542bd1c41d68d
> Author: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
>
>> ovl: Fix leaking fd references in ovl_copyfile
>>
>> We lack of ovl_real_file, added in d66907b[1], which changed
>> logic so that the code needs no fdput anymore. We still need it.
>>
>> Imported commit a1e0eb8[2] didn't bother with fdput cleanup,
>> because it relied on d66907b existence. We need to perform
>> a cleanup when rw_verify_area fails and put real_in/real_out fds.
>>
>> [1]: https://github.com/torvalds/linux/commit/d66907b51ba0
>> [2]: https://github.com/torvalds/linux/commit/a1e0eb8f55cf
>>
>> https://virtuozzo.atlassian.net/browse/VSTOR-142405
>> Fixes: d5a10d38e534 ("rh10: import RHEL10 kernel-6.12.0-211.75.1.el10")
>> Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
>
> [Severity: Low]
> Could the message state the leak more directly? The sentence "the code
> needs no fdput anymore. We still need it." contradicts itself, and the
> message never names the path that leaks.
No contradiction. Code with d66907b needs no fdput, but this is not
our code.
>
> As far as I can tell, the leak is in the cross-sb check in ovl_copyfile().
> When rw_verify_area() fails, the code jumped to out_unlock. Both
> ovl_real_fdget() calls had already succeeded, so this skipped fdput(real_in)
> and fdput(real_out). When FDPUT_FPUT is set, that leaks the file
> references.
>
> The message could say this in one sentence. It could also name the
> upstream commits by 12-character sha and subject instead of the short
> shas and bare URLs.
The leak is obvious from the code. I'm not adding useless words to the
commit message.
>
--
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 20:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:20 [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 1/6] ve: Remove STOPPED state Vladimir Riabchun
2026-11-16 19:25 ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 2/6] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-16 19:27 ` no-reply
2026-11-16 20:05 ` Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 3/6] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-16 19:27 ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 4/6] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-16 19:28 ` no-reply
2026-11-17 14:49 ` Konstantin Khorenko
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 5/6] ovl: Fix leaking fd references in ovl_copyfile Vladimir Riabchun
2026-11-16 19:28 ` no-reply
2026-11-16 20:03 ` Vladimir Riabchun [this message]
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 6/6] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-16 19:36 ` no-reply
2026-11-16 20:03 ` Vladimir Riabchun
2026-11-17 14:49 ` [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Konstantin Khorenko
2026-11-17 14:49 ` Konstantin Khorenko
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=7e7d00f0-debe-4294-ac86-63c0b36b22a1@virtuozzo.com \
--to=vladimir.riabchun@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@virtuozzo.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