From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) by sourceware.org (Postfix) with ESMTPS id A61653857C53 for ; Thu, 11 Nov 2021 12:25:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A61653857C53 Received: by mail-ua1-x930.google.com with SMTP id p2so11386355uad.11 for ; Thu, 11 Nov 2021 04:25:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=QZc7KiczYEaFmqmNTataLqr2xVZi+1swf5xPu70IomM=; b=jyb3GQ8KPGBGi6AUKBmMrK7qnvvUc9JqlusB6I7bbXmsmeAeKYUhmHcewfDK0rndew YRwvSk5n+psFV02oVIgY/pXQI5PWUUyFz55eiJj1VhBleJuCDBkT/6PUhVemNsvS/lIH W0xBUQrXWbcUrzxYO1VSOBojyQewxkiEMWIBTAN1vwzLypg9RlQllo6IWKQ493ZOiOOw 2nrRTOcZzBNoBZRJPnDdD8gBICIz511m4PL0WFUmcIgugl+U3/5ZkQ8opvr41+Qcfohk XxmE9oPlyfiSDlD77/gngI5EzynIbaZk4/NHh77b1WjAAEfRHvtDgUeD/dFsgETEjiXz E/rA== X-Gm-Message-State: AOAM531GR4vW91NBgiJt94FA+vdEFn+K48HcL+RhUIU+uTBf2KYWogNC L01btqdyarrXW1ILLxAtkqMOtY6jU96PLw== X-Google-Smtp-Source: ABdhPJy5qOlwQqg8GK3zqLosesNlev3eF6MNTPC+9FhJaZ4GWxOcwmiP3sMrNwm8vzISEHm5vvxDeg== X-Received: by 2002:ab0:44e:: with SMTP id 72mr9809671uav.121.1636633532222; Thu, 11 Nov 2021 04:25:32 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:55a:48f2:1d0b:8ae8:643a? ([2804:431:c7cb:55a:48f2:1d0b:8ae8:643a]) by smtp.gmail.com with ESMTPSA id b13sm1860592vkn.38.2021.11.11.04.25.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Nov 2021 04:25:31 -0800 (PST) Message-ID: Date: Thu, 11 Nov 2021 09:25:29 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH v5 04/22] elf: Suppress audit calls when a (new) namespace is empty (BZ #28062) Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org, John Mellor-Crummey , Ben Woodard , Vivek Das Mohapatra References: <20211109183347.2943786-1-adhemerval.zanella@linaro.org> <20211109183347.2943786-5-adhemerval.zanella@linaro.org> <871r3o5c77.fsf@oldenburg.str.redhat.com> <87o86qzyrk.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87o86qzyrk.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-15.5 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: Thu, 11 Nov 2021 12:25:34 -0000 On 11/11/2021 09:02, Florian Weimer wrote: > * Adhemerval Zanella: > >> On 10/11/2021 11:15, Florian Weimer wrote: >>> * Adhemerval Zanella: >>> >>>> diff --git a/elf/dl-load.c b/elf/dl-load.c >>>> index 9f4fa9617d..72298776f6 100644 >>>> --- a/elf/dl-load.c >>>> +++ b/elf/dl-load.c >>>> @@ -1067,8 +1067,11 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, >>>> && __glibc_unlikely (GLRO(dl_naudit) > 0)) >>>> { >>>> struct link_map *head = GL(dl_ns)[nsid]._ns_loaded; >>>> - /* Do not call the functions for any auditing object. */ >>>> - if (head->l_auditing == 0) >>>> + /* Do not call the functions for any auditing object and also do not >>>> + try to call auditing functions if the namespace is currently >>>> + empty. This happens when opening the first DSO in a new >>>> + namespace. */ >>>> + if (head != NULL && head->l_auditing == 0) >>>> { >>>> struct audit_ifaces *afct = GLRO(dl_audit); >>>> for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) >>> >>> As far as I can tell, using GL(dl_ns)[nsid]._ns_loaded for la_activity >>> is a completely arbitrary choice. I think we should use >>> &GL(dl_ns)[nsid] for secondary namespace instead, and keep >>> GL(dl_ns)[LM_ID_BASE]._ns_loaded for backwards compatibility. >>> >>> This will allow us to generate an LA_ACT_ADD event for an empty >>> namespace. >> >> I am not really following you here, '&GL(dl_ns)[nsid]' is just the container >> here, we need to iterate over the 'link_maps' within it. > > Hmm. I had a peeked at the Solaris documentation, and it says that > LA_ACT_ADD uses the head link map of the namespace as a cookie. > > I really dislike that we produce a LA_ACT_DELETE without the > corresponding LA_ACT_ADD due to this issue. > > Can we use the link map allocated used _dl_new_object as the cookie if > the namespace is empty? This seems like the right thing to do here. > The allocation happens just a few lines further down. But afaiu the LA_ACT_ADD activity is to inform already loaded objects that a new object is being processed. Both man-pages and Solaris documentation states 'objects are *being added*...', so I think passing the cookie of the new allocated is not what the interface is suppose to do.