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: <20200213083942.6ue3ehaaycourgfi@pathway.suse.cz>
Date:   Thu, 13 Feb 2020 09:39:42 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/3] printk: Fix preferred console selection with
 multiple matches

On Thu 2020-02-13 14:52:36, Sergey Senozhatsky wrote:
> On (20/02/06 15:02), Benjamin Herrenschmidt wrote:
> [..]
> >  static int __add_preferred_console(char *name, int idx, char *options,
> > -				   char *brl_options)
> > +				   char *brl_options, bool user_specified)
> >  {
> >  	struct console_cmdline *c;
> >  	int i;
> > @@ -2131,6 +2131,8 @@ static int __add_preferred_console(char *name, int idx, char *options,
> >  		if (strcmp(c->name, name) == 0 && c->index == idx) {
> >  			if (!brl_options)
> >  				preferred_console = i;
> > +                       if (user_specified)
> > +                               c->user_specified = true;
> >  			return 0;
> >  		}
> >  	}
> > @@ -2140,6 +2142,7 @@ static int __add_preferred_console(char *name, int idx, char *options,
> >  		preferred_console = i;
> >  	strlcpy(c->name, name, sizeof(c->name));
> >  	c->options = options;
> > +	c->user_specified = user_specified;
> >  	braille_set_options(c, brl_options);
> >  
> >  	c->index = idx;
> > @@ -2194,7 +2197,7 @@ static int __init console_setup(char *str)
> >  	idx = simple_strtoul(s, NULL, 10);
> >  	*s = 0;
> >  
> > -	__add_preferred_console(buf, idx, options, brl_options);
> > +	__add_preferred_console(buf, idx, options, brl_options, true);
> >  	console_set_on_cmdline = 1;
> >  	return 1;
> >  }
> > @@ -2215,7 +2218,7 @@ __setup("console=", console_setup);
> >   */
> >  int add_preferred_console(char *name, int idx, char *options)
> >  {
> > -	return __add_preferred_console(name, idx, options, NULL);
> > +	return __add_preferred_console(name, idx, options, NULL, false);
> >  }
> 
> A silly question:
> 
> Can the same console first be added by
> 	console_setup()->__add_preferred_console(true)
> and then by
> 	add_preferred_console()->__add_preferred_console(false)

I guess that this might happen. It should be safe because
user_specified flag is set only to true when found again,
see:

                       if (user_specified)
                               c->user_specified = true;

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ