From patchwork Thu May 6 18:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43274 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 E3E843AAB468; Thu, 6 May 2021 18:10:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3E843AAB468 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620324603; bh=zZhwgNj6NiKBa2FObCEsgH0JuNLCnhj/r/Cb9eTKug8=; 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=azBd6YuOZOhqrX+PHOZE+sbui+xbtwb+YKVJTdvgDI9kdeGDtWNvTUbCvjDDZrTt9 cIXvYaklK2pXiZ1dB5HxKUlSN30iHFizu6pkYOMvSF6jsTcPGwWTujGemZEKoF0k+c tYzxk3vKdw/zNM7Izk0ezb97zAlbHsjOFxleKhf8= 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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 05E253AAB446 for ; Thu, 6 May 2021 18:09:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 05E253AAB446 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-599-6fKi66p0O8-8XP6S8vVYiA-1; Thu, 06 May 2021 14:09:56 -0400 X-MC-Unique: 6fKi66p0O8-8XP6S8vVYiA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0614B801817 for ; Thu, 6 May 2021 18:09:56 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-137.ams2.redhat.com [10.36.112.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F28B6267D for ; Thu, 6 May 2021 18:09:55 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 04/13] Linux: Explicitly disable cancellation checking in the dynamic loader In-Reply-To: References: Message-Id: <6570a09c7a6652d387548c8af2dd39fc37df9174.1620323953.git.fweimer@redhat.com> Date: Thu, 06 May 2021 20:10:14 +0200 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.8 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@sourceware.org Sender: "Libc-alpha" Historically, SINGLE_THREAD_P is defined to 1 in the dynamic loader. This has the side effect of disabling cancellation points. In order to enable future use of SINGLE_THREAD_P for single-thread optimizations in the dynamic loader (which becomes important once more code is moved from libpthread), introduce a new NO_SYSCALL_CANCEL_CHECKING macro which is always 1 for IS_IN (rtld), indepdently of the actual SINGLE_THREAD_P value. Tested-by: Carlos O'Donell Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysdep.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h index 2fa6bfa135..664d093c05 100644 --- a/sysdeps/unix/sysdep.h +++ b/sysdeps/unix/sysdep.h @@ -88,10 +88,17 @@ #define INLINE_SYSCALL_CALL(...) \ __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) +#if IS_IN (rtld) +/* All cancellation points are compiled out in the dynamic loader. */ +# define NO_SYSCALL_CANCEL_CHECKING 1 +#else +# define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P +#endif + #define SYSCALL_CANCEL(...) \ ({ \ long int sc_ret; \ - if (SINGLE_THREAD_P) \ + if (NO_SYSCALL_CANCEL_CHECKING) \ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ else \ { \ @@ -107,7 +114,7 @@ #define INTERNAL_SYSCALL_CANCEL(...) \ ({ \ long int sc_ret; \ - if (SINGLE_THREAD_P) \ + if (NO_SYSCALL_CANCEL_CHECKING) \ sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \ else \ { \