public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org, John Mellor-Crummey <johnmc@rice.edu>,
	Ben Woodard <woodard@redhat.com>
Subject: Re: [PATCH v7 03/16] elf: Add _dl_audit_objsearch
Date: Mon, 27 Dec 2021 09:20:04 -0300	[thread overview]
Message-ID: <b2605bcb-e4f6-8aec-6e17-f1f99a42be6b@linaro.org> (raw)
In-Reply-To: <8735mib42p.fsf@oldenburg.str.redhat.com>



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 <fweimer@redhat.com>
> 
> Thanks,
> Florian
> 

  reply	other threads:[~2021-12-27 12:20 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 13:26 [PATCH v7 00/16] Multiple rtld-audit fixes Adhemerval Zanella
2021-12-22 13:26 ` [PATCH v7 01/16] elf: Add _dl_audit_objopen Adhemerval Zanella
2021-12-24 11:50   ` Florian Weimer
2021-12-22 13:26 ` [PATCH v7 02/16] elf: Add _dl_audit_activity_map and _dl_audit_activity_nsid Adhemerval Zanella
2021-12-24 11:58   ` Florian Weimer
2021-12-27 12:10     ` Adhemerval Zanella
2021-12-22 13:26 ` [PATCH v7 03/16] elf: Add _dl_audit_objsearch Adhemerval Zanella
2021-12-24 12:05   ` Florian Weimer
2021-12-27 12:20     ` Adhemerval Zanella [this message]
2021-12-22 13:27 ` [PATCH v7 04/16] elf: Add _dl_audit_objclose Adhemerval Zanella
2021-12-24 12:10   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 05/16] elf: Add _dl_audit_symbind_alt and _dl_audit_symbind Adhemerval Zanella
2021-12-24 12:42   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 06/16] elf: Add _dl_audit_preinit Adhemerval Zanella
2021-12-24 12:47   ` Florian Weimer
2021-12-24 12:53   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 07/16] elf: Add _dl_audit_pltenter Adhemerval Zanella
2021-12-24 13:57   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 08/16] elf: Add _dl_audit_pltexit Adhemerval Zanella
2021-12-24 14:17   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 09/16] elf: Avoid unnecessary slowdown from profiling with audit (BZ#15533) Adhemerval Zanella
2021-12-24 16:05   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 10/16] elf: Add audit tests for modules with TLSDESC Adhemerval Zanella
2021-12-24 16:55   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 11/16] elf: Do not fail for failed dlmopen on audit modules (BZ #28061) Adhemerval Zanella
2021-12-22 13:27 ` [PATCH v7 12/16] elf: Fix initial-exec TLS access on audit modules (BZ #28096) Adhemerval Zanella
2021-12-24 17:17   ` Florian Weimer
2021-12-27 20:13     ` Adhemerval Zanella
2021-12-22 13:27 ` [PATCH v7 13/16] elf: Issue audit la_objopen for vDSO Adhemerval Zanella
2021-12-24 17:44   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 14/16] elf: Add la_activity during application exit Adhemerval Zanella
2021-12-24 17:50   ` Florian Weimer
2021-12-22 13:27 ` [PATCH v7 15/16] elf: Issue la_symbind for bind-now (BZ #23734) Adhemerval Zanella
2021-12-24 18:50   ` Florian Weimer
2021-12-27 20:17     ` Adhemerval Zanella
2021-12-22 13:27 ` [PATCH v7 16/16] elf: Fix runtime linker auditing on aarch64 (BZ #26643) Adhemerval Zanella
2021-12-24 18:53   ` Florian Weimer
2021-12-27 20:31     ` Adhemerval Zanella
2021-12-24 11:49 ` [PATCH v7 00/16] Multiple rtld-audit fixes Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2605bcb-e4f6-8aec-6e17-f1f99a42be6b@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=johnmc@rice.edu \
    --cc=libc-alpha@sourceware.org \
    --cc=woodard@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).