From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id 671256e4 for ; Mon, 10 Feb 2020 19:57:37 +0000 (UTC) Received: (qmail 5841 invoked by uid 550); 10 Feb 2020 19:57:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 5822 invoked from network); 10 Feb 2020 19:57:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=y/XRAo3pOVgpGU12cV8PdWn0Fwz5ZqF/slWR5p9REpM=; b=zG+COBFMnF/73BmG35rN6OrYOMXoW2Uo4ULwsgztj7b688F3o1korDJE5FZIs3QVyj jbvrjwZdeu29jQ46BVQHKQSXM1R3EZtg/i6P72HgI1pHf1JgjAzqTugO3kp58+OjYDE5 FgdasaIq+MOM/3+dwbx2X4Vc2EcFTJXlH4Bh4OMoSWz6DroMT49tr6ytynJlTtH18++Z lHT+BgESY6z5cNV4GYFZp+x8+wOOb6cyS/wBFykdRVO+MmrfyfhMb9d7cU8Y5pZKOVBL xOtoJUDOBqo6Mx51pU6W2EcFSsotJPwJ8C4POOTJdPQQFpevdHwoMVKSMDUb6BWAiimN 5/dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=y/XRAo3pOVgpGU12cV8PdWn0Fwz5ZqF/slWR5p9REpM=; b=uDEqGjshlpq62cjySskHfIH+Zknr8OrcgIbj424J1sGhPu3VdjOh9ZmV21NiON/wLk JiMJ3DHd1KgnR/sq+KpH1djxIiupj9mcaxPDZins6cMroEpsrdTop9YOsQQmLVGsLvqf 00P+FCM8RZIcM9pqAAJZJXH2SDWSXdnV39PS1E0R24iV7+3XC6ZMFjPJAdjUJkZ4qqah iPmwHqWPnBUK+eqP9Vnd+kHrqgyaw0aP5ZcLAje7xmqFyQG5p/3YTFjKNHngpd7rMmCn SFmtutJc9efa5ZYttcym7s5OA0Bk0Jhks3spzu/m35irPVeDzMVHzBGUJwxV0QRtM3Wv YmJg== X-Gm-Message-State: APjAAAXDfkx2T/6C2bLZ7G0myQ8WBjUEqv1HhSfVq+qkGYP7wytSUhSJ mKmX3paVw9AcYlLHWOgE2WVGaPfa3gA= X-Google-Smtp-Source: APXvYqxT/LsYRikjs/MjytT7B+d3EooWslRAwcTj6+GZpBhQCe91h6q0IHhJMaN+WI7uyOCfSqJUog== X-Received: by 2002:a2e:b044:: with SMTP id d4mr1855168ljl.159.1581364643916; Mon, 10 Feb 2020 11:57:23 -0800 (PST) To: musl@lists.openwall.com, Rich Felker References: <20200210193427.GR1663@brightrain.aerifal.cx> From: Alexander Scherbatiy Message-ID: <14a8dbf3-1382-e61c-3b4e-3a3174dd75b2@bell-sw.com> Date: Mon, 10 Feb 2020 22:57:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200210193427.GR1663@brightrain.aerifal.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [musl] No such process return value in pthread_getcpuclockid On 10.02.2020 22:34, Rich Felker wrote: > On Mon, Feb 10, 2020 at 10:29:02PM +0300, Alexander Scherbatiy wrote: >> Hello, >> >> It seems that pthread_getcpuclockid does not properly handle non >> valid thread id argument. >> >> Below is a sample which calls pthread_getcpuclockid with NULL thread >> id. The expected result is ESRCH (No thread with the ID thread could >> be found). It crashes in my docker with Alpine Linux 3.11.3 (musl >> libc x86_64 1.1.24). It returns ESRCH on my Ubuntu system. > There's no such thing as a "null thread id". A pthread_t value is > either the id of a thread which is still valid (still running or > joinable and not yet joined), or *any* use of it produces undefined > behavior. There is no value reserved for a sentinel. If you need an > optional thread id variable/field, you need a separate validity flag > alongside it. > > None of this is unique to musl; it's the way the POSIX threads > interfaces are designed. I can create a thread, join to it and use the thread id in pthread_getcpuclockid function after that. The Linux Programmer's Manual has the following errors section: "ESRCH  No thread with the ID thread could be found." Does pthread_getcpuclockid function from musl follows the similar errors handling approach? Thanks, Alexandr. > > Rich