From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 852F51F5AE for ; Tue, 20 Jul 2021 18:37:29 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6E32C3989C23 for ; Tue, 20 Jul 2021 18:37:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E32C3989C23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626806248; bh=EFPx0MKc+KRx9XntsXdbiL6yZ9JwfHmyY3l+Tkt1NY4=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Nk1u3tq/9ZS77W7GKfiAKYNtn1KQzsVriD+zAng65SOPpTI3HfEjpDrwe8qe1VfgG AlYthxyZLlnvuQQEu6mteG+IJTBryaJpmhiBDuQ5NpFKAZP6xpOKJ+yexTjOM6XOXv J/0mqGZ117nPKNZq2VmAntGPBeQxEKUpNH8StUxA= Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 2CD40385B83D for ; Tue, 20 Jul 2021 18:37:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2CD40385B83D Received: by mail-pg1-x534.google.com with SMTP id u14so23321940pga.11 for ; Tue, 20 Jul 2021 11:37:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EFPx0MKc+KRx9XntsXdbiL6yZ9JwfHmyY3l+Tkt1NY4=; b=XjXXsR2DOvsYiBOWQuKgtFtAOHdCbjUoiMkw0orluWJASe8gSBND6wgFKISqDreb+O mRJVuRO1RD6HMy43XVxnU4Ee2eGnNS5pn5beLYZmwfdQXaFTJhWW1rW1o7h0Q3lmeFxr SMk9bxHHO4QPysVe4/BVtkoFbwjDE/Xd7J/f2wFx50eYYmdybo5QWzlXeBk+oieq52i/ s1IxwUgm7wBYB+VMqZL/0cRJ5RexLrXWYNG7w0hHfT1sdlczI/PfNFXjiQNIJE+cgLcU +TL8blcWZALw0avraBriw2Y5D/EdUUIceWzBf2KTEp8Peb+loh/eaoOmFK6b3dra4ekT U81A== X-Gm-Message-State: AOAM533sNz4uxDfBf8SWzdamAmKTV3DIW1ajgwMwxSpdojTHZHbkVWIu T1nzJNXzoRtEs+8TzFdzzr9C+A== X-Google-Smtp-Source: ABdhPJwNz8wr8W/0DNPt81V3cnTqkCvqQVZjiDOn9wrMkfUpyTSeRnewvsv0dyrPzkuNV77Z6sZu/Q== X-Received: by 2002:a63:dc15:: with SMTP id s21mr3799673pgg.281.1626806228008; Tue, 20 Jul 2021 11:37:08 -0700 (PDT) Received: from ?IPv6:2804:431:c7ca:1133:f2b4:82f6:95e1:c3d2? ([2804:431:c7ca:1133:f2b4:82f6:95e1:c3d2]) by smtp.gmail.com with ESMTPSA id y28sm18214247pff.137.2021.07.20.11.37.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Jul 2021 11:37:07 -0700 (PDT) Subject: Re: [PATCH v2 2/6] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) To: Alexander Monakov References: <20210719143309.2848878-1-adhemerval.zanella@linaro.org> <20210719143309.2848878-3-adhemerval.zanella@linaro.org> Message-ID: Date: Tue, 20 Jul 2021 15:37:05 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Cc: Alexander Monakov , John Mellor-Crummey , libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 20/07/2021 05:31, Alexander Monakov wrote: > 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). Ack, I used the one on previous submission. I will update with the correct one > >> --- >> 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. The NEWS entry needs update indeed. For 'la_symbind', I was trying to handle a different issue which in turn made this very change ineffective (issue la_symbind for bind-now). My plan is to address it in a different patch.