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: <20140311140322.GA24065@dhcp-26-207.brq.redhat.com>
Date:	Tue, 11 Mar 2014 15:03:23 +0100
From:	Alexander Gordeev <agordeev@...hat.com>
To:	Ming Lei <tom.leiming@...il.com>
Cc:	Kent Overstreet <kmo@...erainc.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jens Axboe <axboe@...nel.dk>,
	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
Subject: Re: [PATCH RESEND 1/3] percpu_ida: Fix data race on cpus_have_tags
 cpumask

On Sun, Mar 02, 2014 at 10:42:05PM +0800, Ming Lei wrote:
> >> @@ -237,8 +242,11 @@ void percpu_ida_free(struct percpu_ida *pool, unsigned tag)
> >>       spin_unlock(&tags->lock);
> >>
> >>       if (nr_free == 1) {
> >> -             cpumask_set_cpu(smp_processor_id(),
> >> -                             &pool->cpus_have_tags);
> >> +             cpumask_set_cpu(smp_processor_id(), &pool->cpus_have_tags);
> >> +             /*
> >> +              * Pairs with smp_rmb() in steal_tags()
> >> +              */
> >> +             smp_wmb();
> >>               wake_up(&pool->wait);
> >
> > I think I'm nacking this - there's a lot of code in the kernel that relies on
> > the fact that prepare_to_wait)/wake_up() do the appropriate fences, we really
> > shouldn't be adding to the barriers those do.
> 
> In theory, it still might cause percpu_ida_alloc(TASK_RUNNING) failed,
> looks it isn't a big deal for the case.
> 
> But I am wondering why cpumask_set_cpu() isn't called with
> holding lock inside percpu_ida_free()? Looks 'nr_free == 1'
> shouldn't have happened frequently.

Because bouncing on the lock is more expensive than occasionally putting
a thread into sleep.

> 
> 
> Thanks,
> -- 
> Ming Lei

-- 
Regards,
Alexander Gordeev
agordeev@...hat.com
--
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