Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5825309imu; Wed, 30 Jan 2019 04:18:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN6NGQ0LG3jlEa9sCjAWB26K6FYZ1rkNXKBuDTrnTBr3nh8toZx99Wvn6H2rqYd4o+PAViXf X-Received: by 2002:a17:902:31a4:: with SMTP id x33mr29588805plb.41.1548850693677; Wed, 30 Jan 2019 04:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548850693; cv=none; d=google.com; s=arc-20160816; b=p4j9xTglA/iSENNOaS2Ot+9d+6t1VtIO9pjnKLR7sLkPP4/B2VWNTalm/SQyQCqd2v YR4Ei9oEgtELAfL9ztJDdcsm0jCZu3Z9WCdUe5h7XKMamCR+enR/k2rl1JX4eEW46xmf ETwojUYe7I21D0ENNdgo00ejj0SJAb66n2mHxIxEsLmxI8fbDcc6+fYUAoKmDLy3Nkre cslv01rfJvVcNfQi+q4GdDfHkW7vmxBbDRAFzcUzz9Dk+sjpI4dtiJIip3Sm9uvCDKwu K8pctt0ndBdlMqoytpiWsmHhSrY1MPx35GKTQmVV5FrnzU9/bXa+4rbtINMONjtV+XPN Z5Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=BFDlnVYH3h+dWm1cxtpht1cJ8h49q5t5/OMJAZq+C3o=; b=VcU7w1oE4vVf7H3in7BLSVlZkZlRftAlkT2LybuYn452f+kN4diuW7YTLmn9mm0rWB 6Et1PrTjill9ug8HpioqUX2iMUajZL2C4CpNQLQYWURkhBUGs33cM3NPQzSJlVkAYqZB +LuDMg3s2+90ZOU+saFvdo/epmthXYb+VKvpaCj49OBX5Pk6CxH6vzt+hiGPg1bE7Ezq ESNc5VhvvCpSjmd/DG4RJTG0rsyDcc05guKJhrVU2Yqu/uGdBqvNUvKxe6mRwDH/nAs3 c1nid4hf5tI4IjZXWc0Y8lT3IXilN/ZA61s6GGmv9BrHsvO2PQvXg+Tn8EIqmVZV/+zD PsmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si1314092pgt.213.2019.01.30.04.17.58; Wed, 30 Jan 2019 04:18:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730131AbfA3MPa (ORCPT + 99 others); Wed, 30 Jan 2019 07:15:30 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46878 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfA3MPa (ORCPT ); Wed, 30 Jan 2019 07:15:30 -0500 Received: from [2a01:598:b890:92b7:fc90:b8ff:fed0:1fb6] (helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1goom4-0006vD-T4; Wed, 30 Jan 2019 13:15:25 +0100 Date: Wed, 30 Jan 2019 13:15:18 +0100 (CET) From: Thomas Gleixner To: Heiko Carstens cc: Sebastian Sewior , Peter Zijlstra , Ingo Molnar , Martin Schwidefsky , LKML , linux-s390@vger.kernel.org, Stefan Liebler Subject: Re: WARN_ON_ONCE(!new_owner) within wake_futex_pi() triggered In-Reply-To: <20190130094913.GC5299@osiris> Message-ID: References: <20190128135804.GB28878@hirez.programming.kicks-ass.net> <20190129090108.GA26906@osiris> <20190129102409.GB26906@osiris> <20190129103557.GF28485@hirez.programming.kicks-ass.net> <20190129132303.GE26906@osiris> <20190129151058.GG26906@osiris> <20190129171653.ycl64psq2liy5o5c@linutronix.de> <20190130094913.GC5299@osiris> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 30 Jan 2019, Heiko Carstens wrote: > On Tue, Jan 29, 2019 at 06:16:53PM +0100, Sebastian Sewior wrote: > > if (unlikely(p->flags & PF_KTHREAD)) { > > put_task_struct(p); > > Last lines of the trace with your additional patch (full log attached): > > <...>-50539 [003] .... 2376.398223: sys_futex -> 0x0 > <...>-50539 [003] .... 2376.398223: sys_futex(uaddr: 3ffb7700208, op: 6, val: 1, utime: 0, uaddr2: 3, val3: 0) > <...>-50539 [003] .... 2376.398225: attach_to_pi_owner: Missing pid 50734 > <...>-50539 [003] .... 2376.398226: handle_exit_race: uval2 vs uval 8000c62e vs 8000c62e (-1) So the user space value is: 8000c62e. FUTEX_WAITER bit is set and the owner of the futex is PID 50734, which exited long time ago: <...>-50734 [000] .... 2376.394936: sched_process_exit: comm=ld64.so.1 pid=50734 prio=120 But at least from the kernel view 50734 has released it last: <...>-50734 [000] .... 2376.394930: sys_futex(uaddr: 3ffb7700208, op: 7, val: 3ff00000007, utime: 3ffb3ef8910, uaddr2: 3ffb3ef8910, val3: 3ffc0afe987) <...>-50539 [003] .... 2376.398223: sys_futex(uaddr: 3ffb7700208, op: 6, val: 1, utime: 0, uaddr2: 3, val3: 0) Now, if it would have acquired it in userspace again before exiting, then the robust list exit code should have set the OWNER_DIED bit as well, but that's not set.... debug patch for the robust list exit handling below. Thanks, tglx 8<----------------- --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3440,10 +3440,13 @@ static int handle_futex_death(u32 __user { u32 uval, uninitialized_var(nval), mval; + trace_printk("uaddr: %lx pi: %d\n", (unsigned long) uaddr, pi); retry: if (get_user(uval, uaddr)) return -1; + trace_printk("uaddr: %lx uval: %08x\n", (unsigned long) uaddr, uval); + if ((uval & FUTEX_TID_MASK) == task_pid_vnr(curr)) { /* * Ok, this dying thread is truly holding a futex @@ -3480,6 +3483,7 @@ static int handle_futex_death(u32 __user if (!pi && (uval & FUTEX_WAITERS)) futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY); } + trace_printk("uaddr: %lx success\n", (unsigned long) uaddr); return 0; }