From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by sourceware.org (Postfix) with ESMTPS id A7A963858408 for ; Thu, 11 Nov 2021 11:51:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7A963858408 Received: by mail-ua1-x92f.google.com with SMTP id p2so11186506uad.11 for ; Thu, 11 Nov 2021 03:51:37 -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=gzBOx1s9hOcLVYWwrFzGHRk+i04L85ifb4UvyK+TAlI=; b=lBpx2cbziZB2zYhHR26vXtqDShPeNZT1IU+kZ29oaM9GLxu0z5oY0tVE7+I3fWjBBl hyft/UwSTpoDjqBZdZtlwgBjAQhsTSMKGp85IcDcFkVqUzrjog6raKXmaoEa4ppueXYg eGSpQ3QX846Pa2kTRh7GaseSlo2vxcJuLBIJq4qel1d+jr688oEeEUaAPfI9jZLzfVpF Vxa75zoRjHfsNcCvmVLSLp8XrycPUyYcZn5sXDi4ghDNHw9BDxPcDSoosHmgVqqYpOmL vPsCg8TCqIG1epCAmGgouSUCdrsOXaTAptGgb77+Yjdz00R2eB2LsrlKK9m6fbctH64y ZkzA== X-Gm-Message-State: AOAM530VMC1vNcr8OBcXMO+bne9/23rR7/Z3NgAbE/3jLbu/zeVYPQOe vjP5NuzyKDyLIMZ3mmSRX206VFH2ys0uDQ== X-Google-Smtp-Source: ABdhPJzhtHtbImGUbslkNrG3I2VV3JFP2Y8Pgie4NjH0AluhgBbxoMQ/bISloZMNVLi+DShF0RltZg== X-Received: by 2002:a05:6102:3588:: with SMTP id h8mr9436485vsu.7.1636631497180; Thu, 11 Nov 2021 03:51:37 -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 bb13sm1796098vkb.11.2021.11.11.03.51.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Nov 2021 03:51:36 -0800 (PST) Message-ID: Date: Thu, 11 Nov 2021 08:51:35 -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> From: Adhemerval Zanella In-Reply-To: <871r3o5c77.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 11:51:38 -0000 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.