From patchwork Thu Sep 30 20:00:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 45622 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 48C103857C42 for ; Thu, 30 Sep 2021 20:01:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48C103857C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633032077; bh=x4EaBSMuvQ0DyZgMMqaG3dnMvMf/+JwuSWwJvl3DuYo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=VBab7dDPOexOX4VGiRdP08/rMTQfzS7MCp6qhlaq+KgO9eXwrtEnCE6ntQTgcjlZC RXYa6uNtb7Nu/hfp6hgnJZVapm1jtCzfg/cCrJQh0tUlLpcklujoTkazrDkyxRtYOk H2BBWJZBqD0jLN94saekhYF4HSVDy81Idjk3XqYY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by sourceware.org (Postfix) with ESMTPS id BAF6C3858C2C for ; Thu, 30 Sep 2021 20:00:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BAF6C3858C2C Received: by mail-qt1-x836.google.com with SMTP id r1so6852231qta.12 for ; Thu, 30 Sep 2021 13:00:55 -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=x4EaBSMuvQ0DyZgMMqaG3dnMvMf/+JwuSWwJvl3DuYo=; b=KYtw6jifM9Pjdc0g3AIaOxbqY81rVyCdEroabrQmNm1gaznikv2P8HOt2YLUn3daN3 21snboRq2JW0XzNhjSMDQDq1mEJ733Z41p/+6fz++6IpHnovKfypPC0otdxGe2mgvU5O EAmQYFXo+T8RkslwJnDjzgWwrlRtCs+WpN3Y7hpzCEeRLMfZKN+Ib05EV0edpijAdJ1R 66IZOK03+lG2qHEK3s0p0YGm56G0gwwa/4uzWhLs1jwzsch90mweaxj3xj1ZdyH+NaWW /5ZlJZiIISQaTup8MJ3QJnW6Lg4MZ449W0vwjQcsoeDFSN2d/JhtetY14eIB0o04dQzf zICw== X-Gm-Message-State: AOAM5337cIgZD1Sl+3bOQAmHYVfShahNVvHnXQkMOVSf3jDmr0uJQiLK 1JQA4mB1tjLQF6eXvvVeURbFT+ZP8yiY7g== X-Google-Smtp-Source: ABdhPJzIA22z3wTE/6NgPKRqEIRAAPtCygldo4qJaTrdS+DQ+LXErI60818AdwVpu50d8iezdCTj1w== X-Received: by 2002:ac8:5287:: with SMTP id s7mr8831649qtn.359.1633032055178; Thu, 30 Sep 2021 13:00:55 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:b338:b20e:53f8:8b5:1bb2]) by smtp.gmail.com with ESMTPSA id r196sm1910203qka.119.2021.09.30.13.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 13:00:54 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 00/15] Fix various NPTL synchronization issues Date: Thu, 30 Sep 2021 17:00:36 -0300 Message-Id: <20210930200051.1017457-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.9 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 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: 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" This is an update of my previous set to fix some NPTL issues [1]. The main changes are: - Rebased against master. - Added various Florian's suggestions. 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). It allows to both move the thread setxid internal state out of 'cancelhandling' (used on setuid() call in multi-thread information), and remove the EXITING_BIT and TERMINATED_BIT (since 'joinstate' now track such it). This is done on patch 04 and 05. Adhemerval Zanella (15): 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: Move setxid flag out of cancelhandling nptl: Replace struct thread cancelhandling field nptl: Use exit_lock when accessing TID on pthread_getaffinity_np nptl: Use exit_lock when accessing TID on pthread_setaffinity 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/Versions | 1 + nptl/allocatestack.c | 5 +- nptl/cancellation.c | 17 ++-- nptl/descr.h | 45 +++++----- nptl/nptl-stack.h | 2 +- nptl/nptl_free_tcb.c | 26 +++--- nptl/nptl_setxid.c | 55 ++++-------- nptl/pthread_cancel.c | 14 ++- nptl/pthread_clockjoin.c | 2 +- nptl/pthread_create.c | 109 ++++++++++++---------- nptl/pthread_detach.c | 40 ++++----- nptl/pthread_exit.c | 4 +- nptl/pthread_getaffinity.c | 28 +++--- nptl/pthread_getattr_np.c | 2 +- nptl/pthread_getcpuclockid.c | 26 +++--- nptl/pthread_getname.c | 45 ++++++---- nptl/pthread_getschedparam.c | 55 ++++++------ nptl/pthread_join.c | 2 +- nptl/pthread_join_common.c | 126 +++++++++----------------- nptl/pthread_setaffinity.c | 25 +++--- nptl/pthread_setname.c | 38 +++++--- nptl/pthread_setschedparam.c | 51 ++++++----- nptl/pthread_setschedprio.c | 45 +++++----- nptl/pthread_sigqueue.c | 56 ++++++------ nptl/pthread_testcancel.c | 11 +-- nptl/pthread_timedjoin.c | 2 +- nptl/pthread_tryjoin.c | 18 ++-- nptl/tst-cleanup5.c | 129 +++++++++++++++++++++++++++ nptl_db/structs.def | 2 +- nptl_db/td_thr_get_info.c | 16 ++-- nptl_db/td_thr_getfpregs.c | 9 +- nptl_db/td_thr_getgregs.c | 9 +- nptl_db/td_thr_setfpregs.c | 9 +- nptl_db/td_thr_setgregs.c | 9 +- sysdeps/hppa/nptl/tcb-offsets.sym | 1 - sysdeps/i386/nptl/tcb-offsets.sym | 1 - sysdeps/nptl/dl-tls_init_tp.c | 4 +- sysdeps/nptl/libc_start_call_main.h | 7 ++ sysdeps/nptl/pthreadP.h | 27 +++--- sysdeps/pthread/Makefile | 1 + sysdeps/pthread/tst-pthread-exited.c | 101 +++++++++++++++++++++ sysdeps/pthread/tst-thrd-detach.c | 16 ++-- sysdeps/sh/nptl/tcb-offsets.sym | 1 - sysdeps/x86_64/nptl/tcb-offsets.sym | 4 - 45 files changed, 706 insertions(+), 493 deletions(-) create mode 100644 nptl/tst-cleanup5.c create mode 100644 sysdeps/pthread/tst-pthread-exited.c