From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7A0793857C5F for ; Thu, 18 Nov 2021 18:19:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A0793857C5F 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-289-4Wq4KYxSOsSyXSBbXcVr8Q-1; Thu, 18 Nov 2021 13:19:25 -0500 X-MC-Unique: 4Wq4KYxSOsSyXSBbXcVr8Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74A9F879A0C; Thu, 18 Nov 2021 18:19:15 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BFA95C25D; Thu, 18 Nov 2021 18:19:14 +0000 (UTC) From: Florian Weimer To: Gibeom Gwon Cc: libc-help@sourceware.org Subject: Re: Handles the masked signal when the thread exits References: <2fb82128-a9da-e7f5-8062-f7e72b1561db@stackframe.dev> <8735ntfi9y.fsf@oldenburg.str.redhat.com> <7f3882b1-1c09-83af-40b9-979a400f097e@stackframe.dev> Date: Thu, 18 Nov 2021 19:19:12 +0100 In-Reply-To: <7f3882b1-1c09-83af-40b9-979a400f097e@stackframe.dev> (Gibeom Gwon's message of "Fri, 19 Nov 2021 03:11:42 +0900") Message-ID: <87v90pe38f.fsf@oldenburg.str.redhat.com> 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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2021 18:19:31 -0000 * Gibeom Gwon: > On 11/19/21 03:08, Florian Weimer wrote: >> * Gibeom Gwon: >> >>> I am experiencing strange(unintended?) behavior when using pthread >>> with signals. If I set the signal mask with pthread_sigmask() in the >>> thread function and the process has pending signal when thread is >>> exiting, signal handler executed in thread. >>> >>> It looks like glibc restores original signal mask at the end of the >>> thread. So I suspect this eventually triggers masked signal >>> handler. But I'm not sure it is intended or not. >> Which glibc version are you using? > Ah, I forgot to write the version. I'm using 2.33 and linux > distribution is Arch Linux. We had some issues with signals and thread exit in 2.34, but they are exclusive to that release and cannot happen in 2.33. I can't reproduce the behavior you see with upstream 2.33, either. What's your kernel version? I've tried 5.14.13 and 5.14.17. Thanks, Florian