Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp958036ybt; Tue, 7 Jul 2020 04:33:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmhyWCwbNPsnK/5Lk0/N4FB8m8iDcSRhJDqfW3jQgJxGmcWredp+8LF7V/wFjqypCOcAOf X-Received: by 2002:a17:906:7005:: with SMTP id n5mr28832972ejj.130.1594121617986; Tue, 07 Jul 2020 04:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594121617; cv=none; d=google.com; s=arc-20160816; b=0qv+fqKkHQnnX5FY5HrAuccKzhfsf/ClC6KQqbJMZQg1r9/MU1drgw66vZxY33798b ghxBVUyRG3mX/82FWtozU7W3GOhHBnP6kLT/YyqRDzme04ErV8hBhJVdnoN0EZa0v4OZ sX8CWu4ZCfb+2JTMMeLskQ2pFMAPFnuOpUAbkWbW6W7WJpZrv73dWPNBriKVPZs486fP pF/bwaldJuNPYGZt6aEz13372M66N1MviVd5WGekTGJXqyXLnxzihEYyK2EfHtOvEyPj QU6JmKOsGvJqvy6SG3D3HTsNZ8Uk1W0BpoNZfEsSCLr43DjAchjgL5U8n8+/vaw6KuHx ykMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to:date :references:subject:cc:to:from; bh=OCUdKyAf9Oqz3Y1Z0VGnOBG2RSa3prdjA1uscskHJdw=; b=EJVOoHsQrXQ26N48GvGuefuPNSHrtCf77LReDJre4Z3LoFTJP/qW70UPVIYtL/4aV+ dIpaGqyEES45kHxaLpqv8Pp5CB4jEF1PJUHl6Uv6luUTtbD22i/PNxVGoZin+6GjctRP DOvQ4i9S6ceY1UMxzN7TQidW9+D7yo2W26FFxx2T/RuKuAO/UHM2294lKBYuipi8R+Pb ySLcfsnfZYyrZkMjse2M8I0YGleQafXAQLH+qSmYUx0FN6qWfhOlpsifaDMWJq5oNPEb xYMjQ9G1rVzfW9p9kfDBRNmML0bEKKxxufb4KlwzoN+UMOsh08OM0oMoVR0TgXpl0aQF cU/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si15062527edn.579.2020.07.07.04.33.14; Tue, 07 Jul 2020 04:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727895AbgGGLcn (ORCPT + 99 others); Tue, 7 Jul 2020 07:32:43 -0400 Received: from albireo.enyo.de ([37.24.231.21]:54158 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbgGGLcm (ORCPT ); Tue, 7 Jul 2020 07:32:42 -0400 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1jslq1-0003Sy-0A; Tue, 07 Jul 2020 11:32:37 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1jslq0-00051l-RM; Tue, 07 Jul 2020 13:32:36 +0200 From: Florian Weimer To: Mathieu Desnoyers Cc: Thomas Gleixner , linux-kernel , Peter Zijlstra , paulmck , Boqun Feng , "H. Peter Anvin" , Paul Turner , linux-api , Dmitry Vyukov , Neel Natu Subject: Re: [RFC PATCH for 5.8 3/4] rseq: Introduce RSEQ_FLAG_RELIABLE_CPU_ID References: <20200706204913.20347-1-mathieu.desnoyers@efficios.com> <20200706204913.20347-4-mathieu.desnoyers@efficios.com> <87fta3zstr.fsf@mid.deneb.enyo.de> <2088331919.943.1594118895344.JavaMail.zimbra@efficios.com> Date: Tue, 07 Jul 2020 13:32:36 +0200 In-Reply-To: <2088331919.943.1594118895344.JavaMail.zimbra@efficios.com> (Mathieu Desnoyers's message of "Tue, 7 Jul 2020 06:48:15 -0400 (EDT)") Message-ID: <874kqjzhkb.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Mathieu Desnoyers: > Those are very good points. One possibility we have would be to let > glibc do the rseq registration without the RSEQ_FLAG_RELIABLE_CPU_ID > flag. On kernels with the bug present, the cpu_id field is still good > enough for typical uses of sched_getcpu() which does not appear to > have a very strict correctness requirement on returning the right > cpu number. > > Then libraries and applications which require a reliable cpu_id > field could check this on their own by calling rseq with the > RSEQ_FLAG_RELIABLE_CPU_ID flag. This would not make the state more > complex in __rseq_abi, and let each rseq user decide about its own > fate: whether it uses rseq or keeps using an rseq-free fallback. > > I am still tempted to allow combining RSEQ_FLAG_REGISTER | > RSEQ_FLAG_RELIABLE_CPU_ID for applications which would not be using > glibc, and want to check this flag on thread registration. Well, you could add a bug fix level field to the __rseq_abi variable. Then applications could check if the kernel has the appropriate level of non-buggyness. But the same thing could be useful for many other kernel interfaces, and I haven't seen such a fix level value for them. What makes rseq so special? It won't help with the present bug, but maybe we should add an rseq API sub-call that blocks future rseq registration for the thread. Then we can add a glibc tunable that flips off rseq reliably if people do not want to use it for some reason (and switch to the non-rseq fallback code instead). But that's going to help with future bugs only.