From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 652CE398703E for ; Tue, 20 Jul 2021 08:31:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 652CE398703E Received: from monopod.intra.ispras.ru (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 66DFD40D3BFF; Tue, 20 Jul 2021 08:31:15 +0000 (UTC) Date: Tue, 20 Jul 2021 11:31:14 +0300 (MSK) From: Alexander Monakov To: Adhemerval Zanella cc: libc-alpha@sourceware.org, Alexander Monakov , John Mellor-Crummey Subject: Re: [PATCH v2 2/6] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) In-Reply-To: <20210719143309.2848878-3-adhemerval.zanella@linaro.org> Message-ID: References: <20210719143309.2848878-1-adhemerval.zanella@linaro.org> <20210719143309.2848878-3-adhemerval.zanella@linaro.org> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 20 Jul 2021 08:31:19 -0000 On Mon, 19 Jul 2021, Adhemerval Zanella via Libc-alpha wrote: > The rtld-audit interfaces introduces a slowdown due to enabling profiling "interface" (my original message had "using the audit interfaces introduces"). > instrumentation (as if LD_AUDIT implied LD_PROFILE). However, instrumenting > is only necessary if one of audit libraries provides PLT (la_plt{enter,exit} > symbols). Otherwise, the slowdown can be avoided. > > The following patch adjusts the logic that enables profiling to iterate > over all audit modules and check if any of those provides a PLT hook. > > Co-authored-by: Alexander Monakov Please use my correct email here and in the Cc list (it's ispras.ru, not ispras.dot.ru). > --- > NEWS | 4 ++++ > elf/Makefile | 6 +++++- > elf/dl-reloc.c | 12 +++++++++++- > elf/rtld.c | 8 +------- > elf/tst-audit18.c | 39 +++++++++++++++++++++++++++++++++++++++ > elf/tst-auditmod18.c | 24 ++++++++++++++++++++++++ > include/link.h | 2 ++ > 7 files changed, 86 insertions(+), 9 deletions(-) > create mode 100644 elf/tst-audit18.c > create mode 100644 elf/tst-auditmod18.c > > diff --git a/NEWS b/NEWS > index 13ffe627da..8fde312ec6 100644 > --- a/NEWS > +++ b/NEWS > @@ -76,6 +76,10 @@ Major new features: > equal to a giver integer. This function is a GNU extension, although > Solaris also provides a similar function. > > +* The audit libraries will avoid unnecessary slowdown if it is not required "required for" or "... by"? > + either PLT tracking or symbol binding profiling (enabled with LA_FLG_BINDFROM > + or LA_FLG_BINDTO from la_objopen() callback). It seems the part about binding needs to be updated, because the commit message and the patch itself does not change anything for binding hooks? My understanding always was that no change is necessary w.r.t la_symbind callbacks: the loader invokes them when doing symbol resolution, and presence of PLT does not matter. Alexander