From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 334441F461 for ; Tue, 3 Sep 2019 06:30:42 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:date :mime-version:in-reply-to:content-type:content-transfer-encoding :message-id; q=dns; s=default; b=G/vVv752Eirli5G5+Ufb62mY1NoFuh8 DwH8qg+RzwiFlLePz2fAWGksT8uMpTOH4a8gF6EHuPdGre7jKWfIDiNCqNY5HbhS H9W2r5dfh+fIlJ1V7slk5kAZgEjT2PVkC6/IMYH/jAup5egLJ6IaodkbggYm3DHp 3nOm8t/8IwrE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:date :mime-version:in-reply-to:content-type:content-transfer-encoding :message-id; s=default; bh=xScODtqdSIAzpaHU0AN6BI644nk=; b=Pw1MD 7Ev8y2YmIjnWbBxBwKZ05Hvf6B9jjiHI8mDJE1m0E+QwpRVHsUyZgoZSAQLEZzVd LiFv8ctNpunoDBenYkUexIqE9PaKGEg8VGy9ZBKdK+A9++rwsPqnH4wtJuuimg1h SnGQe3KM+4539VcxIcFh/h+y75yvBehdDUSWOo= Received: (qmail 49907 invoked by alias); 3 Sep 2019 06:30:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 49893 invoked by uid 89); 3 Sep 2019 06:30:39 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx0a-001b2d01.pphosted.com Subject: Re: [PATCH] Add UNSUPPORTED check in elf/tst-pldd. To: Adhemerval Zanella , Florian Weimer Cc: libc-alpha@sourceware.org References: <877e6yiqsn.fsf@oldenburg2.str.redhat.com> <3b9cb5e4-7c9a-c9a4-449e-43ba98a6ad01@linaro.org> <32961942-e67b-c356-a92d-b6e45c8aaf9d@linux.ibm.com> <87blw9fxrp.fsf@oldenburg2.str.redhat.com> <1d419974-c973-c4c1-f1cd-4bbbf8b074f8@linux.ibm.com> <87tva08ijw.fsf@oldenburg2.str.redhat.com> From: Stefan Liebler Date: Tue, 3 Sep 2019 08:30:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit x-cbid: 19090306-0008-0000-0000-0000031052F9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19090306-0009-0000-0000-00004A2EA2D8 Message-Id: <158c26d5-a6cc-37a9-2b23-dc8a45f52217@linux.ibm.com> On 9/2/19 9:37 PM, Adhemerval Zanella wrote: > > > On 29/08/2019 05:47, Florian Weimer wrote: >> * 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? > > Do we really need that ad-hoc support on tst-pldd to make it support > ptrace_scope 1? > > I don't oppose the support Stefan has added on latest iteration to > make it work, but this is a lot of code to support a very specific > scenario... > As there are systems where ptrace_scope is configured to 1 by default, we should adjust the testcase as the FAIL is misleading. (I've just recognized that Steve Ellcey had also seen this FAIL: https://www.sourceware.org/ml/libc-alpha/2019-07/msg00618.html) The minimum change should be to detect ptrace_scope == 1 and mark the test as UNSUPPORTED. Or we change a bit more and let the test also run in this scenario. (Either by support_ptrace_process_set_ptracer_any or adjusting the subprocess-tree) Bye Stefan