From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BDA323857810 for ; Fri, 21 Jan 2022 10:51:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BDA323857810 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-Gf5jBWiPObS4ZwNvJ5HqUA-1; Fri, 21 Jan 2022 05:51:04 -0500 X-MC-Unique: Gf5jBWiPObS4ZwNvJ5HqUA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 145FF192AB7A; Fri, 21 Jan 2022 10:51:03 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D36866F95D; Fri, 21 Jan 2022 10:50:50 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: Adhemerval Zanella via Libc-alpha , jma14 , Carlos O'Donell , John Mellor-Crummey Subject: Re: [PATCH v10 1/4] elf: Add la_activity during application exit References: <20220117213136.1327053-1-adhemerval.zanella@linaro.org> <20220117213136.1327053-2-adhemerval.zanella@linaro.org> <87v8yhjn97.fsf@oldenburg.str.redhat.com> Date: Fri, 21 Jan 2022 11:50:48 +0100 In-Reply-To: (Adhemerval Zanella's message of "Tue, 18 Jan 2022 10:10:40 -0300") Message-ID: <8735lh8irb.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Fri, 21 Jan 2022 10:51:10 -0000 * Adhemerval Zanella: > On 18/01/2022 08:29, Florian Weimer wrote: >> * Adhemerval Zanella via Libc-alpha: >> >>> diff --git a/elf/dl-fini.c b/elf/dl-fini.c >>> index de8eb1b3c9..2705a15c88 100644 >>> --- a/elf/dl-fini.c >>> +++ b/elf/dl-fini.c >>> @@ -64,6 +64,11 @@ _dl_fini (void) >>> __rtld_lock_unlock_recursive (GL(dl_load_lock)); >>> else >>> { >>> +#ifdef SHARED >>> + /* Auditing checkpoint: we will start deleting objects. */ >>> + _dl_audit_activity_nsid (ns, LA_ACT_DELETE); >>> +#endif >>> + >>> /* Now we can allocate an array to hold all the pointers and >>> copy the pointers in. */ >>> struct link_map *maps[nloaded]; >>> @@ -153,6 +158,11 @@ _dl_fini (void) >>> /* Correct the previous increment. */ >>> --l->l_direct_opencount; >>> } >>> + >>> +#ifdef SHARED >>> + /* Auditing checkpoint: we will start deleting objects. */ >>> + _dl_audit_activity_nsid (ns, LA_ACT_CONSISTENT); >>> +#endif >>> } >>> } >> >> The tense in the second comment seems wrong. > > Ack, in fact I think both comments do not add much (it is pretty obvious > from the function call). I will remove them. > >> >>> >>> diff --git a/elf/tst-audit23.c b/elf/tst-audit23.c >>> new file mode 100644 >>> index 0000000000..9a7e69c1e1 >>> --- /dev/null >>> +++ b/elf/tst-audit23.c >> >>> + FILE *out = fmemopen (result.err.buffer, result.err.length, "r"); >>> + TEST_VERIFY (out != NULL); >>> + char *buffer = NULL; >>> + size_t buffer_length = 0; >>> + while (xgetline (&buffer, &buffer_length, out)) >>> + { >>> + if (startswith (buffer, "la_activity: ")) >> >> It may be simpler (or easier to maintain going forward) to have the >> expected output (without varying pointers) and compare against that >> verbatim. This is what I implemented for some of the DNS tests. > > The main issue is to handle the vDSO (is_vdso) and match the cookies > and address with the subsequent la_activities/la_objclose. So it > would require to keep track with some internal state anyway. > > And checking on resolve/tst-ns_name.c I don't think it would be > simpler to use such scheme (specially the required handling it would > require to parse a possible input to handle line with multiple options > and different outputs). Okay, I just found the existing test rather difficult to review. Thanks, Florian