From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932158AbbGIVqm (ORCPT ); Thu, 9 Jul 2015 17:46:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932099AbbGIVq1 (ORCPT ); Thu, 9 Jul 2015 17:46:27 -0400 Date: Thu, 9 Jul 2015 23:44:51 +0200 From: Oleg Nesterov To: Ingo Molnar , Srikar Dronamraju Cc: Andy Lutomirski , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] uprobes: fix the waitqueue_active() check in xol_free_insn_slot() Message-ID: <20150709214451.GA15021@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150709214431.GA14997@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The xol_free_insn_slot()->waitqueue_active() check is buggy. We need mb() after we set the conditon for wait_event(), or xol_take_insn_slot() can miss the wakeup. Signed-off-by: Oleg Nesterov --- kernel/events/uprobes.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 6a9c5e0..9a4f9df 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1336,6 +1336,7 @@ static void xol_free_insn_slot(struct task_struct *tsk) clear_bit(slot_nr, area->bitmap); atomic_dec(&area->slot_count); + smp_mb__after_atomic(); /* pairs with prepare_to_wait() */ if (waitqueue_active(&area->wq)) wake_up(&area->wq); -- 1.5.5.1