From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by sourceware.org (Postfix) with ESMTPS id C50383858401 for ; Mon, 27 Dec 2021 12:20:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C50383858401 Received: by mail-qv1-xf33.google.com with SMTP id h5so13602440qvh.8 for ; Mon, 27 Dec 2021 04:20:07 -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=MWOieRrBfp6PQual54jS1LuqWruPQqwxoekwipuDjEk=; b=VWOG/GmIZyDY00wjoGxrpBEhW2LKZpr6M3CMb0mDf2+PG53NFud8KJlYaG23+tiDd8 TrrbEXmYnZC+n8Aatk0wFbfPJC8LE8EgmyIfQxepnCTVdD76RzHROCxe5/+FbHThYQ3b 8xB9KwbuG16hH2PWEnhRnfyUGPsmahK8Q1kG7Ge0XndU5q27bpEU8ogLzNqs5grFFBa3 bc3jHDeEqdctW1Bet/FXvdVYye65EmdSkuMUy7geXKFwC88lCzgsM7aWgLpZzwomlBq3 BDmH067n3P92axlJjp2FhrGPKQG+tquhMKrx3E+786DZTjmKofV3cP145i1Cn3hsjmjc t+WQ== X-Gm-Message-State: AOAM533Y5cYGh7gS96TEAWz6hlICEoUoUxYFx5bM6f6nczzFBZm2rrcV l2LPoH7YgZKhXRYcD2N9GUsGWQ== X-Google-Smtp-Source: ABdhPJxbBbdKECdAP2ixVYVHsMB5m7bM6N74lae99OU9x7KXnhq98oYl969btObNm8d1+sLKn2czdA== X-Received: by 2002:a0c:a941:: with SMTP id z1mr14765407qva.71.1640607606924; Mon, 27 Dec 2021 04:20:06 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:3b1e:f218:7987:80e2:7249? ([2804:431:c7cb:3b1e:f218:7987:80e2:7249]) by smtp.gmail.com with ESMTPSA id c25sm13557369qkp.31.2021.12.27.04.20.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Dec 2021 04:20:06 -0800 (PST) Message-ID: Date: Mon, 27 Dec 2021 09:20:04 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v7 03/16] elf: Add _dl_audit_objsearch Content-Language: en-US To: Florian Weimer Cc: libc-alpha@sourceware.org, John Mellor-Crummey , Ben Woodard References: <20211222132712.523295-1-adhemerval.zanella@linaro.org> <20211222132712.523295-4-adhemerval.zanella@linaro.org> <8735mib42p.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <8735mib42p.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.8 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, 27 Dec 2021 12:20:09 -0000 On 24/12/2021 09:05, Florian Weimer wrote: > * Adhemerval Zanella: > >> diff --git a/elf/dl-load.c b/elf/dl-load.c >> index d1d02fa70e..cf15f85df6 100644 >> --- a/elf/dl-load.c >> +++ b/elf/dl-load.c >> @@ -1602,32 +1602,20 @@ open_verify (const char *name, int fd, > >> - if (fd != -1 && name != original_name && strcmp (name, original_name)) >> - { >> - /* An audit library changed what we're supposed to open, >> - so FD no longer matches it. */ >> - __close_nocancel (fd); >> - fd = -1; >> - } >> + if (fd != -1 && name != original_name && strcmp (name, original_name)) >> + { >> + /* An audit library changed what we're supposed to open, >> + so FD no longer matches it. */ >> + __close_nocancel (fd); >> + fd = -1; >> + } > > Spurious whitespace change, I think. Ack, it also leads to wrong indentation. I will fix it. > >> @@ -2066,36 +2054,17 @@ _dl_map_object (struct link_map *loader, const char *name, >> #ifdef SHARED >> /* Give the auditing libraries a chance to change the name before we >> try anything. */ >> - if (__glibc_unlikely (GLRO(dl_naudit) > 0) >> - && (loader == NULL || loader->l_auditing == 0)) >> + if (__glibc_unlikely (GLRO(dl_naudit) > 0)) >> { >> - struct audit_ifaces *afct = GLRO(dl_audit); >> - for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt) >> + const char *before = name; >> + name = _dl_audit_objsearch (name, loader, LA_SER_ORIG); >> + if (name == NULL) >> { >> - if (afct->objsearch != NULL) >> - { >> - const char *before = name; >> - struct auditstate *state = link_map_audit_state (loader, cnt); >> - name = afct->objsearch (name, &state->cookie, LA_SER_ORIG); >> - if (name == NULL) >> - { >> - /* Do not try anything further. */ >> - fd = -1; >> - goto no_file; >> - } >> - if (before != name && strcmp (before, name) != 0) >> - { >> - if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)) >> - _dl_debug_printf ("audit changed filename %s -> %s\n", >> - before, name); >> - >> - if (origname == NULL) >> - origname = before; >> - } >> - } >> - >> - afct = afct->next; >> + fd = -1; >> + goto no_file; >> } >> + if (before != name && strcmp (before, name) != 0) >> + origname = before; >> } >> #endif > > I had to stare at this for a bit, but the new handling of originame and > before should give the same result in the end. > > Reviewed-by: Florian Weimer > > Thanks, > Florian >