From patchwork Tue Aug 27 10:19:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1153712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-104748-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="l7HgRrZV"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 46HlH34d7Tz9s00 for ; Tue, 27 Aug 2019 20:19:42 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:mime-version:content-type :message-id; q=dns; s=default; b=PVWsceUWPDrW1tdk1/rshNp8lHOuPk4 nE7fO+VSUkEF9YzvVplzhFhMlMhF/FAoczwL5AbkRmlnIbwwVFq6A93GLRvA8wMH GkUFf84IwBJeOOCLczhEZ7F5imyR1FEBgEqwRSptUVYKR06mhVsNLqVxiE87uX62 jkVQr6n1oGFE= 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:to:from:subject:date:mime-version:content-type :message-id; s=default; bh=i3tubguBVjx27wU1K75QF/KkdEc=; b=l7HgR rZVwEoDyWIufZGtZYdXCAJM2vcMiSaBpTGRZP56nSHHs7PLO+x66mRWJlzIGqvRR Y/tw3Y5chsaOH8QyxshqXb9KsmBx8EzJjFW782CGCPdC1+X6/ymPNeATicvZk0u3 tsSJkJAgfylVJzMj4RJcuE3t/yCeAbhBlY91yM= Received: (qmail 121497 invoked by alias); 27 Aug 2019 10:19:37 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 121457 invoked by uid 89); 27 Aug 2019 10:19:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1924, Stefan, stefan X-HELO: mx0a-001b2d01.pphosted.com To: GNU C Library From: Stefan Liebler Subject: [PATCH] Add UNSUPPORTED check in elf/tst-pldd. Date: Tue, 27 Aug 2019 12:19:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 x-cbid: 19082710-0012-0000-0000-000003436F00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082710-0013-0000-0000-0000217DA6ED Message-Id: Hi, the testcase forks a child process and runs pldd with PID of this child. On systems where /proc/sys/kernel/yama/ptrace_scope differs from zero, pldd will fail with /usr/bin/pldd: cannot attach to process 3: Operation not permitted This patch checks if ptrace_scope is zero and otherwise marks the test as UNSUPPORTED. Bye Stefan ChangeLog: * elf/tst-pldd.c (do_test): Add UNSUPPORTED check. Reviewed-by: Adhemerval Zanella commit 9c0b03c38bdd31618909da46b8bd4e09b5a236d2 Author: Stefan Liebler Date: Mon Aug 26 15:45:07 2019 +0200 Add UNSUPPORTED check in elf/tst-pldd. The testcase forks a child process and runs pldd with PID of this child. On systems where /proc/sys/kernel/yama/ptrace_scope differs from zero, pldd will fail with /usr/bin/pldd: cannot attach to process 3: Operation not permitted This patch checks if ptrace_scope is zero and otherwise marks the test as UNSUPPORTED. ChangeLog: * elf/tst-pldd.c (do_test): Add UNSUPPORTED check. diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c index 6b7c94a1c0..3f211dc342 100644 --- a/elf/tst-pldd.c +++ b/elf/tst-pldd.c @@ -52,6 +52,24 @@ in_str_list (const char *libname, const char *const strlist[]) static int do_test (void) { + /* Check if all processes can be debugged with ptrace. */ + { + FILE *f = fopen ("/proc/sys/kernel/yama/ptrace_scope", "r"); + if (f != NULL) + { + /* If ptrace_scope exists, then it has to be 0 which means + "classic ptrace permissions". A process can PTRACE_ATTACH + to any other process running under the same uid, as long as + it is dumpable. Otherwise pldd will fail to attach to the + subprocess. */ + int i = 99; + fscanf (f, "%d", &i); + fclose (f); + if (i != 0) + FAIL_UNSUPPORTED ("/proc/sys/kernel/yama/ptrace_scope != 0"); + } + } + /* Create a copy of current test to check with pldd. */ struct support_subprocess target = support_subprocess (target_process, NULL);