lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c7f0902c324dc85fe42313300efd42a73dc68632.camel@suse.com>
Date: Fri, 17 Oct 2025 09:12:11 -0300
From: Marcos Paulo de Souza <mpdesouza@...e.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Steven Rostedt	
 <rostedt@...dmis.org>, John Ogness <john.ogness@...utronix.de>, Sergey
 Senozhatsky <senozhatsky@...omium.org>, Jason Wessel
 <jason.wessel@...driver.com>, Daniel Thompson	 <danielt@...nel.org>,
 Douglas Anderson <dianders@...omium.org>, 	linux-kernel@...r.kernel.org,
 kgdb-bugreport@...ts.sourceforge.net
Subject: Re: [PATCH v6 0/5] Handle NBCON consoles on KDB

On Fri, 2025-10-17 at 13:34 +0200, Petr Mladek wrote:
> On Thu 2025-10-16 11:47:53, Marcos Paulo de Souza wrote:
> > In v6 the patches were rebased on top of v6.18-rc1, added Reviewed-
> > by tags from
> > John and did some small changes suggested by him as well.
> > 
> > As usual, how I tested the changes:
> > 
> > Testing
> > -------
> > 
> > I did the tests using qemu and reapplying commit f79b163c4231
> > ('Revert "serial: 8250: Switch to nbcon console"') created
> > originally by
> > John, just to exercise the common 8250 serial from qemu. The commit
> > can
> > be checked on [1]. I had to solve some conflicts since the code has
> > been
> > reworked after the commit was reverted.
> > 
> > Then I would create three different serial entries on qemu:
> > -serial mon:stdio -serial pty -serial pty
> > 
> > And for the kernel command line I added:
> > earlyprintk=serial,ttyS2 console=ttyS2 console=ttyS1 console=ttyS1
> > kgdboc=ttyS1,115200
> > 
> > Without the last patch on this patchset, when KDB is triggered, the
> > mirroring
> > only worked on the earlyprintk console, since it's using the legacy
> > console.
> > 
> > With the last patch applied, KDB mirroring works on legacy and
> > nbcon
> > console. For debugging I added some messages to be printed by KDB,
> > showing
> > also the console->name and console->index, and I was able to see
> > both
> > ->write and ->write_atomic being called, and it all working
> > together.
> > 
> > [1]:
> > https://github.com/marcosps/linux/commit/618bd49f8533db85d9c322f9ad1cb0da22aca9ee
> > [2]:
> > https://lore.kernel.org/lkml/20250825022947.1596226-1-wangjinchao600@gmail.com/
> > 
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.com>
> > ---
> > Changes in v6:
> > - Rebased on top opf v6.18-rc1
> > - Changed some includes, as suggedted by John
> > - Reworked comments as suggested by John
> > 
> > Changes in v5:
> > - Added review tags from Petr
> > - Changes the way we detect if a CPU is running KDB.
> > - Link to v4:
> > https://lore.kernel.org/r/20250915-nbcon-kgdboc-v4-0-e2b6753bb566@suse.com
> > 
> > Changes in v4:
> > - Added ifdefs to only check for KGDB if KGDB was enabled,
> > suggested by John Ogness
> > - Updated comments about KDB on acquire_direct, suggested by Petr
> > and John
> > - Added a new patch to export nbcon_write_context_set_buf,
> > suggested by Petr and John
> > - Link to v3:
> > https://lore.kernel.org/r/20250902-nbcon-kgdboc-v3-0-cd30a8106f1c@suse.com
> > 
> > Changes in v3:
> > - Only call nbcon_context_release if nbcon_context_exit_unsafe
> > returns true (John Ogness)
> > - Dropped the prototype of console_is_usable from
> > kernel/printk/internal. (Petr Mladek)
> > - Add comments to the new functions introduced (Petr Mladek)
> > - Flush KDB console on nbcon_kdb_release (Petr Mladek)
> > - Add an exception for KDB on nbcon_context_try_acquire_direct
> > (John Ogness and Petr Mladek)
> > - Link to v2:
> > https://lore.kernel.org/r/20250811-nbcon-kgdboc-v2-0-c7c72bcdeaf6@suse.com
> > 
> > Changes in v2:
> > - Set by mistake ..
> > - Link to v1:
> > https://lore.kernel.org/r/20250713-nbcon-kgdboc-v1-0-51eccd9247a8@suse.com
> > 
> > ---
> > Marcos Paulo de Souza (5):
> >       printk: nbcon: Export console_is_usable
> >       printk: nbcon: Introduce KDB helpers
> >       printk: nbcon: Allow KDB to acquire the NBCON context
> >       printk: nbcon: Export nbcon_write_context_set_buf
> >       kdb: Adapt kdb_msg_write to work with NBCON consoles
> > 
> >  include/linux/console.h   | 55
> > ++++++++++++++++++++++++++++++++++++
> >  include/linux/kdb.h       | 16 +++++++++++
> >  kernel/debug/kdb/kdb_io.c | 47 +++++++++++++++++++++----------
> >  kernel/printk/internal.h  | 45 ------------------------------
> >  kernel/printk/nbcon.c     | 71
> > +++++++++++++++++++++++++++++++++++++++++++++--
> >  5 files changed, 171 insertions(+), 63 deletions(-)
> 
> With the two below compilation fixes, the series seems to be ready
> for
> linux-next.
> 
> I am going to wait with pushing a week or so to give other printk and
> kdb maintainers and reviewers a chance to look at it.
> 
> The following two changes are needed to fix build with
> CONFIG_PRINTK and/or CONFIG_KGDB_KDB disabled. I am going
> to do the in the respective patches when committing:
> 
> diff --git a/include/linux/console.h b/include/linux/console.h
> index 81d2c247c01f..690a5f698a5c 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -664,7 +664,7 @@ static inline bool nbcon_exit_unsafe(struct
> nbcon_write_context *wctxt) { return
>  static inline void nbcon_reacquire_nobuf(struct nbcon_write_context
> *wctxt) { }
>  static inline bool nbcon_kdb_try_acquire(struct console *con,
>  					 struct nbcon_write_context
> *wctxt) { return false; }
> -static inline void nbcon_kdb_release(struct console *con) { }
> +static inline void nbcon_kdb_release(struct nbcon_write_context
> *wctxt) { }
>  static inline bool console_is_usable(struct console *con, short
> flags,
>  				     bool use_atomic) { return
> false; }
>  #endif
> diff --git a/include/linux/kdb.h b/include/linux/kdb.h
> index db9d73b12a1a..741c58e86431 100644
> --- a/include/linux/kdb.h
> +++ b/include/linux/kdb.h
> @@ -226,7 +226,7 @@ static inline void kdb_init(int level) {}
>  static inline int kdb_register(kdbtab_t *cmd) { return 0; }
>  static inline void kdb_unregister(kdbtab_t *cmd) {}
>  
> -static inline bool kdb_printf_on_this_cpu(void) { return false };
> +static inline bool kdb_printf_on_this_cpu(void) { return false; }
>  
>  #endif	/* CONFIG_KGDB_KDB */
>  enum {
> 
> 

Ouch... thanks a lot Petr for fixing my mistakes here. I should have
disabled the configs to double check these counterparts.

> Best Regards,
> Petr
> 
> 
> 
> 
> > ---
> > base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> > change-id: 20250713-nbcon-kgdboc-efcfc37fde46
> > 
> > Best regards,
> > --  
> > Marcos Paulo de Souza <mpdesouza@...e.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ