On 2025-09-01, Petr Mladek <pmla...@suse.com> wrote: > What about the following race? > > kdb_printf_cpu = -1 (0xffffffff) > > CPU 0xff CPU 0x1 > > panic() > > printk() > nbcon_atomic_flush_pending() > nbcon_context_try_acquire_direct() > # load low byte of kdb_printf_cpu > val = 0xff > > vkdb_printf() > cmpxchg(&kdb_printf_cpu, ...) > kdb_printf_cpu == 0x1 > > # load higher byte of kdb_printf_cpu > val = 0xff > > Result: CPU 0xff would be allowed to acquire the nbcon context > because it thinks that vkdb_printf() got locked on this CPU. > > It is not fully artificial, see > https://lwn.net/Articles/793253/#Load%20Tearing > > The above race is not critical. CPU 0x1 still could wait for CPU 0xff > and acquire the nbcon context later. > > But it is something unexpected. I would feel more comfortable if > we used the READ_ONCE() and be on the safe side.
Agreed. John _______________________________________________ Kgdb-bugreport mailing list Kgdb-bugreport@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport