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: <alpine.LFD.2.02.1203060911000.2742@ionos>
Date:	Tue, 6 Mar 2012 09:18:53 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Steven Rostedt <rostedt@...dmis.org>
cc:	LKML <linux-kernel@...r.kernel.org>,
	RT <linux-rt-users@...r.kernel.org>,
	Clark Williams <clark@...hat.com>,
	John Kacur <jkacur@...hat.com>, Carsten Emde <cbe@...dl.org>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH RT] seqlock/rt: Prevent livelocks with seqlocks in RT

On Mon, 5 Mar 2012, Steven Rostedt wrote:

> Thomas,
> 
> I was running my cpu hotplug stress test along with a kernel compile and
> after about 40 minutes of running it locked up. It happened in the
> read_seqcount_begin() that is called by d_lookup().
> 
> ksoftirqd was caught here:
> 
> static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
> {
> 	unsigned ret;
> 
> repeat:
> 	ret = ACCESS_ONCE(sl->sequence);
> 	if (unlikely(ret & 1)) {
> 		cpu_relax();
> 		goto repeat;
> 	}
> 	smp_rmb();
> 
> 	return ret;
> }
> 
> It preempted the holder of the seqlock that was held for write, and as
> that holder had migrate disabled, it couldn't be scheduled. Then
> ksoftirqd went into this infinite loop and the system locked up.
> 
> This patch fixes the issue by grabbing and releasing the write lock when
> it detects contention. It only works with seqlocks and not seqcounts
> that have their own locking. But we could add an api to include those
> too if needed.

Errm. rt15 has 

/*
 * Starvation safe read side for RT
 */
static inline unsigned read_seqbegin(seqlock_t *sl)
{
        unsigned ret;

repeat:
        ret = sl->seqcount.sequence;
        if (unlikely(ret & 1)) {
                /*
                 * Take the lock and let the writer proceed (i.e. evtl
                 * boost it), otherwise we could loop here forever.
                 */
                spin_lock(&sl->lock);
                spin_unlock(&sl->lock);
                goto repeat;
        }
        return ret;
}
#endif

> Because read_seqlocks are used in the VDSO area, a raw_read_seqcount_begin()
> was created to allow userspace tasks to access read_seqcount().
> As the grabbing of the write_lock() is not allowed in VDSO, nor
> is even referencing it.

This is completely bogus. The VDSO update write side runs with
interrupts disabled, so it cannot be preempted at all.

> Note, a live lock can still happen if the userspace task that
> does the read_seqlock is of higher priority than a user doing
> the write_lock, so userspace needs to be careful.

What the hell are you smoking?
 
Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ