From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 16CE138515FC for ; Mon, 19 Jul 2021 13:17:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16CE138515FC Received: by mail-pg1-x52b.google.com with SMTP id y4so18916528pgl.10 for ; Mon, 19 Jul 2021 06:17:44 -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=vBwQ/FNg9/d/NPiYt4Kv+3xbMAARCO6cwYfFdLPNWB8=; b=kzFRj/lNFl+meV/v2el/f4Uyc06dUoigtx2jLnWA1vgln/XEyvbEaZzFz2Zf+t0U76 nQi5iyBjJ016bBMYemMbrVLicIA1zCTs6EACIqAfC/lQdQLpHSvMOBhjXGYtIBGwMy+X vxGsd2hhiRYnLiqfH47j9bZAmCZER7AAaZ+Hp+3qrYoimfRdYMwkqVEnPtokT7VG5XXP g3nOxS5vJxIrwOZax8Yl/eK3IYRXYmXQENFFJkR0VxZxiFBL4ca0oGArIfIrany43DXu 47HOogFx0ofYBIZ6cZsmtdYznh5gHEgQK+Jnh+m/wIUzxa0JGQuByyfZ7frs/i7OaS9S xW1A== X-Gm-Message-State: AOAM532FJlydvEUPqxCKyDQ5neZ6hl8jLtVnPG06dbPD2VwEi+zCRLPJ gjYTx5+1gGkgMHKm3T8bzVuIyw== X-Google-Smtp-Source: ABdhPJwByz1YoQLdxzsCj/x+dKQiCNJox9LuVmWDJQa0Ewo1ST+EGeSXGp6ZvYpKrvJRQ09MfpFTjQ== X-Received: by 2002:a05:6a00:170b:b029:32a:3950:f51b with SMTP id h11-20020a056a00170bb029032a3950f51bmr26176741pfc.64.1626700663149; Mon, 19 Jul 2021 06:17:43 -0700 (PDT) Received: from ?IPv6:2804:431:c7ca:1133:c8a4:b05d:5ba9:3665? ([2804:431:c7ca:1133:c8a4:b05d:5ba9:3665]) by smtp.gmail.com with ESMTPSA id s7sm19158487pfk.12.2021.07.19.06.17.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Jul 2021 06:17:42 -0700 (PDT) Subject: Re: [PATCH 2/5] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha , John Mellor-Crummey References: <20210707182610.3940620-1-adhemerval.zanella@linaro.org> <20210707182610.3940620-3-adhemerval.zanella@linaro.org> <87pmvu0w3z.fsf@oldenburg.str.redhat.com> <3615d91e-397c-1fd2-0c21-caee85bddd36@linaro.org> <875yxl283n.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Message-ID: Date: Mon, 19 Jul 2021 10:17:40 -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: <875yxl283n.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.7 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: Mon, 19 Jul 2021 13:17:47 -0000 On 07/07/2021 17:15, Florian Weimer wrote: > * Adhemerval Zanella: > >> On 07/07/2021 16:20, Florian Weimer wrote: >>> * Adhemerval Zanella via Libc-alpha: >>> >>>> diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c >>>> index e13a672ade..998cfef099 100644 >>>> --- a/elf/dl-reloc.c >>>> +++ b/elf/dl-reloc.c >>>> @@ -181,7 +181,18 @@ _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->symbind != NULL >>>> + || afct->ARCH_LA_PLTENTER != NULL >>>> + || afct->ARCH_LA_PLTEXIT != NULL) >>>> + consider_profiling = 1; >>>> + afct = afct->next; >>>> + } >>>> + } >>> >>> Is the afct->symbind check really necessary? Looking at _dl_fixup, it >>> should be safe to call symbind with just the standard trampoline. >> >> Yes, elf/tst-audit18b check specifically for this. Without it, >> returning LA_FLG_BINDFROM | LA_FLG_BINDTO from la_objopen() won't >> trigger a la_symbind{32,64}. > > Hmm, I'm surprised we get a la_symbind call with BIND_NOW at all. And > for BIND_NOW the choice of trampoline really should not matter anyway. > > Anyway, I think we have a feature request that without > la_ltenter/la_pltexit defined, the presence of la_symbind should not > incur the overhead from the profiling trampoline. The afct->symbind > check defeats that. Indeed, we will need to track the la_symbind for bind-now in a different fix then. I will update the patch.