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: <YJjuRV57eO3Pp/bp@google.com>
Date:   Mon, 10 May 2021 17:26:45 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Luo Jiaxing <luojiaxing@...wei.com>,
        sergey.senozhatsky@...il.com, rostedt@...dmis.org,
        john.ogness@...utronix.de, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com, bobo.shaobowang@...wei.com
Subject: Re: [PATCH] printk: stop spining waiter when console resume to flush
 prb

On (21/05/07 18:36), Petr Mladek wrote:
> > console_unlock()
> > {
> > 	...
> > 
> > 	if (printed_messages > limit && !console_lock_spinning_disable_and_check()) {
> > 		printk_safe_exit_irqrestore(flags);
> > 
> > 		console_locked = 0;
> > 		up_console_sem();
> > 
> > 		defer_console_output();
> > 		return;
> > 	}
> > 
> > 	...
> > }
> 
> No, please, no.
> 

Well, the alternative patch set just gives everyone an API that selectively
downgrades printk() to pre-console_sem_owner age: when console_unlock()
would never handover the printing duty. It'll take no time until this
function will pop up somewhere where we don't want it to be used.

E.g.

	rcu_read_lock();
	...
	console_unlock_preemptible();
	...
	rcu_read_unlock();

lockdep_assert_preemption_enabled() is not entirely reliable - it
depends on __lockdep_enabled, provided that system in question has
CONFIG_PROVE_LOCKING set.

> Not to say, that defer_console_output() would trigger IRQ on the same
> CPU again and again.

You mean only on archs that have arch_irq_work_raise()?

It queues the work IF we have pending messages AND there are NO active
console_sem waiters spinning on consolse_sem waiting for us to handover
the printing duty. And IRQ shall write to consoles only N messages out
of possibly M pending messages (M > N). N, obviously, should be small,
e.g. 42 lines: if after 42 printed lines we didn't handover printing
to another context then - queue another IRQ work and iret. But it keeps
the console_owner mechanism enabled.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ