From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04C52385702B; Wed, 28 Sep 2022 09:59:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04C52385702B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664359172; bh=MR3KmfRjTMPTUIs8M0xYLeuRcwjOATPL5ckJyFK9L8I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=I+6smS5kKzK5P43MLv3wMNvNKUJB0LD5VzEOUjuP6BG0kapVIOMYOBWCsD07DwgaT OkUFJqB+/z699VfyTkY3ZlarZqljbHh0Ar+HEalDn0heV6LpBMzbFPobLBMs+I3uc+ A4KLImIsJKK8rdQfDY4Ugh96GSksDPoNkwRb2v8Q= From: "mjbaars1977 at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/29585] sched_getcpu returns invalid results Date: Wed, 28 Sep 2022 09:59:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.35 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjbaars1977 at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29585 --- Comment #11 from Mischa Baars --- (In reply to Florian Weimer from comment #9) > (In reply to Mischa Baars from comment #8) > > (In reply to Florian Weimer from comment #7) > > > You cannot call glibc function after creating a bare thread using clo= ne, you > > > need to use direct system calls. The bare thread does not have a prop= er > > > thread control block set up for glibc. > >=20 > > Ok, no problem. I can use syscalls to retrieve the processor the proces= s is > > running on, but shouldn't glibc check for the existence of this thread > > control block and return a -1 when it does not exist instead of a incor= rect > > processor number? >=20 > There is no efficient way to check if the TCB is safe to use from the > current thread. >=20 > > I think that a small note in the manual page about pthreads vs fork / c= lone > > would be in order. For example, if the existence of both pthread_yield = and > > sched_yield makes you think that sched_yield is not specifically intend= ed > > for use with pthreads, then why would sched_getcpu be? >=20 > sched_getcpu is not related to pthreads any more than the rest of glibc. Hi Florian, A little more detail of what we're dealing with here: I can't tell if this this is in any way related to a thread control block, = but without the CLONE_VM option passed to clone(), sched_getcpu() is working fi= ne, with the CLONE_VM option passed to clone(), it isn't. Just in case you were still interested :) Best regards, Mischa Baars. --=20 You are receiving this mail because: You are on the CC list for the bug.=