From patchwork Tue Aug 17 13:50:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 44679 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 E8710389C463 for ; Tue, 17 Aug 2021 13:51:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8710389C463 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629208305; bh=qJEZEAVmT01pKQSB3o4DPad1bmNWs8OMir0IezQUgm0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SVm91AuqMMsflGzIofFVib87veDv9dXJQK2wu4jCUEuUjwsgwhNgzwP5RJ67gqmsn o6yUS50S2gt6wZmRWaDB+UnBkltjJsjT55M2EaK/JnIac+NSJ+QioMaTfzIUtsnx0m jSse9EMQfSBcFrcCCXyC8pGKf1mp5Hv6I0tFrXEM= 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 1B7063893C5B for ; Tue, 17 Aug 2021 13:51:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B7063893C5B 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-293-ewRs_XJ7Npaz0Zr3hrvHMg-1; Tue, 17 Aug 2021 09:50:57 -0400 X-MC-Unique: ewRs_XJ7Npaz0Zr3hrvHMg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C843F1018F72 for ; Tue, 17 Aug 2021 13:50:56 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47E6A19C44 for ; Tue, 17 Aug 2021 13:50:56 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 0/3] Fix ESRCH issues in pthread_cancel, pthread_kill X-From-Line: 811aff39780f8d997421dcda8c6afaf01ea1ee6a Mon Sep 17 00:00:00 2001 Message-Id: Date: Tue, 17 Aug 2021 15:50:54 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.9 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_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 mini-series came out of a downstream bug report: glibc: pthread_cancel fails with ESRCH yet subsequent pthread_join passes Apparently the race is much easier to trigger due to the changes in glibc 2.34. Tested on i686-linux-gnu, x86_64-linux-gnu. Built with build-many-glibcs.py. Thanks, Florian Florian Weimer (3): support: Add support_wait_for_thread_exit nptl: pthread_kill, pthread_cancel should fail after exit (bug 19193) nptl: Fix race between pthread_kill and thread exit (bug 12889) nptl/allocatestack.c | 1 + nptl/descr.h | 12 ++ nptl/pthread_cancel.c | 9 +- nptl/pthread_create.c | 20 ++++ nptl/pthread_kill.c | 30 ++++- support/Makefile | 3 +- support/support.h | 4 + support/support_wait_for_thread_exit.c | 67 +++++++++++ sysdeps/pthread/Makefile | 7 +- sysdeps/pthread/tst-kill4.c | 90 -------------- sysdeps/pthread/tst-pthread_cancel-exited.c | 45 +++++++ .../pthread/tst-pthread_cancel-select-loop.c | 87 ++++++++++++++ sysdeps/pthread/tst-pthread_kill-exited.c | 46 ++++++++ sysdeps/pthread/tst-pthread_kill-exiting.c | 110 ++++++++++++++++++ 14 files changed, 431 insertions(+), 100 deletions(-) create mode 100644 support/support_wait_for_thread_exit.c delete mode 100644 sysdeps/pthread/tst-kill4.c create mode 100644 sysdeps/pthread/tst-pthread_cancel-exited.c create mode 100644 sysdeps/pthread/tst-pthread_cancel-select-loop.c create mode 100644 sysdeps/pthread/tst-pthread_kill-exited.c create mode 100644 sysdeps/pthread/tst-pthread_kill-exiting.c