[Devel] [PATCH hci-8.1 v2 0/6] ve/printk: Fix logs leakage via ve_printk called from IRQ context
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Wed Oct 7 00:53:51 MSK 2026
Printk function that printed logs to containers' dmesgs mostly used
get_exec_env() for getting VE. This is fine for task contexts and
might be wrong for IRQ contexts.
This patchset fixes this in the following way:
- Report non-task usages of ve_printk function which get
VE from current task. Do it with WARN so users will be
frightened and will report it to us so we can fix it.
This will also make an issue visible to our internal tests.
- Reject printing to containers when VE is unreliable.
- Calculate correct time offsets when calling printk. It can
be delayed and the context might change, we can see time
travels if time was taken from a different container.
With these fixes failcounts can be now used in any context,
so the last failcount - neigh_tbl - is added.
This was tested by our neoltp tests on host and inside containers.
No tests crashed, so there an no obvious IRQ callers of ve_printk
functions.
https://virtuozzo.atlassian.net/browse/VSTOR-146839
Feature: ve printk
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
---
Changes in v2:
- Patch 2: fixed uninitialized r value in ve_dev_printk_emit.
- Patch 3: fixed incorrect __printf annotation for ve_printk_deferred.
- Patch 3: now on IRQ case ve_printk_ratelimited falls back to ve0.
- Patch 3: removed forgotten get_exec_env() usages from ve_printk
functions.
- Patch 4: completely reworked and simplified.
- Patch 5: fix __ve_printk_ratelimited stub.
- Patch 6: brought back table type logging to host.
- Link to v1: http://lore.virtuozzo.com/20261002-ve-printk-irq-v1-0-cb55896d455c@virtuozzo.com
---
Vladimir Riabchun (6):
ve/printk: Add sanity checks in ve_printk functions
ve/printk: Report potentially leaking usage of ve_printk functions
ve/printk: Specify ve in printks
ve/printk: Fix time virtualization
ve/failcount: Use ve_printk with specified ve
ve: add neigh_tbl failcounter
drivers/base/core.c | 8 ++-
include/linux/net.h | 16 +++---
include/linux/printk.h | 42 ++++++++++++---
include/linux/ratelimit_types.h | 6 ++-
include/linux/ve.h | 17 +++---
kernel/printk/internal.h | 4 ++
kernel/printk/printk.c | 101 ++++++++++++++++++++++++++++--------
kernel/ve/ve.c | 3 ++
lib/ratelimit.c | 7 +--
net/core/neighbour.c | 5 +-
net/core/utils.c | 4 +-
net/netfilter/nf_conntrack_core.c | 2 +-
net/netfilter/nf_conntrack_expect.c | 2 +-
net/netfilter/xt_TCPMSS.c | 4 +-
14 files changed, 162 insertions(+), 59 deletions(-)
---
base-commit: ca54f152160587a74ff17cb52feef16f7b9d4e2b
change-id: 20260923-ve-printk-irq-027c3378660f
Best regards,
--
Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
More information about the Devel
mailing list