Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2952312imm; Sun, 16 Sep 2018 06:39:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbBjiOBnsiNWQWJ4gKfw4ZVeEVM/+Vo1StUvBDI2tvghyf+LuJ7PS5WP68kwz2WADApTIND X-Received: by 2002:a63:d54e:: with SMTP id v14-v6mr20205434pgi.264.1537105157309; Sun, 16 Sep 2018 06:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537105157; cv=none; d=google.com; s=arc-20160816; b=YyRQxzpxPEwh9OTPIraY04gecgsrfowiTbfV+Oa9BWkbHRdN45ONylKnau1EuWI6iC KStE9BPpvIkehF1DTf25K7CJtG8ZaPx0PsnYdXnPtYfoHaNlOI5A/nHMfdD+b0b+58wh RjgW5EfDSISugO5DW25I0a1tGySp+G0dBvH3XWnYwnVmNimlqZgQsT/0B89C5XO4tWMy qtGb8lJPYrmCSROFiPAGaNVtrdVlEnUhoamPOA5Z0m7DP1JNgoPkhHEh+RmHDur+FkaK I0oX2IEa/PiZb5vhQFnf0n/8sufeIussz8iCiUqzFeBPo1NLQy9Hfbysjm7yawJQfS1x Z4YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:date:references:subject:cc:to:from; bh=sX0ShlIr1OW3mRtc44rZlEAkpbzPrAh9teAwTaD9Kec=; b=C0o5pEXcQ0ug0IUO6A2rNGkNjjVWKi8OFKi+HP5B8U5IEuV8oqGT5gulh9nY5qHuQr b5d980LqRHv6Yz1715AFQFBI/rT58rbxCLBUK5XMvn7MZ0AJFDp2wBQiNE1M4+KeXHCI 3/oujZwoJAbMy8xIoNv2i9gkdVzc1y71IjJnTn4s+ZIc4paCilqM2FkuG9fsl6AqXCHE VzYeLjzUti6Bx3M8zPSV6oQu15ycPW6gt4qc1XbjKcx2ulZ1RuHr8DyavHu4jvEEl6v/ qHgON1D2lM1ukMWL7QpXlfInES+A81y8z3Y+2jbc7vmeqOe0eu8AcDyF/kIBj51e169U LVZQ== 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 a190-v6si13302323pfb.144.2018.09.16.06.39.02; Sun, 16 Sep 2018 06:39:17 -0700 (PDT) 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 S1728450AbeIPTBt convert rfc822-to-8bit (ORCPT + 99 others); Sun, 16 Sep 2018 15:01:49 -0400 Received: from albireo.enyo.de ([5.158.152.32]:53804 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728425AbeIPTBt (ORCPT ); Sun, 16 Sep 2018 15:01:49 -0400 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1g1XG8-0000zt-8T; Sun, 16 Sep 2018 13:38:44 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.89) (envelope-from ) id 1g1XG8-0007z8-3m; Sun, 16 Sep 2018 15:38:44 +0200 From: Florian Weimer To: Rich Felker Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , linux-man@vger.kernel.org, "Michael Kerrisk \(man-pages\)" Subject: Re: futex_cmpxchg_enabled breakage References: <20180829222221.GA22017@brightrain.aerifal.cx> <87fty9hc2u.fsf@mid.deneb.enyo.de> <20180916131637.GA17995@brightrain.aerifal.cx> Date: Sun, 16 Sep 2018 15:38:44 +0200 In-Reply-To: <20180916131637.GA17995@brightrain.aerifal.cx> (Rich Felker's message of "Sun, 16 Sep 2018 09:16:37 -0400") Message-ID: <877ejlh89n.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Rich Felker: >> I believe the expected userspace interface is that you probe support >> with set_robust_list first, and then start using the relevant futex >> interfaces only if that call succeeded. > > In order for it to work, set_robust_list needs to succeed for all > threads, present and future, so there's an implicit contract needed > here that, if it succeeds once, it needs to always succeed. This is > satisfied by the kernel implementation. It certainly makes simpler if set_robust_list cannot fail due to resource allocation issues. > Presumably a similar probing should happen in > pthread_mutexattr_setprotocol for PI mutex support. Does glibc do > this? musl still lacks PI mutex support so I'll save this as a note > for when it's added. glibc currently implements checking for support in pthread_mutex_init, presumably due to the fact that some invalid attribute/flag combinations can only reasonably detected at that point. It makes probing for support slightly more difficult, of course. >> If you do that, most parts of >> a typical system will work as expected even if the kernel support is >> not there, which is a bit surprising. It definitely makes the root >> cause harder to spot. > > I don't follow here. "most parts of a typical system will work as > expected" seems to be the case whether you do or don't correctly > probe. The only difference is whether a program that carefully checks > for errors will see and report that pthread_mutexattr_setrobust > failed. This may be the case. We only ever had the glibc test failures as evidence that something was quite wrong, despite ongoing validation of the system. But this could have been accident due to an invalid test environment. (The product in question is only supposed to support the radix MMU, but when running under KVM, the kernel switches to the hash MMU instead, which masks the presence of the bug—set_robust_list is magically available again.)