From: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Subject: [Devel] [PATCH VZ10 v2 0/4] connector: do not lose exit events for in-CT listeners
Date: Tue, 18 Aug 2026 15:10:18 +0000 [thread overview]
Message-ID: <20260818-connectors-v2-0-88c5d9049e6f@virtuozzo.com> (raw)
The proc connector reports the exit event after exit_notify(), so the
parent may already have reaped the exiting task. release_task() ->
exit_ve_namespace() then resets tsk->task_ve to ve0, and if that wins
the race the event is delivered to the host listeners only. A listener
inside the container never sees the exit event. LTP catches this as the
flaky cn_pec exit-test failure causing the test to hang for as long as 8
hours on GCOV kernels.
Patch 4 fixes this by pinning the task's VE for the exit notification
before exit_notify(). This means the delivery path can now run against
a VE whose last task is already reaped, i.e. concurrently with the
per-VE connector teardown, which was impossible before. Patches 1-3
prepare for that: annotate ve->cn with __rcu, free the per-VE connector
state only after an RCU grace period, and deliver per-VE events under
rcu_read_lock().
Testing:
KASAN, PROVE_LOCKING/PROVE_RCU, DEBUG_OBJECTS, kmemleak=on; HCI VM with one
container):
- LTP cn_pec inside a CT: unpatched kernel loses exit events in 3 of
10 runs (-n 50); patched kernel passes 30 of 30 runs.
- Teardown stress: 15 cycles of an active in-CT pec_listener plus a
200-process exit storm with vzctl stop/start while events are in
flight: no KASAN/lockdep/RCU splats, kmemleak scans report 0
unreferenced objects.
https://virtuozzo.atlassian.net/browse/VSTOR-140421
---
Changes in v2:
- Turned the single patch into a series: with the exit event now
delivered for a possibly already-reaped task, the per-VE delivery
path can race with the connector teardown in cn_fini_ve(). New
patches 1-3 make that safe: annotate ve->cn with __rcu, free the
per-VE connector state only after an RCU grace period, and run the
delivery under rcu_read_lock().
- cn_proc.h: forward-declare struct ve_struct instead of including
linux/ve.h.
- Link to v1: https://lists.openvz.org/pipermail/devel/2026-August/084581.html
---
Vasileios Almpanis (4):
connector: annotate ve->cn with __rcu
connector: free the per-VE connector state after an RCU grace period
connector: deliver per-VE proc events under an RCU read lock
proc connector: pin task VE for the exit event notification
drivers/connector/cn_proc.c | 105 ++++++++++++++++++++++++++++++++++--------
drivers/connector/connector.c | 47 +++++++++++++------
include/linux/cn_proc.h | 8 +++-
include/linux/ve.h | 2 +-
kernel/exit.c | 5 +-
5 files changed, 131 insertions(+), 36 deletions(-)
---
base-commit: 209f11f2c454a88761fb8f0a820fa22b6feae720
change-id: 20260813-connectors-3571be4ae57b
--
Best regards, Vasileios Almpanis
Software Developer, Virtuozzo.
next reply other threads:[~2026-08-18 15:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 15:10 Vasileios Almpanis [this message]
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 1/4] connector: annotate ve->cn with __rcu Vasileios Almpanis
2026-08-25 11:58 ` Konstantin Khorenko
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 2/4] connector: free the per-VE connector state after an RCU grace period Vasileios Almpanis
2026-08-25 11:47 ` Konstantin Khorenko
2026-08-25 12:43 ` Vasileios Almpanis
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 3/4] connector: deliver per-VE proc events under an RCU read lock Vasileios Almpanis
2026-08-18 15:10 ` [Devel] [PATCH VZ10 v2 4/4] proc connector: pin task VE for the exit event notification Vasileios Almpanis
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=20260818-connectors-v2-0-88c5d9049e6f@virtuozzo.com \
--to=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