Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2060920ybz; Thu, 30 Apr 2020 10:09:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLWgImOzN9iHmxdC5rLrgs9jcQanL33GuO7GbwYZtYSw2bUWS+3e4A6coJ9D1rAUvATGluB X-Received: by 2002:a17:906:8611:: with SMTP id o17mr3598095ejx.221.1588266580268; Thu, 30 Apr 2020 10:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588266580; cv=none; d=google.com; s=arc-20160816; b=007PlkeK5qm5qBK1zuaByAOVgaqhAM8T64fP+RP6Cgq/ITNYbTm47sMYc5Nj5ehZzI 354kbyBsrkMcXpjTqk8JaPP/Tx2qgQn4dZ4n0XPMyZka1voLPQkAIcZY35UgPYMTuiPQ Gj+HSNINAds87EhLhkD4Y8r8EblZVcs9gjb3KUWFBeUi6zxmts1Aee4xJc0Qk5EhxvRz 3+FNUc8YWXz0lOtpUQ3UGjZys1+VuPzcri9wVBfgxhuDKBkCorAUO/Q7U9C2QonknEws 40cFGtDwLr7Rvwaje/1Omf6CpEV6shMpNVDnBtmDMNdy4pvzA105ncUer84SEWDNKIrg ihog== 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 :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=n84NKkMGhM/sUUh7/zgvH7HP13DgY6SqFKXlVUHweRo=; b=AhzVPh2Z1EuoYanPUh4mg+BES78wSIkp4Roee3oemyGmz9cOX6bTQOndurvTaoKfZW OHoTvXb4qAnNk1+KdZAkH12Ck9BeCQgGB331BBT6jftpeGA3O5+F+T/Yuod2NI4Geggc wVc/VCMrO85GaJE7Gp+2p3vRb/dNlGy6JtRRg7wG887e7ouw0OwUE/UNuHv5dW8En7gK OSF53fI2Yr+iJkCcwg3gB3ZUHTi5UflUrndAaEMAD96ba/JoEl/lRSrVSS0JMPF1Omjg DTKRNnA97jzpCn/yGk1BgOjfs7OROnvZsvrYQXiy7lL1vUHvMsAU/P5oQ1RyYVq3vaJY qzoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fLKE/dPC"; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si154719edc.246.2020.04.30.10.09.14; Thu, 30 Apr 2020 10:09:40 -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=@redhat.com header.s=mimecast20190719 header.b="fLKE/dPC"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbgD3RHd (ORCPT + 99 others); Thu, 30 Apr 2020 13:07:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46840 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726405AbgD3RHd (ORCPT ); Thu, 30 Apr 2020 13:07:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588266452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n84NKkMGhM/sUUh7/zgvH7HP13DgY6SqFKXlVUHweRo=; b=fLKE/dPCNctFjQ0lJNqGqUzUP1RJ01ZU0w2TS8Y78WbKZxnIY2SnztU87rIU/f/pMXKMSb YtfM2jahsq3htwN9xT2Z49yqPtBoXXGou3B8p4+/a2wwXmrtpjkGv0kAslioC/1fNXARHU sFxiowZjhAbBfNBdBZZSh5XZul4x8a8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-73-V-sb3-CdPvGn1CGtBBGUQw-1; Thu, 30 Apr 2020 13:07:28 -0400 X-MC-Unique: V-sb3-CdPvGn1CGtBBGUQw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0137B1895A28; Thu, 30 Apr 2020 17:07:26 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-72.ams2.redhat.com [10.36.113.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6B7D5D9F1; Thu, 30 Apr 2020 17:07:18 +0000 (UTC) From: Florian Weimer To: Mathieu Desnoyers Cc: carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , Paul , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , Rich Felker , linux-kernel , linux-api Subject: Re: [RFC PATCH glibc 1/3] glibc: Perform rseq(2) registration at C startup and thread creation (v18) References: <20200428171513.22926-1-mathieu.desnoyers@efficios.com> <875zdhmaft.fsf@oldenburg2.str.redhat.com> <1287616647.77866.1588263099045.JavaMail.zimbra@efficios.com> <878sidkk0z.fsf@oldenburg2.str.redhat.com> <1972833271.77975.1588265754974.JavaMail.zimbra@efficios.com> Date: Thu, 30 Apr 2020 19:07:17 +0200 In-Reply-To: <1972833271.77975.1588265754974.JavaMail.zimbra@efficios.com> (Mathieu Desnoyers's message of "Thu, 30 Apr 2020 12:55:54 -0400 (EDT)") Message-ID: <874kt0lx6i.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Mathieu Desnoyers: > If we go this way, I'd also recommend to treat any situation where > __rseq_abi.cpu_id is already initialized as a fatal error. Does the > code below seem OK to you ? > > static inline void > rseq_register_current_thread (void) > { > int ret; > > if (__rseq_abi.cpu_id !=3D RSEQ_CPU_ID_UNINITIALIZED) > __libc_fatal ("rseq already initialized for this thread\n"); Agreed; this should work because this code runs after relocation processing. > ret =3D INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, sizeof (struct rseq), > 0, RSEQ_SIG); > if (INTERNAL_SYSCALL_ERROR_P (ret)) > { > if (INTERNAL_SYSCALL_ERRNO (ret) =3D=3D EBUSY) > __libc_fatal ("rseq already registered for this thread\n"); > __rseq_abi.cpu_id =3D RSEQ_CPU_ID_REGISTRATION_FAILED; > } > } __libc_fatal does not attribute the error to glibc, so I suggest to start the error messages with =E2=80=9Cglibc fatal error: =E2=80=9D, so tha= t people know where to look. Thanks, Florian