Re: [PATCH printk 3/6] printk: Evaluate flush policy in nbcon_allow_unsafe_takeover()

From: Breno Leitao

Date: Mon Nov 09 2026 - 11:54:10 EST


On Mon, Nov 09, 2026 at 03:34:32PM +0106, John Ogness wrote:
> On 2026-11-09, Breno Leitao <leitao@xxxxxxxxxx> wrote:
> > 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?

Sure, I was playing with different scenarios, and this was done with a
test module that forces the takeover:

1) Acquire netcon_ext with nbcon_device_try_acquire(), so the console
is owned at NORMAL priority and in an unsafe state

2) mdelay() for a few seconds without releasing it (simulating
a possible netpoll busy TX queue -- or some other networkdelay)

3) echo b > /proc/sysrq-trigger from another CPU

--breno