From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: den@openvz.org
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 2/5] dm-ploop: set delta is_raw before applying its mappings
Date: Fri, 9 Oct 2026 08:28:37 +0200 [thread overview]
Message-ID: <488eeba3-6952-4741-bb54-8a46695d8894@virtuozzo.com> (raw)
In-Reply-To: <20261008140333.614909-3-alexander.ivanov@virtuozzo.com>
> [Severity: Low]
> Can this unconditional if (nr_be) guard skip the top-level header copy?
> The commit message only justifies the guard for an empty raw delta.
>
> In ploop_apply_delta_mappings(), the on-disk header is copied into md0
> only here:
>
> if (is_top_level && md->id == 0 && !is_raw) {
> /* bat_entries before PLOOP_MAP_OFFSET is hdr */
> memcpy(bat_entries, d_bat_entries,
> sizeof(struct ploop_pvd_header));
> }
>
> A non-raw top delta with m_Size == 0 appears to reach this path.
> ploop_add_deltas_stack() calls ploop_check_top_delta() and then
> ploop_add_delta(). ploop_check_top_delta() does not reject m_Size == 0,
> and ploop_read_delta_metadata() can then return nr_be == 0.
>
> Before the patch, ploop->bat_entries held md page 0 in this case, so the
> loop body ran once and the memcpy was executed. With the guard, the whole
> function is skipped.
>
> ploop_check_top_delta() only allocates md pages through
> ploop_prealloc_md_pages(). Those pages are filled with BAT_ENTRY_NONE and
> do not get the header.
>
> Would md0 then keep the BAT_ENTRY_NONE fill instead of the header?
> ploop_resize() reads hdr->m_SizeInSectors_v2 from md0, and writeback or
> grow writes it back.
>
> This looks limited to crafted or corrupt images, since a device with
> nr_bat_entries == 0 cannot serve normal I/O.
>
> Would it be better to apply the guard only for the raw case, or to still
> copy the header for a non-raw top delta? The later ploop_read_delta() and
> ploop_reload_metadata() changes in the series keep the same if (nr_be)
> guard, so it does not look like this is fixed later.
Fixed in a new commit: "dm-ploop: reject top delta with empty BAT".
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-10-09 6:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 14:03 [Devel] [PATCH hci-8.1 v3 0/5] dm-ploop: truncate unused tail of top delta on suspend Alexander Ivanov
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 1/5] dm-ploop: fix lost wakeup in ploop_allocator() Alexander Ivanov
2026-10-08 14:07 ` no-reply
2026-10-08 16:51 ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 2/5] dm-ploop: set delta is_raw before applying its mappings Alexander Ivanov
2026-10-08 14:09 ` no-reply
2026-10-08 16:51 ` Denis V. Lunev
2026-10-09 6:28 ` Alexander Ivanov [this message]
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 3/5] dm-ploop: factor out ploop_read_delta() from ploop_add_delta() Alexander Ivanov
2026-10-08 14:08 ` no-reply
2026-10-08 16:51 ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 4/5] dm-ploop: reload metadata on resume Alexander Ivanov
2026-10-08 14:18 ` no-reply
2026-10-08 16:51 ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 5/5] dm-ploop: truncate unused tail of top delta on suspend Alexander Ivanov
2026-10-08 14:15 ` no-reply
2026-10-08 16:51 ` Denis V. Lunev
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=488eeba3-6952-4741-bb54-8a46695d8894@virtuozzo.com \
--to=alexander.ivanov@virtuozzo.com \
--cc=den@openvz.org \
--cc=devel@openvz.org \
/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