unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Stefan Liebler <stli@linux.ibm.com>
Cc: libc-alpha@sourceware.org,
	 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: [PATCH] Add UNSUPPORTED check in elf/tst-pldd.
Date: Thu, 29 Aug 2019 10:47:15 +0200	[thread overview]
Message-ID: <87tva08ijw.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <1d419974-c973-c4c1-f1cd-4bbbf8b074f8@linux.ibm.com> (Stefan Liebler's message of "Wed, 28 Aug 2019 16:42:42 +0200")

* Stefan Liebler:

> On 8/28/19 11:24 AM, Florian Weimer wrote:
>> * Stefan Liebler:
>>
>>>   static void
>>>   target_process (void *arg)
>>>   {
>>> +  if (ptrace_scope == 1)
>>> +    {
>>> +      /* YAMA is configured to "restricted ptrace".
>>> +	 Disable the restriction for this subprocess.  */
>>> +      support_ptrace_process_set_ptracer_any ();
>>> +    }
>>> +
>>>     pause ();
>>>   }
>>
>> I think this has a race condition if pldd attaches to the process before
>> the support_ptrace_process_set_ptracer_any call.  I have no idea how
>> hard it is in practice to hit this race.  It should be possible to use a
>> process-shared barrier or some other form of synchronization to avoid
>> this issue.
>>
>> Thanks,
>> Florian
>>
>
> I've added a synchronization with stdatomic.h on a shared memory mapping.
> I've not used pthread* functions as I don't want to link against
> libpthread.so. Then further adjustments are needed.
>
> Or should I just restrict the test ptrace_scope 0 as Adhemerval has
> proposed in his post?

Is it possible to create a process tree like this?


  parent (performs output checks)
    subprocess 1 (becomes pldd via execve)
      subprocess 2

If you execve pldd from subprocess 1, wouldn't subprocess 2 in its
ptrace scope for ptrace_scope < 2?

Thanks,
Florian

  reply	other threads:[~2019-08-29  8:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 10:19 [PATCH] Add UNSUPPORTED check in elf/tst-pldd Stefan Liebler
2019-08-27 15:06 ` Adhemerval Zanella
2019-08-27 15:14   ` Florian Weimer
2019-08-27 19:11     ` Adhemerval Zanella
2019-08-28  9:06       ` Stefan Liebler
2019-08-28  9:24         ` Florian Weimer
2019-08-28 14:42           ` Stefan Liebler
2019-08-29  8:47             ` Florian Weimer [this message]
2019-09-02 15:28               ` Stefan Liebler
2019-09-17 13:31                 ` Adhemerval Zanella
2019-09-17 15:17                   ` Stefan Liebler
2019-09-18 10:45                     ` Stefan Liebler
2019-09-18 15:17                       ` Joseph Myers
2019-09-19 10:28                         ` Stefan Liebler
2019-09-02 19:37               ` Adhemerval Zanella
2019-09-03  6:30                 ` Stefan Liebler
2019-09-03 13:34                   ` Adhemerval Zanella
2019-09-06  3:21                     ` Carlos O'Donell
2019-09-10  8:46                       ` Stefan Liebler
2019-09-10 13:32                         ` Adhemerval Zanella
2019-09-11  7:05                           ` Stefan Liebler
2019-08-28 12:19         ` Adhemerval Zanella

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=87tva08ijw.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=stli@linux.ibm.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).