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: [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs
Date: Mon, 16 Nov 2026 20:20:38 +0100 [thread overview]
Message-ID: <20261116-ovl-use-orig-ve-v8-0-dfe427bfd902@virtuozzo.com> (raw)
When testing CRIU with containers with docker images,
we found an easily reproducible kernel crash:
[ 2300.870181] BUG: kernel NULL pointer dereference, address: 0000000000000005
[ 2300.871537] #PF: supervisor read access in kernel mode
[ 2300.872577] #PF: error_code(0x0000) - not-present page
[ 2300.873595] PGD 800000010a18f067 P4D 800000010a18f067 PUD 10730c067 PMD 0
[ 2300.874900] Oops: Oops: 0000 [#1] SMP PTI
[ 2300.875742] CPU: 1 UID: 0 PID: 5419 Comm: criu ve: 0 Kdump: loaded Not tainted 6.12.0-211.39.1.16.6.vz10.x86_64 #1 16.6 PREEMPT(voluntary)
[ 2300.878057] Hardware name: Acronis OpenStack Compute/Virtuozzo, BIOS 1.16.1-1.vz9.2 04/01/2014
[ 2300.879684] RIP: 0010:ovl_get_index_name_fh+0x18/0x70 [overlay]
[ 2300.880859] Code: ...
[ 2300.884128] RSP: 0018:ffffd32582e0f7c0 EFLAGS: 00010246
[ 2300.895807] Call Trace:
[ 2300.896397] <TASK>
[ 2300.904435] ovl_create_index+0x82/0x260 [overlay]
[ 2300.905406] ovl_copy_up_workdir+0x30a/0x330 [overlay]
[ 2300.906427] ovl_do_copy_up+0x10d/0x2e0 [overlay]
[ 2300.907387] ovl_copy_up_one+0x456/0x720 [overlay]
[ 2300.910736] ovl_copy_up_flags+0x81/0x110 [overlay]
[ 2300.911740] ovl_create_object+0x51/0x130 [overlay]
[ 2300.912719] vfs_mkdir+0x194/0x250
[ 2300.913470] do_mkdirat+0x14c/0x180
[ 2300.914223] __x64_sys_mkdir+0x46/0x70
[ 2300.915019] do_syscall_64+0x7d/0x160
[ 2300.922814] entry_SYSCALL_64_after_hwframe+0x76/0x7e
The cause is that overlayfs does some feature checks on superblock
creation using capable/ve_capable and it stores current credentials.
But ve_capable check result depends on both current creds and
current VE. Later, overlayfs switches credentials only, leading
to unexpected feature disappearance.
1. Patch 1 removes separate STOPPED state - VE goes directly to DEAD.
2. Patch 2 adds helpers for overriding tasks VE.
3. Patch 3 delays ve cred drop until final destruction of VE.
4. Patch 4 adds VE owner to overlay superblock.
5. Patch 5 fixes fd leak that appeared after rebase.
6. Patch 6 fixes the bug by switching VE together with creds in overlayfs.
As a side effect of this series - CT1 overlayfs mounts won't work
in CT2 and this is a good thing.
There's still a gap - creds may be overrided in other places and
we should handle them - a separate VSTOR-155347 task is for it.
https://virtuozzo.atlassian.net/browse/VSTOR-143259 - non-CRIU repro
https://virtuozzo.atlassian.net/browse/VSTOR-142405
Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
---
Changes in v8:
- One more time updated commit messages to make sashiko happy.
- Rebased on hci-8.2.
- Returned ve_name print in patch 2 - now we free name in the
very end.
- In patch 6 did noted other cred usages in commit message and
updated ovl_lower_positive to return true on failure.
- Link to v7: http://lore.virtuozzo.com/20261116-ovl-use-orig-ve-v7-0-37daa56081ed@virtuozzo.com
Changes in v7:
- Patch 2: dropped new_ve name printing due to a race with free.
- Added new patch to fix rebase-introduced fd leak.
- Updated some commit messages.
- Link to v6: http://lore.virtuozzo.com/20261116-ovl-use-orig-ve-v6-0-7cfb41c8c973@virtuozzo.com
Changes in v6:
- Fixed various typos spotted by Kostya.
- Updated comments in commit messages and code.
- Rebased on rh10-6.12.0-211.75.1.24.1.vz10, overlayfs got one more
place with creds override ovl_copyfile.
- Patch 2: helper always returns -EPERM for non-host switches.
- Patch 5: CT -> Host switch is handled by overlayfs now, code
updated with Kostya's suggestions.
- Link to v5: http://lore.virtuozzo.com/20261110-ovl-use-orig-ve-v5-0-f3f2bdb29e23@virtuozzo.com
Changes in v5:
- Patch 2: report non-host VE changes, also treat VEx -> VE0 and VEx -> VEy
differently. VEx -> VE0 might be allowed, VEx -> VEy - never.
Replaced most WARN_ON with normal warnings or WARN_ON_ONCE.
- Patch 3: updated commit name.
- Patch 5: allow VEx -> VE0 case. Now creds are switched without VE.
- Link to v4: http://lore.virtuozzo.com/20261109-ovl-use-orig-ve-v4-0-88e65484dc5b@virtuozzo.com
Changes in v4:
- Patch 2: clean non-NULL overrided_ve in fork and report it,
Report revert_ve(ERR_PTR) usages and reject them.
- Patch 5: changed ovl_override_creds signature so it returns
error. Added checks for it in all places to avoid.
- Link to v3: http://lore.virtuozzo.com/20261103-ovl-use-orig-ve-v3-0-add042cdd087@virtuozzo.com
Changes in v3:
- Patch 2: added a separate field for ve_override to fix problems Pasha spotted.
- Patch 3: new one, delays init_cred destroy so dead CT can still use it.
- Link to v2: http://lore.virtuozzo.com/20261026-ovl-use-orig-ve-v2-0-eab58bfc29ca@virtuozzo.com
Changes in v2:
- Patch 1: updated description as Sashiko suggested..
- Patch 2: moved stubs outside CONFIG_X86 section,
added task_lock protection in helpers. Verified via lockdep,
no splats after vzctl tests, C/R and crash reproducer.
- Patch 4: fixed typo in comment.
- Link to v1: http://lore.virtuozzo.com/20261022-ovl-use-orig-ve-v1-0-da84c00c8065@virtuozzo.com
---
Vladimir Riabchun (6):
ve: Remove STOPPED state
ve: Introduce override_ve/revert_ve helpers
ve: Defer ve creds drop until ve is completely destroyed
ovl: Keep creator VE in overlayfs superblock
ovl: Fix leaking fd references in ovl_copyfile
ve/overlayfs: Override VE together with creds
fs/overlayfs/copy_up.c | 6 ++--
fs/overlayfs/dir.c | 59 ++++++++++++++++++------------
fs/overlayfs/file.c | 74 +++++++++++++++++++++++---------------
fs/overlayfs/inode.c | 94 +++++++++++++++++++++++++++++++-----------------
fs/overlayfs/namei.c | 39 +++++++++++++-------
fs/overlayfs/overlayfs.h | 10 +++++-
fs/overlayfs/ovl_entry.h | 1 +
fs/overlayfs/params.c | 3 ++
fs/overlayfs/readdir.c | 36 ++++++++++++-------
fs/overlayfs/super.c | 3 ++
fs/overlayfs/util.c | 53 ++++++++++++++++++++++-----
fs/overlayfs/xattrs.c | 35 +++++++++++-------
include/linux/sched.h | 1 +
include/linux/ve.h | 33 +++++++++++++++--
kernel/capability.c | 10 +++---
kernel/fork.c | 2 ++
kernel/ve/ve.c | 10 +++---
net/netlink/af_netlink.c | 2 +-
18 files changed, 325 insertions(+), 146 deletions(-)
---
base-commit: d816dd0e4cdc45208ba0c488d295c5b2f943e079
change-id: 20260918-ovl-use-orig-ve-2dc365976202
Best regards,
--
Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-11-16 19:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:20 Vladimir Riabchun [this message]
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
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=20261116-ovl-use-orig-ve-v8-0-dfe427bfd902@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 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.