From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754121AbbHJIQI (ORCPT ); Mon, 10 Aug 2015 04:16:08 -0400 Received: from casper.infradead.org ([85.118.1.10]:36215 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753382AbbHJIQC (ORCPT ); Mon, 10 Aug 2015 04:16:02 -0400 Date: Mon, 10 Aug 2015 10:15:52 +0200 From: Peter Zijlstra To: Manfred Spraul Cc: Andrew Morton , LKML , 1vier1@web.de, Oleg Nesterov , "Paul E. McKenney" , Kirill Tkhai , Ingo Molnar , Josh Poimboeuf , stable@vger.kernel.org Subject: Re: [PATCH] ipc/sem.c: Update/correct memory barriers Message-ID: <20150810081552.GV16853@twins.programming.kicks-ass.net> References: <1439142939-2605-1-git-send-email-manfred@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439142939-2605-1-git-send-email-manfred@colorfullife.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 09, 2015 at 07:55:39PM +0200, Manfred Spraul wrote: > sem_lock() did not properly pair memory barriers: > > !spin_is_locked() and spin_unlock_wait() are both only control barriers. > The code needs an acquire barrier, otherwise the cpu might perform > read operations before the lock test. > As no primitive exists inside and since it seems > noone wants another primitive, the code creates a local primitive within > ipc/sem.c. > > With regards to -stable: > The change of sem_wait_array() is a bugfix, the change to sem_lock() > is a nop (just a preprocessor redefinition to improve the readability). > The bugfix is necessary for all kernels that use sem_wait_array() > (i.e.: starting from 3.10). > > Andrew: Could you include it into your tree and forward it? > > Signed-off-by: Manfred Spraul > Reported-by: Oleg Nesterov > Cc: Acked-by: Peter Zijlstra (Intel)