Received: by 10.213.65.68 with SMTP id h4csp850432imn; Tue, 27 Mar 2018 09:56:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49c2aY/sVE9LJzqExndt+yJgkfo0W/5vChA88Ybk2Nd1/VNfedyQCaukfcunljmEYgjhi6/ X-Received: by 2002:a17:902:724b:: with SMTP id c11-v6mr114122pll.192.1522169786526; Tue, 27 Mar 2018 09:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169786; cv=none; d=google.com; s=arc-20160816; b=AqCxJrMCMgAis9SYoQYJn98qZ426oKZlWJHTNIRILkKa2CD/BAluZA1tYDpo0uqngV OaShVNVwtyrnmiDIpCWv/bnARDrUZ1psDkxJfgok6UgT3ulIkWZ+DeOagksz4SqOcbu9 xZlupqvzciMh/8scIfnTOjaoFv6fOITBAVKxpJSdpHTzavEd9QjhnK41Q0siq/K9rSII JKOuKdwZVu/DCBNSWuM3YwSJmYYWOiHfUX3sy3XvPFvWr2ndUp+tuFAfM6m3cmIusoUc GyewVco+O5T+6TMihxL37k0tTIBRON0DGK8wrCchfz6TNb16ZrWvsM2j+sJgTxgjz2T2 0XZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LbCAhuTDqc3p/Z8N5KzN3BMljeqxw+E0x4SXHKxLypM=; b=G9XzRvSWK2CKK4fsgIL6at0DWWuB7m4waIltDrGTCwKhA3LVWEjY8Gx8B8Z7hzUuDS UXZ2DiVegHu3aO9FqUUjWUwkzOmdnudtqBGiLfbR8xWFUJfuRupLGrcYYdNI2VVgyM3P sku77QeyUNi6KCJsXiNVspb1IGWc0+2nrftbKQMxyvgs3XObH7RJC6K9kmCWC1Z/OVr1 sPFma5ee+DzvADu51vVHkH7Ero78HVkF+ZOkc+b/t8Pj+eeWyEvKoorwDlGn92tpWPxR 2KK6MJFTSZj9JESr3sJKsadMpyTpIijYMF6q4KmviBeEXgr3MQALafCJ5dhlYWjW1yi1 j2Ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h126si1085826pgc.817.2018.03.27.09.56.11; Tue, 27 Mar 2018 09:56:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932688AbeC0QmQ (ORCPT + 99 others); Tue, 27 Mar 2018 12:42:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48940 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbeC0QmM (ORCPT ); Tue, 27 Mar 2018 12:42:12 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 66A8DF51; Tue, 27 Mar 2018 16:42:11 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , linux-kselftest@vger.kernel.org, Ingo Molnar Subject: [PATCH 4.15 084/105] selftests/x86/ptrace_syscall: Fix for yet more glibc interference Date: Tue, 27 Mar 2018 18:28:04 +0200 Message-Id: <20180327162803.442514243@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Lutomirski commit 4b0b37d4cc54b21a6ecad7271cbc850555869c62 upstream. glibc keeps getting cleverer, and my version now turns raise() into more than one syscall. Since the test relies on ptrace seeing an exact set of syscalls, this breaks the test. Replace raise(SIGSTOP) with syscall(SYS_tgkill, ...) to force glibc to get out of our way. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-kselftest@vger.kernel.org Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/bc80338b453afa187bc5f895bd8e2c8d6e264da2.1521300271.git.luto@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/x86/ptrace_syscall.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/tools/testing/selftests/x86/ptrace_syscall.c +++ b/tools/testing/selftests/x86/ptrace_syscall.c @@ -183,8 +183,10 @@ static void test_ptrace_syscall_restart( if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) err(1, "PTRACE_TRACEME"); + pid_t pid = getpid(), tid = syscall(SYS_gettid); + printf("\tChild will make one syscall\n"); - raise(SIGSTOP); + syscall(SYS_tgkill, pid, tid, SIGSTOP); syscall(SYS_gettid, 10, 11, 12, 13, 14, 15); _exit(0); @@ -301,9 +303,11 @@ static void test_restart_under_ptrace(vo if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0) err(1, "PTRACE_TRACEME"); + pid_t pid = getpid(), tid = syscall(SYS_gettid); + printf("\tChild will take a nap until signaled\n"); setsigign(SIGUSR1, SA_RESTART); - raise(SIGSTOP); + syscall(SYS_tgkill, pid, tid, SIGSTOP); syscall(SYS_pause, 0, 0, 0, 0, 0, 0); _exit(0);