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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171012113949.kb7xhrk6u27fqdc7@hirez.programming.kicks-ass.net>
Date:   Thu, 12 Oct 2017 13:39:49 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Petr Mladek <pmladek@...e.com>
Cc:     sergey.senozhatsky@...il.com, linux-kernel@...r.kernel.org,
        rostedt@...dmis.org, mingo@...nel.org, tglx@...utronix.de
Subject: Re: [PATCH 2/3] early_printk: Add force_early_printk kernel parameter

On Thu, Oct 12, 2017 at 12:24:19PM +0200, Petr Mladek wrote:
> On Thu 2017-09-28 14:18:25, Peter Zijlstra wrote:

> > +#ifdef CONFIG_EARLY_PRINTK
> > +struct console *early_console;
> > +
> > +static bool __read_mostly force_early_printk;
> > +
> > +static int __init force_early_printk_setup(char *str)
> > +{
> > +	force_early_printk = true;
> > +	return 0;
> > +}
> > +early_param("force_early_printk", force_early_printk_setup);
> 
> The parameter is currently used only when CONFIG_PRINTK is enabled.
> But CONFIG_EARLY_PRINTK is independent. What would be your preferred
> behavior when CONFIG_PRINTK is disabled, please?

Can we even have !PRINTK && EARLY_PRINTK? If so it seems to me continued
usage of early_printk() is what makes most sense.

> > @@ -1816,6 +1852,11 @@ asmlinkage int vprintk_emit(int facility
> >  		return vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
> >  #endif
> >  
> > +#ifdef CONFIG_EARLY_PRINTK
> > +	if (force_early_printk && early_console)
> > +		return early_vprintk(fmt, args);
> > +#endif
> > +
> >  	if (level == LOGLEVEL_SCHED) {
> >  		level = LOGLEVEL_DEFAULT;
> >  		in_sched = true;
> > @@ -1939,7 +1980,12 @@ asmlinkage __visible int printk(const ch
> >  	int r;
> >  
> >  	va_start(args, fmt);
> > -	r = vprintk_func(fmt, args);
> > +#ifdef CONFIG_EARLY_PRINTK
> > +	if (force_early_printk && early_console)
> > +		r = vprintk_default(fmt, args);
> > +	else
> > +#endif
> > +		r = vprintk_func(fmt, args);
> 
> There is rather theoretical race. We skip vprintk_func() because
> we believe that vprintk_default()/vprintk_emit() would choose
> handle this by early_printk().

Do you mean if someone were to toggle force_early_printk at runtime?

The reason I did it like this and not use that function pointer thing is
that I didn't want to risk anybody hijacking my output ever.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ