From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 36C453857C4C for ; Tue, 18 Jan 2022 13:10:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 36C453857C4C Received: by mail-oi1-x233.google.com with SMTP id x193so28366073oix.0 for ; Tue, 18 Jan 2022 05:10:44 -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=BHnGs3XlQ708WxXMMotVQs/aPTrscf42wDqXlg3BHIc=; b=uIoygmI1h8KA4kwJoKh2pQIi8zNEeHHkOZNd7119HHAKiZVPkQRAYqUx34murCURK4 geDk69oo01SkOmgn5JVuqa4hmL/ILt1rmFcTKgN2BRSeIelJ/q6y+JvB4RmHpdP+b8rK YhO0lcOMD+LM9oJNjaICazqwtKUq96TChaK0kP+neIYkiKvMhiA5QaVWOzaYyfHhYNoV UYCxhYzrOWN1MVzMuJxR+vUDKAk4NV1nKbPxikAEHDAOmkwlSfaenm5pyASnaFqWVJYO OcFIGrB8ZWOaikDWnz1OVVkW9CjsPluVi/LqJu5NnpScHcchnJb6nLULyOgl8I4OBBtz Q8xg== X-Gm-Message-State: AOAM533oCUUHeuRBKKmyOCeCn8uJPuMBEk2ASEHKHY/0weleLTgL9RSd 7FYlbwOj9MzrBiVANm62sb44Qw== X-Google-Smtp-Source: ABdhPJxWlr2ENgZHLmYHvGrKLGOXAj1ksDnZKfXv8SKa7M1pJsqqYpqEeBMXfR9bebXDaoVRByz3HQ== X-Received: by 2002:aca:130f:: with SMTP id e15mr9163328oii.153.1642511443666; Tue, 18 Jan 2022 05:10:43 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:989a:d7f1:4df2:e2ef:5281? ([2804:431:c7cb:989a:d7f1:4df2:e2ef:5281]) by smtp.gmail.com with ESMTPSA id j77sm8122282oih.35.2022.01.18.05.10.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Jan 2022 05:10:43 -0800 (PST) Message-ID: Date: Tue, 18 Jan 2022 10:10:40 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v10 1/4] elf: Add la_activity during application exit Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha Cc: jma14 , Carlos O'Donell , John Mellor-Crummey References: <20220117213136.1327053-1-adhemerval.zanella@linaro.org> <20220117213136.1327053-2-adhemerval.zanella@linaro.org> <87v8yhjn97.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87v8yhjn97.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 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, 18 Jan 2022 13:10:47 -0000 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).