Re: git: 4358928e235c - main - amd64 loader: plug hard hang with serial console enabled

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Mon, 03 Apr 2023 19:55:13 UTC
  Gary,

On Sat, Apr 01, 2023 at 09:38:48AM +0000, Gary Jennejohn wrote:
G> > URL: https://cgit.FreeBSD.org/src/commit/?id=4358928e235c1e188ad6b4650d78bcceb225b909
G> >
G> > commit 4358928e235c1e188ad6b4650d78bcceb225b909
G> > Author:     Gleb Smirnoff <glebius@FreeBSD.org>
G> > AuthorDate: 2023-03-31 18:19:25 +0000
G> > Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
G> > CommitDate: 2023-03-31 18:19:25 +0000
G> >
G> >     amd64 loader: plug hard hang with serial console enabled
G> >
G> >     The hang basically bricks a physical box and it can be recovered
G> >     only if you are able to boot from alternate media.  This isn't a
G> >     perfect fix, but throw it in before loader experts decide on
G> >     proper one.
G> >
G> >     Submitted by:   whu
G> >     Fixes:          927358dd98cb902160093e0dc0bac002d6b43858
G> > ---
G> >  stand/efi/loader/efiserialio.c | 2 ++
G> >  1 file changed, 2 insertions(+)
G> >
G> > diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efiserialio.c
G> > index 5fbc700f6ac2..0f37ef8b87dd 100644
G> > --- a/stand/efi/loader/efiserialio.c
G> > +++ b/stand/efi/loader/efiserialio.c
G> > @@ -265,6 +265,8 @@ comc_probe(struct console *sc)
G> >  	 */
G> >  	env = getenv("smbios.bios.version");
G> >  	if (env == NULL || strncmp(env, "Hyper-V", 7) != 0) {
G> > +		/* Disable being seen as "comconsole". */
G> > +		comconsole.c_name = "efiserialio";
G> >  		return;
G> >  	}
G> >  #endif
G> >
G> 
G> What if env is NULL?  Shouldn't the code return without changing anything?
G> Seems to me that this if() should be split into two if() clauses.

You are absolutely right. The code looks concerning to me, too.

However, this is just a quick plug of a real bad problem, a quick
short term solution.  Soon Warner and other boot loader expers will
come up with proper fix of 927358dd98cb902160093e0dc0bac002d6b43858.

-- 
Gleb Smirnoff