[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzFuaUq352geBXcE@google.com>
Date: Mon, 26 Sep 2022 18:18:33 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: John Ogness <john.ogness@...utronix.de>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH printk 18/18] printk: Handle dropped message smarter
On (22/09/26 10:00), John Ogness wrote:
> > Oh, hmm. This does not look to me as a simplification. Quite
> > the opposite, moving cons_text_buf::text pointer to point to
> > cons_text_buf::text - strlen("... dropped messages...") looks
> > somewhat fragile.
>
> It relies on @ext_text and @text being packed together, which yes, may
> be fragile.
Right, and this assumption can be broken by both internal and external
sources: new gcc/clang plugins, config options, etc.
> As an alternative we could memcpy the message text (@text)
> to the end of the dropped message text. There would be enough room.
>
> Generally speaking, the dropped text will be less text to copy. But
> since dropped messages are rare anyway, it might be worth copying more
> data so that the code is not fragile. It would also allow us to remove
> the __no_randomize_layout in "struct cons_text_buf".
Agreed.
> If the end of cons_print_dropped was changed to:
>
> memcpy(txtbuf->ext_text + len, txtbuf->text, desc->len);
> desc->len += len;
> desc->outbuf = txtbuf->ext_text;
>
> Would that be OK for you?
Yes, this looks solid (nothing should be able to break it and cause
mem corruptions).
Powered by blists - more mailing lists