From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-0010f301.pphosted.com (mx0a-0010f301.pphosted.com [148.163.149.254]) by sourceware.org (Postfix) with ESMTPS id 5FCD13857829 for ; Tue, 22 Jun 2021 16:17:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5FCD13857829 Received: from pps.filterd (m0102856.ppops.net [127.0.0.1]) by mx0b-0010f301.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15MG8ors015894; Tue, 22 Jun 2021 11:17:25 -0500 Received: from mx4.mail.rice.edu (mx4.mail.rice.edu [128.42.199.101]) by mx0b-0010f301.pphosted.com with ESMTP id 39bhrng623-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 11:17:25 -0500 Received: from mx4.mail.rice.edu (localhost [127.0.0.1]) by mx4.mail.rice.edu (Postfix) with ESMTP id 155374144E0; Tue, 22 Jun 2021 11:17:25 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mx4.mail.rice.edu (Postfix) with ESMTP id 137C44144DF; Tue, 22 Jun 2021 11:17:25 -0500 (CDT) X-Virus-Scanned: by amavis-2.12.1 at mx4.mail.rice.edu, auth channel Received: from mx4.mail.rice.edu ([127.0.0.1]) by localhost (mx4.mail.rice.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id pKDCDO4cwyw2; Tue, 22 Jun 2021 11:17:16 -0500 (CDT) Received: from [192.168.50.202] (c-98-200-175-18.hsd1.tx.comcast.net [98.200.175.18]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johnmc@rice.edu) by mx4.mail.rice.edu (Postfix) with ESMTPSA id 16897209DB2; Tue, 22 Jun 2021 11:17:16 -0500 (CDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: A collection of LD_AUDIT bugs that are important for tools (with better formatting for this list) From: John Mellor-Crummey In-Reply-To: <87o8bxdi8b.fsf@oldenburg.str.redhat.com> Date: Tue, 22 Jun 2021 11:17:15 -0500 Cc: John Mellor-Crummey , Adhemerval Zanella , libc-alpha@sourceware.org, Ben Woodard , "Mark W. Krentel" , Jonathon Anderson , Xiaozhu Meng Content-Transfer-Encoding: quoted-printable Message-Id: <8055B154-337B-4B30-9036-056AB5750766@rice.edu> References: <8A8FF420-8316-4A22-AC4D-DA1F2D5625A5@rice.edu> <2fc830b9-35da-9b94-369f-4df683078a5c@linaro.org> <8735tguubc.fsf@oldenburg.str.redhat.com> <5F849F6D-0BB7-4D6F-9FC8-9F73A4E012F3@rice.edu> <87tulqe2mc.fsf@oldenburg.str.redhat.com> <96DC1048-EA3C-4DF5-BF16-A567F7C56BDE@rice.edu> <87o8bxdi8b.fsf@oldenburg.str.redhat.com> To: Florian Weimer X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Proofpoint-ORIG-GUID: lfuxbrzmHH9gI0Yuxil8MEzdmJ1FqeIG X-Proofpoint-GUID: lfuxbrzmHH9gI0Yuxil8MEzdmJ1FqeIG X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-22_11:2021-06-22, 2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=947 priorityscore=1501 spamscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220101 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-List-Received-Date: Tue, 22 Jun 2021 16:17:32 -0000 Florian, > On Jun 22, 2021, at 10:36 AM, Florian Weimer = wrote: >=20 > * John Mellor-Crummey: >=20 >>> On Jun 22, 2021, at 3:15 AM, Florian Weimer = wrote: >>> You can already see this non-interceptable thread creation behavior >>> today (in glibc 2.33 and earlier) with thrd_create, which does not >>> result in a pthread_create call, either, despite creating a new = thread >>> as if by pthread_create. >>=20 >> Having a non-interposable thrd_create is a problem for us too, though=20= >> we haven=E2=80=99t yet seen it in practice in HPC applications (or = maybe it happened >> and we were just unaware!). >=20 > I meant that thrd_create needs to be intercepted separately. This = will > still work. Got it. Would you recommend intercepting clone instead of trying to intercept pthread_create and thrd_create? That should avoid trouble interposing pthread_create. >=20 >>> Going back to trheading, I find it a bit curious that you intercept >>> pthread_create, but not pthread_join. How do you detect thread = exit? I >>> assume you are interested in that event, too. Merely wrapping the >>> thread start routine is insufficient because there are other ways = for a >>> thread to exit besides returning from the start routine and calling >>> pthread_exit (e.g., thread cancellation and unwinding). >>=20 >> We use pthread_cleanup_push to add a routine that will be called when = a thread >> exits. >=20 > Okay, that should work, although some application-supplied TLS > destructors will run later than that. For our tools, we need to shut down profiling when a thread is = finishing. That can and should be done before the thread really gets torn down. We have learned the hard way that we need to turn off profiling before TLS = destruction starts.=20 -- John Mellor-Crummey Professor Dept of Computer Science Rice University email: johnmc@rice.edu phone: 713-348-5179