Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1053932ybx; Tue, 5 Nov 2019 09:32:15 -0800 (PST) X-Google-Smtp-Source: APXvYqx6wtcFm+DDZZH0jgVHzSU+SK7saN4y1OdyP19JGN4LNKpSgi1sZjcpR0C+jCsK8RoQraAD X-Received: by 2002:a50:ff19:: with SMTP id a25mr36820091edu.181.1572975135572; Tue, 05 Nov 2019 09:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572975135; cv=none; d=google.com; s=arc-20160816; b=r22zyGNR49wPQzrDk64z4vbpQuFBzjBlSsaSRZQ2K2YIW3uN8GSw9n+bx0c2azFvHF zL2jwIOXmX9WFUbSgtNoGIWX3afHloSSN2flznv2fB3cQ+0OzEeW/9w1JklRcIRMYXFN gRi9VQorZJNLQ/wiyyuY1t12QbOtdsm7fJZiZtl4Ux5nD73FPLCVxWs2R0ehi0/tG9fr npGBszI5ekjS6j8/HRDUvUW1Pq1oFAIWLL84sLSvP/uz19gu2Qwi1o+Gq+hANonNydOz QCR7MCTsK0oujAzIDY3RtI+9g0GIu7WOmbrMTiI66b5AJ9cheFahs2URMaX8+0+hLAoF 5WYQ== 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=vvMEeoMF5lnsuNpmQlziNDuu6ZJwxNeoam270/RWRsY=; b=KU1kRqj4a3CaNpxa4+GC5tME0dExJULex4+2uQoy130tY8DxcSELKDALDZK6wqCvXT jqTzgkHZGO+xb9CcG+AyEsFGC3ZKl9kVm1h8oDBHePU6D5TcFihOIBvR6AwPG2hXSqh+ xY2eyfn2R2bpco//GevyTNB/2k2ILknSHPMm5+euKMkGzLmSc9mpaLYYSFbJKKe2Tnw3 qYBwxfZR7zz2jn4VQtqHzLHuWDSMqKYYrG4a905ZziOxuYSVGis82L7DcqzZ3olL2Fic sTjeRnzWYDgGcEZFBBsNLW7kCMoIaBkw+KSk92x+C1AidQvNjfoHedpT3Ch8jkjlfJTr LSoQ== 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 k21si1020301ejc.148.2019.11.05.09.31.51; Tue, 05 Nov 2019 09:32:15 -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 S2390370AbfKER2s (ORCPT + 99 others); Tue, 5 Nov 2019 12:28:48 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42190 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388790AbfKER2r (ORCPT ); Tue, 5 Nov 2019 12:28:47 -0500 Received: from p5b06da22.dip0.t-ipconnect.de ([91.6.218.34] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iS2d8-0000fV-Q3; Tue, 05 Nov 2019 18:28:35 +0100 Date: Tue, 5 Nov 2019 18:28:33 +0100 (CET) From: Thomas Gleixner To: Oleg Nesterov cc: Florian Weimer , Shawn Landden , libc-alpha@sourceware.org, linux-api@vger.kernel.org, LKML , Arnd Bergmann , Deepa Dinamani , Andrew Morton , Catalin Marinas , Keith Packard , Peter Zijlstra Subject: Re: handle_exit_race && PF_EXITING In-Reply-To: <20191105152728.GA5666@redhat.com> Message-ID: References: <20191104002909.25783-1-shawn@git.icu> <87woceslfs.fsf@oldenburg2.str.redhat.com> <20191105152728.GA5666@redhat.com> 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 Tue, 5 Nov 2019, Oleg Nesterov wrote: > On 11/05, Thomas Gleixner wrote: > > > > Out of curiosity, what's the race issue vs. robust list which you are > > trying to solve? > > Off-topic, but this reminds me... > > #include > #include > #include > #include > > #define FUTEX_LOCK_PI 6 > > int main(void) > { > struct sched_param sp = {}; > > sp.sched_priority = 2; > assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0); > > int lock = vfork(); > if (!lock) { > sp.sched_priority = 1; > assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0); > _exit(0); > } > > syscall(__NR_futex, &lock, FUTEX_LOCK_PI, 0,0,0); > return 0; > } > > this creates the unkillable RT process spinning in futex_lock_pi() on > a single CPU machine (or you can use taskset). Uuurgh. > Probably the patch below makes sense anyway, but of course it doesn't > solve the real problem: futex_lock_pi() should not spin in this case. Obviously not. > It seems to me I even sent the fix a long ago, but I can't recall what > exactly it did. Probably the PF_EXITING check in attach_to_pi_owner() > must simply die, I'll try to recall... We can't do that. The task might have released the futex already, so the waiter would operate on inconsistent state :( The problem with that exit race is that there is no form of serialization which might be used to address that. We can't abuse any of the task locks for this. I was working on a patch set some time ago to fix another more esoteric futex exit issue. Let me resurrect that. Vs. the signal pending check. That makes sense on its own, but we should not restrict it to fatal signals. Futexes are interruptible by definition. Thanks, tglx