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]
Date:	Thu, 18 Jun 2009 23:58:07 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Chris Friesen <cfriesen@...tel.com>
Cc:	linux-kernel@...r.kernel.org, Chris Adams <cmadams@...aay.net>,
	510478@...s.debian.org, Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH] v2 Re: Bug: Status/Summary of slashdot leap-second
 crash on new years 2008-2009

On Thu, 2009-06-18 at 16:34 -0600, Chris Friesen wrote:
> Ben Hutchings wrote:
> > On Sat, 2009-01-03 at 12:01 -0600, Chris Adams wrote:
> >> Once upon a time, Duane Griffin <duaneg@...da.com> said:
> >>> How about instead of a switch statement, assigning the message to a
> >>> variable and printing that. I.e. something like:
> >> Good point.  Here's an updated version that also adds a comment to the
> >> xtime_lock definition about not using printk.
> >> -- 
> >> Chris Adams <cmadams@...aay.net>
> >> Systems and Network Administrator - HiWAAY Internet Services
> >> I don't speak for anybody but myself - that's enough trouble.
> >>
> >>
> >> From: Chris Adams <cmadams@...aay.net>
> >>
> >> The code to handle leap seconds printks an information message when the
> >> second is inserted or deleted.  It does this while holding xtime_lock.
> >> However, printk wakes up klogd, and in some cases, the scheduler tries
> >> to get the current kernel time, trying to get xtime_lock (which results
> >> in a deadlock).  This moved the printks outside of the lock.  It also
> >> adds a comment to not use printk while holding xtime_lock.
> > [...]
> > 
> > This patch doesn't seem to have gone anywhere.  Was this bug fixed in
> > some other way or has it been forgotten?
> 
> I'm interested in this as well...the current code still issues a
> printk() while holding the xtime_lock for writing.  Is this allowed or not?

Having investigated further, I believe it has been safe since this
change made in 2.6.27 (which cleverly preempted the new year):

commit b845b517b5e3706a3729f6ea83b88ab85f0725b0
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Date:   Fri Aug 8 21:47:09 2008 +0200

    printk: robustify printk
    
    Avoid deadlocks against rq->lock and xtime_lock by deferring the klogd
    wakeup by polling from the timer tick.
    
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
    Signed-off-by: Ingo Molnar <mingo@...e.hu>

> In addition, is it allowed for older kernels also or is Chris Adams'
> patch something that should get picked up for the 2.6.27 stable series?

Anything older than 2.6.27 appears to need a change along the lines of
the above-mentioned commit or Chris's patch.  Note that this was not the
only case where printk() could be called under xtime_lock.  For example,
in arch/alpha/kernel/time.c timer_interrupt() calls set_rtc_mmss() which
can call printk().

Ben.

-- 
Ben Hutchings
The generation of random numbers is too important to be left to chance.
                                                            - Robert Coveyou

Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ