From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10160 invoked from network); 22 May 2020 02:26:44 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 22 May 2020 02:26:44 -0000 Received: (qmail 12159 invoked by uid 550); 22 May 2020 02:26:42 -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 12141 invoked from network); 22 May 2020 02:26:41 -0000 Date: Thu, 21 May 2020 22:26:29 -0400 From: "dalias@aerifal.cx" To: tangyizhou Cc: "musl@lists.openwall.com" , "Wanghui (John)" , "Huangshuai (OSLab)" Message-ID: <20200522022628.GP1079@brightrain.aerifal.cx> References: <4EB7132F5A45D144AC896FC29A83F192011602E1@DGGEML521-MBS.china.huawei.com> <20200520155046.GK1079@brightrain.aerifal.cx> <4EB7132F5A45D144AC896FC29A83F192011628FB@DGGEML521-MBS.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EB7132F5A45D144AC896FC29A83F192011628FB@DGGEML521-MBS.china.huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Fix the return value of pthread_getschedparam in musl libc On Fri, May 22, 2020 at 01:53:02AM +0000, tangyizhou wrote: > > What is the situation under which SYS_sched_getparam can succeed > > but SYS_sched_getscheduler can fail? The Linux man page > > documenting the syscall: > > There is a timing issue between two syscalls. Think about a concurrent scenario: > Thread A calls pthread_getschedparam() to query the information of > thread B.. After SYS_sched_getparam succeeds and before > SYS_sched_getscheduler starts, thread B is killed, then > SYS_sched_getparam returns -ESRCH. There's not such an issue. t->killlock is held so that this can't happen, and more importantly, so that the thread can't exit and the tid be reassigned to a new thread or process that would wrongly be acted upon. Rich