Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp13473imm; Thu, 20 Sep 2018 13:14:49 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda2GQvtMKqHkscc4wrknz7jYfl6uVxiv3dLVbWLmt3ZgKmbGhckrSN1cLzK8Hz04lkSLaCP X-Received: by 2002:a63:d74f:: with SMTP id w15-v6mr38489818pgi.306.1537474489148; Thu, 20 Sep 2018 13:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537474489; cv=none; d=google.com; s=arc-20160816; b=QGFCVn1p3SNyVE03XHue6aQfsBO10fdyT+rKn0bWDuh1bKrT1TO5c0mRB3O3WV9cJc 7UX2QfsNbfVgXPNGVJ5zLI4SB10y2mwpsdG6fRzwL2ucIEiK50UCYdJhHCR5g9bLzPKD G/gsdf3tH2YxHoF0V2bTscETm99TKieMKxq4UNXweFReA4I5ja8xaI9Sl3vkPuYDWmLC Ms4RaHcDaNDNHIAt/k79GWwJn/sKnteGfNS5kJgs42pUtUSGgVgVlEIDeGogkSswBcWv cWBe7SZAgmwMMpXX0UFmRbrUpKqYz7O4vB/pXG4L/I8xWQ1RWi9Ui9DdkBbU/4ye2AV9 JWXw== 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=DLNd9uJlO5Zi7hCyclWW1GqemWcLa9Ms3SuhPklj/Gs=; b=tkP49P7cHEOk5TYCVDq2rtHLaJtQb5ydO8JTR4YpfscbOt5lNHFJc7SMCx0KnQwXa3 VLOKq5SrJx3iFFXaXzsj8Dch2OFO12xmCi8XZ7aTBb2BB/OLgtn6LgtdT6gbGDWO+YMu ACbz8FKoPtAuXcJ98sMEXy+zLroPtv/PZgicUaBOWubBZNRPX7Qq0AA1OiEvy0x+xqoe nK426o20eL6usOo24CbvmYr1OwpFlQgDb4DjgBvS16875LVXVoZeV5uaZy/GUpNZaNGV Y+r0GS4MbB8yv2n0rg2OeO+syCnKorHfAqPqtv4x1dlu5rfi2rK4v1/0usfqnLmbplqB uljw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=LX03K84Z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g35-v6si26496560plb.108.2018.09.20.13.14.32; Thu, 20 Sep 2018 13:14:49 -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; dkim=pass header.i=@efficios.com header.s=default header.b=LX03K84Z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387957AbeIUB7b (ORCPT + 99 others); Thu, 20 Sep 2018 21:59:31 -0400 Received: from mail.efficios.com ([167.114.142.138]:55632 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeIUB7a (ORCPT ); Thu, 20 Sep 2018 21:59:30 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id D02D2240D53; Thu, 20 Sep 2018 16:14:17 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id VMQGU6cY4IkF; Thu, 20 Sep 2018 16:14:17 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 632C5240D4F; Thu, 20 Sep 2018 16:14:17 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 632C5240D4F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1537474457; bh=DLNd9uJlO5Zi7hCyclWW1GqemWcLa9Ms3SuhPklj/Gs=; h=Date:From:To:Message-ID:MIME-Version; b=LX03K84ZLk2fxx961ha1C1ObtbqhHvZJDJwiEDOUwc0JvPik3xCGeZGhsOcS5HWTO JXX6Dn0IrkLnT2SPjvGGq2uR/Kk4fpypb4VrcKx9IQwAuZQgepEjmTczTBSKdrx3Af cEL0AeWkNmy3qSksvk44oBv+HVU23ZpSIy9tzATEvuthijulzJOYEFE75bnNrO0HVo mDnCu2O9mFpR/ezv282aZmHr2X8yQZ8MNbrYmCz/eQqM2/HW8tGeU4p6GMB/Pj7Bvn mQUZj7yUaiwDY+/jf3wcq508ocPgHKk6xe1109e0p415wVxno/KGxykzqsvy7dBQUN Bmkq+mZHfTKFg== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id FbeHrp6lo8fn; Thu, 20 Sep 2018 16:14:17 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 4B49A240D48; Thu, 20 Sep 2018 16:14:17 -0400 (EDT) Date: Thu, 20 Sep 2018 16:14:17 -0400 (EDT) From: Mathieu Desnoyers To: Joseph Myers Cc: carlos , Florian Weimer , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , libc-alpha , linux-kernel , linux-api Message-ID: <1619649568.9014.1537474457166.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180919144438.1066-1-mathieu.desnoyers@efficios.com> <67473000.8399.1537375994645.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH] glibc: Perform rseq(2) registration at nptl init and thread creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.9_GA_3019 (ZimbraWebClient - FF52 (Linux)/8.8.9_GA_3019) Thread-Topic: glibc: Perform rseq(2) registration at nptl init and thread creation Thread-Index: tM1mCCVskfQXIsPWE9MXSeTmEFJDzA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Sep 19, 2018, at 1:10 PM, Joseph Myers joseph@codesourcery.com wrote: > On Wed, 19 Sep 2018, Mathieu Desnoyers wrote: > >> > This looks like it's coming from the Linux kernel. Can't the relevant >> > uapi header just be used directly without copying into glibc (with due >> > care to ensure that glibc still builds if the kernel headers used for the >> > build are too old - you need such conditionals anyway if they don't define >> > the relevant syscall number)? >> >> This is indeed in the list of "things to consider" I've put in the patch >> commit message. If the usual practice is to build against uapi kernel headers >> outside of the glibc tree, I'm fine with that. > > We build with, currently, 3.2 or later headers (since 3.2 is EOL there's a > case for updating the minimum in glibc for both compile time and runtime, > but I haven't proposed that since there isn't much cleanup that would > enable and there's the open question of Carlos's proposal to eliminate the > runtime check on the kernel version and just let things try to run anyway > even if it's older than the configured minimum). Are you saying glibc has an explicit check for the kernel version visible from /proc before using specific features ? If so, how can this work with the variety of feature backports we find in the distribution kernels out there ? Checking whether specific system calls return ENOSYS errors seems more flexible. > Functions depending on > new syscalls may return ENOSYS errors if the headers used to build glibc > were too old. Since this patch is providing a data interface rather than > functions that can set errno to ENOSYS, presumably you have some other way > of signalling unavailability which would apply both with a too-old kernel > at runtime and too-old headers at compile time. For too-old kernel at runtime, having rseq registration return ENOSYS leaves the the content of __rseq_abi->cpu_id at its initial value (RSEQ_CPU_ID_UNINITIALIZED = -1). For too-old headers at compile time, one possibility is that we don't event expose the __rseq_abi TLS symbol. OTOH, if we need to keep exposing it anyway for ABI consistency purposes, then we'd leave its cpu_id field at the initial value (-1). But that would require that we copy linux/rseq.h into the glibc source tree. Thoughts ? Thanks, Mathieu > > -- > Joseph S. Myers > joseph@codesourcery.com -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com