Received: by 10.213.65.68 with SMTP id h4csp901897imn; Tue, 27 Mar 2018 10:52:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48J1pdQdNv9yYXWFMUyrJjhFAn0iqvHAG2waKNayHurK6JJYU67NAArn9XFOBuLoZyhP/vS X-Received: by 10.101.96.134 with SMTP id t6mr205061pgu.58.1522173144310; Tue, 27 Mar 2018 10:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173144; cv=none; d=google.com; s=arc-20160816; b=hUWidiuDf4RO+YM6DH3DBIf04HnB1sUC2Gj8SyD9goQxIOylaJVxXWgTTvbUpOD0Wd pXCnO3YFf+7s/vMiZF+S9romfmvruhAIIvlRBcyM0d4tqJ1lJpb+tcZvfN1vzcaNbjm7 zwiuJBL/pgbUHUotZCpjB7IekSaeztCLhvZCZu7GadK+ZaRsG7FsxzigjbmEpuHkwoRN ooczhyeHhTmbEowSDKFb9KFaXFRtsxm40XXtSB3aYzELORTtKJKJCMPl2GfX4vKAoTu9 8e1igUD91TqPkkd5Nzxd05QJw/gra96M6Vr96tidARkxk4FM//RYTNwqUXNKaWkB5UyA JXAQ== 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=anDuwdq3x/XAw/ODmKbyRqJ9d74YJRN2ZkgRS3NF11c=; b=Y5ndJ6bIBP3NchVZRhw5bYJPUGNePnTKdCO3a0IjgrbA9DOUtXRa3y75LHVn9bDJ77 xwcOFpct/mIv2ZzrwWj+gxRJmkLD3kX275v6Uc002ZpWY9Ly+znVkoX2NrtkkWSoZIkI o3hYyV9c+I+WbMMl6BD57/kQ4k/LsVDDy7irGiLA6VCxZzgIJVuBBkBY7/BnrMRNo2vm PrG4yj4LVQtO84kFkobKMEX7fWE3BrCDiJLnGyPEoMsmYaqgrTHaN3IIZ+JNNoULhTLp OUGH2rvLumjUKDgFnBJqoJeWimXg13RmSCyHcKhpkvhKuUUSHWzy8SiVKoIGdA6dF06a 46wQ== 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 f64-v6si1606232plf.624.2018.03.27.10.52.10; Tue, 27 Mar 2018 10:52:24 -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 S1753869AbeC0Rte (ORCPT + 99 others); Tue, 27 Mar 2018 13:49:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbeC0Qcc (ORCPT ); Tue, 27 Mar 2018 12:32:32 -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 BE883FB6; Tue, 27 Mar 2018 16:32:31 +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.9 49/67] selftests/x86/ptrace_syscall: Fix for yet more glibc interference Date: Tue, 27 Mar 2018 18:27:41 +0200 Message-Id: <20180327162730.053831105@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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 @@ -182,8 +182,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); @@ -300,9 +302,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);