From patchwork Tue May 31 17:52:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 54579 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 0C6AA395B479 for ; Tue, 31 May 2022 17:53:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C6AA395B479 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1654019601; bh=T3M40VUewtMfzZiyBHWV1DK5OmX6OLrMpJ3hNWyy0AE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VcbohemQv08RwUJC64bUAseEjsDIEieI7g+VMnUiz0m9EGseI7LAFWkPCiu40RrTW tF37PK88W25jWyzgXykvsdOZzPQ0jKJZI2BOZ7NBVVd1sFRohOyE+vjhZyXZQh2jOx U/hz6o3lfxLRPhKdRq9DLapRAmjhczr3TXBhiIrY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id B31093857B82 for ; Tue, 31 May 2022 17:52:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B31093857B82 Received: by mail-ot1-x32a.google.com with SMTP id g13-20020a9d6b0d000000b0060b13026e0dso10051114otp.8 for ; Tue, 31 May 2022 10:52:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=T3M40VUewtMfzZiyBHWV1DK5OmX6OLrMpJ3hNWyy0AE=; b=JMpedS9tNQeByJB1SneauvIDXw5jxS5KXB25aa1dd65zfiD2BYnkqAIhPgD4H8DMnj BxWyDnYHj7XMQ8Cvqz02XdxhDy+i/snKduSaYJkouZX+UvUXvkYeAUx+Wd0/EjZmkSJW 3h8Q0Yetv1aeL8g3/SptppHywzdEYSrA4zmh0Ekekgk5jeDQpuPP4lAp5jIB9MzLLexF hOa6AigIDSn8TjL6rt0rahu5t7Mnxo2GHjUP1G+mQqSghfGaMGBBeAZTNCpbfJOlBsIX b6FlMZdb8XX4MWe58coaRQaOLXMCaZuJFwyNS9Z6LoKPzcWeAI5wgoONyupSj8Nbpxdq nUPw== X-Gm-Message-State: AOAM531uy7dSls/ljFsuz95AdlABS+li8nxjxr31O3+rmUSxyNoqFG3P dKiCNdjhAP+48JPHzyuZ+jL6iUQUwb0zMw== X-Google-Smtp-Source: ABdhPJw6fjjM8ySz/2aXQxRelshA9gA+n3g267+z/MEoH6UXeLKvuG0xeYnQUlPnrLH3GgZvzJ/Xuw== X-Received: by 2002:a9d:6e8d:0:b0:60b:83f9:7e9a with SMTP id a13-20020a9d6e8d000000b0060b83f97e9amr4295725otr.30.1654019578873; Tue, 31 May 2022 10:52:58 -0700 (PDT) Received: from birita.. ([2804:431:c7ca:e39c:980f:eaf1:7a30:10ef]) by smtp.gmail.com with ESMTPSA id f30-20020a4a8921000000b0035f627ac898sm6402626ooi.10.2022.05.31.10.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 10:52:58 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v3 00/12] Fix various NPTL synchronization issues Date: Tue, 31 May 2022 14:52:43 -0300 Message-Id: <20220531175255.1513396-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Patch 01 is a conformance fix to set both the cancellation type and status on thread pthread_exit. Patch 02 fixes a potential issue with robust mutexes on architectures without a working set_rebust_list syscall. Patch 03 is the main change of this patchset, it uses a different field instead of the pthread 'tid' to synchrnonize the internal thread state (BZ#19951). Patches 04 to 12 extend the same 'tid' access fix to other pthread functions that uses the member. Changes in v3: * Rebased against master. * Return EINVAL instead of ESRCH for invalid pthread_t on getters and setters. Adhemerval Zanella (12): nptl: Set cancellation type and state on pthread_exit (BZ #28267) nptl: Handle robust PI mutexes for !__ASSUME_SET_ROBUST_LIST (BZ #28268) nptl: Do not use pthread set_tid_address as state synchronization (BZ #19951) nptl: Use exit_lock when accessing TID on pthread_getaffinity_np nptl: Use exit_lock when accessing TID on pthread_getcpuclockid nptl: Use exit_lock when accessing TID on pthread_setschedparam nptl: Use exit_lock when accessing TID on pthread_getschedparam nptl: Use exit_lock when accessing TID on pthread_getname_np nptl: Use exit_lock when accessing TID on pthread_setname_np nptl: Use exit_lock when accessing TID on pthread_sigqueue nptl: Use exit_lock when accessing TID on pthread_setschedprio nptl: Remove INVALID_TD_P nptl/Makefile | 3 +- nptl/cancellation.c | 31 ++++++- nptl/descr.h | 26 +++--- nptl/nptl-stack.h | 2 +- nptl/pthread_cancel.c | 4 +- nptl/pthread_clockjoin.c | 2 +- nptl/pthread_create.c | 96 ++++++++++++-------- nptl/pthread_detach.c | 40 ++++----- nptl/pthread_exit.c | 4 +- nptl/pthread_getaffinity.c | 30 ++++--- nptl/pthread_getattr_np.c | 2 +- nptl/pthread_getcpuclockid.c | 26 +++--- nptl/pthread_getname.c | 65 ++++++++------ nptl/pthread_getschedparam.c | 55 ++++++------ nptl/pthread_join.c | 2 +- nptl/pthread_join_common.c | 124 +++++++++---------------- nptl/pthread_setname.c | 52 ++++++----- nptl/pthread_setschedparam.c | 51 ++++++----- nptl/pthread_setschedprio.c | 45 +++++----- nptl/pthread_sigqueue.c | 56 ++++++------ nptl/pthread_testcancel.c | 5 +- nptl/pthread_timedjoin.c | 2 +- nptl/pthread_tryjoin.c | 18 ++-- nptl/tst-cleanup5.c | 129 +++++++++++++++++++++++++++ sysdeps/nptl/dl-tls_init_tp.c | 4 +- sysdeps/nptl/libc_start_call_main.h | 7 ++ sysdeps/nptl/pthreadP.h | 22 ++--- sysdeps/pthread/Makefile | 1 + sysdeps/pthread/tst-pthread-exited.c | 94 +++++++++++++++++++ sysdeps/pthread/tst-thrd-detach.c | 16 ++-- 30 files changed, 642 insertions(+), 372 deletions(-) create mode 100644 nptl/tst-cleanup5.c create mode 100644 sysdeps/pthread/tst-pthread-exited.c