Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1081042ybx; Tue, 5 Nov 2019 10:00:54 -0800 (PST) X-Google-Smtp-Source: APXvYqyrHivKL5AdaN32xqTiGFuWMeuqsiGdhrw6z48duA6VX+mqLYUdG8sNubk+EbL+BLb2D5q6 X-Received: by 2002:aa7:c694:: with SMTP id n20mr15183713edq.87.1572976854214; Tue, 05 Nov 2019 10:00:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572976854; cv=none; d=google.com; s=arc-20160816; b=K8cuS0P4mJHndpaXykzpKeYmwWX8qJViinbHWrNaFLIuBLXSiAHRvobdQ9FhIS1zXZ ZrcifO/iXLYoJbZ9VVvi8M66CZAwmFHDmXrvqShtWtewB4f5dT4CN15ZfMvQw3b90GAD EFiqTLJQl1Ul7fJidZGskvbBKG3e3zXhvyWqdP9ILf/xpk7Q/jVJe1JtllxKKAdGwouG 85JRqpYVnZhnsr4ac6qvUj5AJBH7ADXvdhVOsrCZyx+tonq29PJjXjy+SIxHDbZB2my3 0iH63wBnG3WBD6gKeLDhEMo/Z8tB1hFokN6kGVQpAGPW5CfyvvmfR7gl/6LwrFYn1VXM tfeA== 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=UrZibnS/KyRUXX1GxAQ06T3MlkeaMDO9CxX60sjzoKE=; b=gNGWyo4Osg/9qFrNWoEFIK1DKEaQemgdetFWgm+ZoPFU78vJp5Iq6OQxSmpKSUY2sE jkpZss8k0vST+SAxRvdU82nCU1Iu13zgT9K27IlXOkcJK+h9oiAk+71F5rgRR7KSkTqv Pn5gOQ3VaglMuMCOw/ZV3JA+hEA4FMEIuBkk+Yw0hsZ/yudTVzXkSGkvtSawc+guLZmM PPd4vMKGzIxiKWa0nx4mPUyG4uJOremOxJfOR0dnauNy+ghPFl9Iz+1c2wkhytyrMHuC RWb4mHb7AoDtghHJ0zzbHO2WnNOfRt8tMTD3mvqEZ20O/j/0ZRCqiAHvMUTeHiqTZaxS JVGA== 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 fx21si4248623ejb.254.2019.11.05.10.00.30; Tue, 05 Nov 2019 10:00:54 -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 S2390623AbfKER7p (ORCPT + 99 others); Tue, 5 Nov 2019 12:59:45 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42246 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389356AbfKER7p (ORCPT ); Tue, 5 Nov 2019 12:59:45 -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 1iS37A-00019e-Kf; Tue, 05 Nov 2019 18:59:36 +0100 Date: Tue, 5 Nov 2019 18:59:34 +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: 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, Thomas Gleixner wrote: > 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. But staring more at it. That's a scheduler bug. parent child set FIFO prio 2 fork() -> set FIFO prio 1 sched_setscheduler(...) return from syscall <= BUG _exit() When the child lowers its priority from 2 to 1, then the parent _must_ preempt the child simply because the parent is now the top priority task on that CPU. Child should never reach exit before the parent blocks on the futex. Peter? What's even more disturbing is that even with that bug happening the child is able to set PF_EXITING, but not PF_EXITPIDONE. That doesn't make sense. Thanks, tglx