Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14a8dbf3-1382-e61c-3b4e-3a3174dd75b2@bell-sw.com>
Date: Mon, 10 Feb 2020 22:57:22 +0300
From: Alexander Scherbatiy <alexander.scherbatiy@...l-sw.com>
To: musl@...ts.openwall.com, Rich Felker <dalias@...c.org>
Subject: Re: 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.