From patchwork Mon Aug 22 20:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 56925 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 566A43858281 for ; Mon, 22 Aug 2022 20:27:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 9F23A3858401 for ; Mon, 22 Aug 2022 20:27:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F23A3858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 8D53E2017C; Mon, 22 Aug 2022 22:27:04 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GZXCjPyKO4Lo; Mon, 22 Aug 2022 22:27:04 +0200 (CEST) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 8FFBB2011C; Mon, 22 Aug 2022 22:27:02 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1oQE0l-00FhTi-0r; Mon, 22 Aug 2022 22:27:03 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd, commited] htl: make __pthread_hurd_cond_timedwait_internal check mutex is held Date: Mon, 22 Aug 2022 22:27:02 +0200 Message-Id: <20220822202702.3742043-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Like __pthread_cond_timedwait_internal already does. --- sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c b/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c index d81f0a2d8d..16f0d3b309 100644 --- a/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c +++ b/sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c @@ -73,6 +73,10 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond, if (abstime != NULL && ! valid_nanoseconds (abstime->tv_nsec)) return EINVAL; + err = __pthread_mutex_checklocked (mutex); + if (err) + return err; + /* Atomically enqueue our thread on the condition variable's queue of waiters, and mark our sigstate to indicate that `cancel_me' must be called to wake us up. We must hold the sigstate lock while acquiring