From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id 496BA385040C for ; Tue, 27 Jul 2021 16:13:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 496BA385040C Received: by mail-pj1-x102c.google.com with SMTP id j1so18483778pjv.3 for ; Tue, 27 Jul 2021 09:13:01 -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:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OnnFTRiVqpAcxEKlrZSgj7u6WjhxdC3FdOH46LVM66c=; b=UvJqcyQJCYDAHi0zwLo4CesG3hfj6oPgoj0r4/Oca1qXRnwdYcscJsvTg64GDd+69o mysVcZLVlf4NEH0k2jJotmaou5aAv/Tl0LI21L3KqgBNCeRI8SfDaBZelQHR7XnuGtPa AX3fkeMt9n9uZ357ArPcqAytTxRniRuXqrZDveo3HznMkoB44bbvzGdv6MF79ewPIsjg sYqQ3i0a2AFEe8nlMK7FvygvlwmYB3SSkHN6LkoiWEdOkPNFjkBWgutHTgVAPpTKSJ0l vkDXFWi7k34nIcg0Oi8YenBBDxvbVKqkwEa3fTj1QOGiRKZywe5qm3mOybUm9eOw9YK+ Sphg== X-Gm-Message-State: AOAM530VCN2os2eJzTDOagYJm5U/XPJkeYsYK0No2yeXqMbC98uI1SPi FrOpq3/hZOU2NiR9AQbKE7LBWBGiTeB+nA== X-Google-Smtp-Source: ABdhPJxrBQdMZXyVWCa22G3Tx6FHJkYiS2ojedBNVzbcWIrkhfOKkjx/KrOJ99yRnU87vqlD6ePQYA== X-Received: by 2002:a63:d443:: with SMTP id i3mr10537542pgj.391.1627402380388; Tue, 27 Jul 2021 09:13:00 -0700 (PDT) Received: from ?IPv6:2804:431:c7cb:43e2:4a40:c26e:f2a3:5cf8? ([2804:431:c7cb:43e2:4a40:c26e:f2a3:5cf8]) by smtp.gmail.com with ESMTPSA id j21sm3305010pjz.26.2021.07.27.09.12.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Jul 2021 09:12:59 -0700 (PDT) Subject: Re: [PATCH v2 2/6] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: John Mellor-Crummey , Ben Woodard , Alexander Monakov References: <20210719143309.2848878-1-adhemerval.zanella@linaro.org> <20210719143309.2848878-3-adhemerval.zanella@linaro.org> Message-ID: <7946bdd1-1a2a-a3c7-d1d8-d8e44232c57e@linaro.org> Date: Tue, 27 Jul 2021 13:12:57 -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: <20210719143309.2848878-3-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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, 27 Jul 2021 16:13:05 -0000 On 19/07/2021 11:33, Adhemerval Zanella wrote: > diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c > index e13a672ade..2abcfc996f 100644 > --- a/elf/dl-reloc.c > +++ b/elf/dl-reloc.c > @@ -181,7 +181,17 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], > #ifdef SHARED > /* If we are auditing, install the same handlers we need for profiling. */ > if ((reloc_mode & __RTLD_AUDIT) == 0) > - consider_profiling |= GLRO(dl_audit) != NULL; > + { > + struct audit_ifaces *afct = GLRO(dl_audit); > + for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) > + { > + /* Profiling is needed only if PLT hooks are provided. */ > + if (afct->ARCH_LA_PLTENTER != NULL > + || afct->ARCH_LA_PLTEXIT != NULL) > + consider_profiling = 1; > + afct = afct->next; > + } > + } > #elif defined PROF This is wrong since it disables la_symbind() for lazy resolution if the audit modules does not provide the plt callbacks as well. I will update the patch to now call la_symbind() on _dl_fixup() if la_symbind() is set.