From patchwork Tue Dec 7 13:04:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 48584 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C3E53858006 for ; Tue, 7 Dec 2021 13:06:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C3E53858006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638882408; bh=L1QLexO7zsjlVg+obToP2VbNnpXol09TpPDlSf/0c5E=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=uViez5xaG5HqdCty45nNjA0NA+EpLH4finM/YKXy2hD+NIKsgcUMVLBv+egx7lqk4 afHYQ9XaUCSVGL9AMiapuxTE10LdrL38U0KxOE1kLOXE7YhwfRsX3HktnfCG+ROyKi HH1icnBbhSPCI6sBekl7LhLj6YCbPjH7kayssBK8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 325953858013 for ; Tue, 7 Dec 2021 13:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 325953858013 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-58--2-tGj9MPIKpp7J4s6LjKw-1; Tue, 07 Dec 2021 08:04:35 -0500 X-MC-Unique: -2-tGj9MPIKpp7J4s6LjKw-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 3ECA210144F3 for ; Tue, 7 Dec 2021 13:04:34 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 964D75D9C0 for ; Tue, 7 Dec 2021 13:04:33 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 8/8] nptl: rseq failure after registration on main thread is fatal In-Reply-To: References: X-From-Line: 354a2d43774aeca68104a6230caa4be7141ed43b Mon Sep 17 00:00:00 2001 Message-Id: <354a2d43774aeca68104a6230caa4be7141ed43b.1638880889.git.fweimer@redhat.com> Date: Tue, 07 Dec 2021 14:04:31 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This simplifies the application programming model. Browser sandboxes have already been fixed: Sandbox is incompatible with rseq registration Allow rseq in the Linux sandboxes. r=gcp Sandbox needs to support rseq system call Linux sandbox: Allow rseq(2) Reviewed-by: Szabolcs Nagy --- v2: New patch. Tested with Firefox 94.0 on Fedora 35. nptl/pthread_create.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 4608fd9068..c097fc54e6 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -370,7 +370,8 @@ start_thread (void *arg) /* Register rseq TLS to the kernel. */ { bool do_rseq = THREAD_GETMEM (pd, flags) & ATTR_FLAG_DO_RSEQ; - rseq_register_current_thread (pd, do_rseq); + if (!rseq_register_current_thread (pd, do_rseq) && do_rseq) + __libc_fatal ("Fatal glibc error: rseq registration failed\n"); } #ifndef __ASSUME_SET_ROBUST_LIST