Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp360222ybt; Mon, 6 Jul 2020 11:05:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgycfhSFtpn8ktz/cOjRbWR3covvbv6eeiXAY8cwQpat98rZ+ldrrYhNwiNdzBLAd6YC7H X-Received: by 2002:aa7:dacb:: with SMTP id x11mr53202354eds.280.1594058707248; Mon, 06 Jul 2020 11:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594058707; cv=none; d=google.com; s=arc-20160816; b=Nce6zllo5N4iLDbu9ub5ojOXzwIrf8jeFcyEM5LPVmISqq1Tx8U575YMpXT7B7vOWS 5Adrel0z/otGQEmkktzyiuYQlzjojhzsz/Pl2KkMnCUpZQrhXhyMTnlKOOCwxQLkU32i tyuHJ8/VY2sK+iIJ1ovH7u9KCQDIChw4Frl6EIfDeJEy0zrwY6W6w1uZYlTNRKsfSSX/ jytGq7WTU6knf6kreNiX9YwoMNcLDe2UMxZ2QDPDdDlmjO5fe+2aVr1S9IiiqQJX6wDy U7Hb4G0GjBk2i4axmgo2NE1SCT70E9TxsfYZ/RCcd1QY+32sQCoNByI5WXtgBCs5lAs6 6YJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=eTqd6Xn+dXRfSXKbnUK68DewegH7Ev19o9g68FSJQUM=; b=Qvy1rEmlcSsbQVBZToNZQZHSNC1Ld5hNUASR32phM+iOZUO5QiDocn2nmQL3828MUp onQh2yZOmHBTIWaB1ULVSW35B4oNIOP3q28ABspBjeKwRNGTyhnVh+JLeaBQMn09QeBM uLFWyJsYtI67quaQA220nGN0RmZ8J9ftsdTsHOPeNEC8hLSCdme3D673AuRFPaV7c9gD 6ev/VIS8A8rqKm5CSVsTfIGWv9QaRGtms5jPkLf/nhBdhmyg0xP9xg56cDcEJg3m0e8V lDC4prr5V0IfxICY4rIXaclxeMy/pkpyirqUTfY3kwKFhKvi5BiByCS/AozK+aOIfVE7 Axtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Kq92x25P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m15si13152240ejr.38.2020.07.06.11.04.43; Mon, 06 Jul 2020 11:05:07 -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; dkim=pass header.i=@efficios.com header.s=default header.b=Kq92x25P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729708AbgGFSCV (ORCPT + 99 others); Mon, 6 Jul 2020 14:02:21 -0400 Received: from mail.efficios.com ([167.114.26.124]:53772 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729657AbgGFSCV (ORCPT ); Mon, 6 Jul 2020 14:02:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 144102D976E; Mon, 6 Jul 2020 14:02:20 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aOs3hzRbu2n0; Mon, 6 Jul 2020 14:02:19 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id AA5042D976A; Mon, 6 Jul 2020 14:02:19 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com AA5042D976A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1594058539; bh=eTqd6Xn+dXRfSXKbnUK68DewegH7Ev19o9g68FSJQUM=; h=Date:From:To:Message-ID:MIME-Version; b=Kq92x25PaND72Sm8RqSLIsUdUqEIhwR7O5SlXVKLDT+3c5Au5XImAStWJPfWkLi3i X0hdMy1qUtfBTtNqMPeTcU+0SbPeYaxYIRUD2dZ+jOhqgoDCCosBPEpR8Jgb1dG0ny OQugbi8RDe31jVoJNKGmgIO3+esdGiak+wvqUOdo9dFXxtS2l5W0wrlGq6uLl/x4Bw LuR45zOBhND6X+xxTclr4iM5iG4h9KLgLrSg7VueTSFjTO0WkBJswgh9lYQuiqBGCx KULQZgersE5Vc4GlLYzN57QBQ5zyrqWfhR5RtSXa7Vkz/2vTO6cwmEQUuA76zOf5rF fVyb17drlqZIQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id duwtraNlSDBq; Mon, 6 Jul 2020 14:02:19 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 9766C2D96F6; Mon, 6 Jul 2020 14:02:19 -0400 (EDT) Date: Mon, 6 Jul 2020 14:02:19 -0400 (EDT) From: Mathieu Desnoyers To: Florian Weimer Cc: carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , Paul , Boqun Feng , Will Deacon , Paul Turner , linux-kernel , linux-api Message-ID: <1449254526.22910.1594058539512.JavaMail.zimbra@efficios.com> In-Reply-To: <87k0zg3535.fsf@oldenburg2.str.redhat.com> References: <20200629190036.26982-1-mathieu.desnoyers@efficios.com> <20200629190036.26982-3-mathieu.desnoyers@efficios.com> <877dvg4ud4.fsf@oldenburg2.str.redhat.com> <942999672.22574.1594046978937.JavaMail.zimbra@efficios.com> <1679448037.22891.1594056826859.JavaMail.zimbra@efficios.com> <87k0zg3535.fsf@oldenburg2.str.redhat.com> Subject: Re: [PATCH 2/3] Linux: Use rseq in sched_getcpu if available (v9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3945 (ZimbraWebClient - FF78 (Linux)/8.8.15_GA_3928) Thread-Topic: Linux: Use rseq in sched_getcpu if available (v9) Thread-Index: 5ba6+LwPPg7XbV9h0TH6wCD1RjoFCA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Jul 6, 2020, at 1:50 PM, Florian Weimer fweimer@redhat.com wrote: > * Mathieu Desnoyers: > >> Now we need to discuss how we introduce that fix in a way that will >> allow user-space to trust the __rseq_abi.cpu_id field's content. > > I don't think that's necessary. We can mention it in the glibc > distribution notes on the wiki. > >> The usual approach to kernel bug fixing is typically to push the fix, >> mark it for stable kernels, and expect everyone to pick up the >> fixes. I wonder how comfortable glibc would be to replace its >> sched_getcpu implementation with a broken-until-fixed kernel rseq >> implementation without any mechanism in place to know whether it can >> trust the value of the cpu_id field. I am extremely reluctant to do >> so. > > We have already had similar regressions in sched_getcpu, and we didn't > put anything into glibc to deal with those. Was that acceptable because having a wrong cpu number would never trigger corruption, only slowdowns ? In the case of rseq, having the wrong cpu_id value is a real issue which will lead to corruption and crashes. So I maintain my reluctance to introduce the fix without any way for userspace to know whether the cpu_id field value is reliable. What were the reasons why it was OK to have this kind of regression in sched_getcpu in the past, and are they still valid in the context of rseq ? Thanks, Mathieu > > Just queue the fix for the stable kernels. I expect that all > distributions track stable kernel branches in some way, so just put into > the kernel commit message that this commit is needed for a working > sched_getcpu in glibc 2.32 and later. > > Once the upstream fix is in Linus' tree, I'm going to file a request to > backport the fix into the Red Hat Enterprise Linux 8. > > Thanks for finding the root cause so quickly, > Florian -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com