mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Breno Leitao <leitao@debian.org>
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	printk@lists.linux.dev, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH printk 3/6] printk: Evaluate flush policy in nbcon_allow_unsafe_takeover()
Date: Mon, 09 Nov 2026 15:34:32 +0106	[thread overview]
Message-ID: <87qzgunkof.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <avHTDeox8nDGLC6Q@gmail.com>

On 2026-11-09, Breno Leitao <leitao@debian.org> wrote:
>> @@ -1572,7 +1608,12 @@ static int __nbcon_atomic_flush_pending_con(struct console *con, enum pr_flush_r
>>  	ctxt->console			= con;
>>  	ctxt->spinwait_max_us		= 2000;
>>  	ctxt->prio			= nbcon_get_default_prio();
>> -	ctxt->allow_unsafe_takeover	= nbcon_allow_unsafe_takeover();
>> +	ctxt->allow_unsafe_takeover	= nbcon_allow_unsafe_takeover(con, reason);
>
>
> Thanks for the series, I've tried it here, and I got:

Thanks for testing.

>   sysrq: Resetting
>     ------------[ cut here ]------------
>     WARNING: kernel/printk/nbcon.c:561 at nbcon_context_try_acquire+0x72c/0x790, CPU#0: sh/212
>     Modules linked in: nbcon_hold(OE+)
>     CPU: 0 UID: 0 PID: 212 Comm: sh Tainted: G           OE       7.4.0-rc1-next-20261105upstream-00006-g4170adac69fb #1 PREEMPT(full)
>     Hardware name: linux,dummy-virt (DT)
>     pc : nbcon_context_try_acquire+0x72c/0x790
>     lr : nbcon_context_try_acquire+0x508/0x790
>     ...
>     Call trace:
>      nbcon_context_try_acquire+0x72c/0x790 (P)
>      __nbcon_atomic_flush_pending_con+0x1c0/0x358
>      nbcon_atomic_flush_pending+0x224/0x390
>      printk_trigger_flush+0x50/0x1c8
>      emergency_restart+0x54/0x98
>      sysrq_handle_reboot+0x5c/0x88
>      __handle_sysrq+0x298/0x3c0
>      write_sysrq_trigger+0x178/0x1d0
>      proc_reg_write+0x148/0x270
>      vfs_write+0x1d4/0x7c8
>      ksys_write+0xbc/0x168
>      __arm64_sys_write+0x88/0xa8
>      invoke_syscall+0x74/0x188
>      do_el0_svc+0x108/0x190
>      el0_svc+0x60/0x1d8
>      el0t_64_sync_handler+0x68/0xe0
>      el0t_64_sync+0x198/0x1a0
>
> That is coming from:
>
>    550 static int nbcon_context_try_acquire_hostile(struct nbcon_context *ctxt,
>    551                                              struct nbcon_state *cur)
>    552 {
>    553         unsigned int cpu = smp_processor_id();
>    554         struct console *con = ctxt->console;
>    555         struct nbcon_state new;
>    556
>    557         if (!ctxt->allow_unsafe_takeover)
>    558                 return -EPERM;
>    559
>    560         /* Ensure caller is allowed to perform unsafe hostile takeovers. */
>    561         if (WARN_ON_ONCE(ctxt->prio != NBCON_PRIO_PANIC))
>    562                 return -EPERM;

Wow, you managed to get a hostile takeover. Out of curiousity, do you
know how dangerous this really is? Can this basically just result in
garbage on the network? Or is there dangers of running into the forest
with NULL or garbage pointers? And is the danger acceptable?

@pmladek: I expect we just need to remove the WARN_ON_ONCE() since this
series introduces unsafe takeovers when not in panic. Do you agree?

John

  reply	other threads:[~2026-11-09 14:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 12:31 [PATCH printk 0/6] Introduce policies for unsafe flushing John Ogness
2026-11-09 12:31 ` [PATCH printk 1/6] printk: Introduce and specify flush reasons John Ogness
2026-11-09 12:31 ` [PATCH printk 2/6] console: Introduce unsafe flush policy flags John Ogness
2026-11-09 12:31 ` [PATCH printk 3/6] printk: Evaluate flush policy in nbcon_allow_unsafe_takeover() John Ogness
2026-11-09 14:08   ` Breno Leitao
2026-11-09 14:28     ` John Ogness [this message]
2026-11-09 12:31 ` [PATCH printk 4/6] printk: Remove nbcon_atomic_flush_unsafe() John Ogness
2026-11-09 12:31 ` [PATCH printk 5/6] printk: Add panic+kexec flush point John Ogness
2026-11-09 12:31 ` [PATCH printk 6/6] netconsole: Always perform unsafe flushing on panic/kdb/restart John Ogness

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=87qzgunkof.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=printk@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=ryan.roberts@arm.com \
    --cc=senozhatsky@chromium.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

all inboxes | Powered by JetHome®