From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH VZ10 v9 7/8] ve/printk: Don't use ve log outside task context
Date: Tue, 22 Sep 2026 13:21:39 +0200 [thread overview]
Message-ID: <9a563900-c9c3-450e-8d34-66d7b1d16ac5@virtuozzo.com> (raw)
In-Reply-To: <156a2b6228d80112485c33b8384acf55b998a9a2.1789491989.git.vladimir.riabchun@virtuozzo.com>
Please, don't take it with this series.
The problem exists without the patches and we'd better add
a proper fix in a separate series under the task VSTOR-146839.
On 9/15/26 19:22, Vladimir Riabchun wrote:
> get_exec_env() in interrupt context will return VE of the process
> that was interrupted.
> We don't want to leak logs to unrelated containers if we use
> ve_printk in a function that may be called in an interrupt.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-135520
> Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
> ---
> kernel/printk/printk.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 8940b36e790b..90ecd7960800 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -560,7 +560,8 @@ struct log_state *ve_log_state(void)
> {
> struct log_state *log = &init_log_state;
> #ifdef CONFIG_VE
> - if (get_exec_env()->log_state)
> + /* get_exec_env() is not reliable outside task context */
> + if (get_exec_env()->log_state && in_task())
> log = get_exec_env()->log_state;
> #endif
> return log;
> @@ -2538,7 +2539,7 @@ static asmlinkage int ve_vprintk(int dst, const char *fmt, va_list args)
> va_copy(args2, args);
> if (ve_is_super(get_exec_env()) || (dst & VE0_LOG))
> r = vprintk(fmt, args);
> - if (!ve_is_super(get_exec_env()) && (dst & VE_LOG))
> + if (!ve_is_super(get_exec_env()) && (dst & VE_LOG) && in_task())
> r = ve_vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, fmt, args2);
> va_end(args2);
>
> @@ -2570,7 +2571,7 @@ static asmlinkage int ve_vprintk_deferred(int dst, const char *fmt, va_list args
> va_copy(args2, args);
> if (ve_is_super(get_exec_env()) || (dst & VE0_LOG))
> r = vprintk_emit(0, LOGLEVEL_SCHED, NULL, fmt, args);
> - if (!ve_is_super(get_exec_env()) && (dst & VE_LOG))
> + if (!ve_is_super(get_exec_env()) && (dst & VE_LOG) && in_task())
> r = ve_vprintk_emit(0, LOGLEVEL_SCHED, NULL, fmt, args2);
> va_end(args2);
>
--
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-09-22 11:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 17:22 [Devel] [PATCH VZ10 v9 0/8] Add per-VE failcount support Vladimir Riabchun
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 1/8] ve/ve.{h, c}: Farewell to spaces as indents Vladimir Riabchun
2026-09-25 15:55 ` Konstantin Khorenko
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 2/8] ve/fs: Rework per-ve mount count Vladimir Riabchun
2026-09-18 13:22 ` Vladimir Riabchun
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 3/8] selftests/ve: Update ve_ns_owner_test Vladimir Riabchun
2026-09-18 13:28 ` Vladimir Riabchun
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 4/8] ve: Move from global VE mounts limit to per-VE limit Vladimir Riabchun
2026-09-18 14:29 ` Vladimir Riabchun
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 5/8] ve/ve.c: Generate VE resource accessors using macros Vladimir Riabchun
2026-09-18 14:36 ` Vladimir Riabchun
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 6/8] ve: Introduce per-VE failcount Vladimir Riabchun
2026-09-18 14:42 ` Vladimir Riabchun
2026-09-25 16:02 ` Konstantin Khorenko
2026-09-25 16:08 ` Konstantin Khorenko
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 7/8] ve/printk: Don't use ve log outside task context Vladimir Riabchun
2026-09-18 14:50 ` Vladimir Riabchun
2026-09-22 11:21 ` Vladimir Riabchun [this message]
2026-09-25 16:02 ` Konstantin Khorenko
2026-09-15 17:22 ` [Devel] [PATCH VZ10 v9 8/8] selftests/ve: Add mount accounting selftest Vladimir Riabchun
2026-09-18 15:06 ` Vladimir Riabchun
2026-09-25 16:04 ` Konstantin Khorenko
2026-09-16 12:30 ` [Devel] [PATCH VZ10 v9 0/8] Add per-VE failcount support Vasileios Almpanis
2026-09-16 17:30 ` Konstantin Khorenko
2026-09-18 15:07 ` Vladimir Riabchun
2026-09-18 16:02 ` Vladimir Riabchun
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=9a563900-c9c3-450e-8d34-66d7b1d16ac5@virtuozzo.com \
--to=vladimir.riabchun@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@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