Received: by 10.213.65.68 with SMTP id h4csp878522imn; Tue, 27 Mar 2018 10:26:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+tBpjgU8Vf1x/R1fj6l6o0G76n/bpS2k11g+KOQ7WolzUIIxXS78jMaKE6yUIqeTmDUbSO X-Received: by 10.98.106.193 with SMTP id f184mr149502pfc.201.1522171594512; Tue, 27 Mar 2018 10:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522171594; cv=none; d=google.com; s=arc-20160816; b=SlOc+sCVrc9qq2Qd8y2dDw3g0nuMuF3aneluVK5Ksq5BknLvxvRjo4xrAV8RVaw12O j74/ZRzuVygYQT3IwH0kFEcUA3gyIYNwOzVSMExYgqcezh7pRXl+lO5K4wxPcTvzu0kT 8czK1KL+G5wa0u3JQrHTZEqLwVtaswgJ5B6fl9xSgQclkmxXo6IVj7qR4b0Arge7slbS 8wN/2XqPdWX5ZjZKLG4+ZXXxWgh3sYJTPv/1x/5ZXNOlLuQBsvuGVEWUIGygkMyqeSEA YVvDuc4MYIRCtfJGH04rtq2kISBD4x5ti5DNcgheje7DHG+A1jinfunAd1YDHe5MyhvZ yWUQ== 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=tkz6yq3C99ruSh8RN814PLCOZhdUnedZVo7uieiN9UA=; b=AUsoORcOehgM2xDDw7JFe8MmanIGTUr38l9rfm1RZG1xRSj3+BLfixaNDCQhDQDAIL RvVrJuqDyn7jhx/PpozYQKpJqspAI7jE5h2Md72zOilGyFAyfY7702Mh8OKLld/RsI24 ewK5r/4/kzLQizzQHZR/06X/lRFu3fQ5XVSjwLvqdLtyOfbfJ7nIiePgG/ijTbqdsDqj pQzGUapt/ZhZt5uWNxWxIPnOFk38rzsUGFJCQYo6Vt9jGB9A9m1549OOM3WK5hyd+++0 DpFhnU6QeFs9jT5gpI4AGp5xMcIzKkUNxF2Hb/ld1S3AwhqIR2cls4RrHSnyLMY39u4F D5UQ== 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 y12si1283567pfk.42.2018.03.27.10.26.19; Tue, 27 Mar 2018 10:26:34 -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 S1754907AbeC0QhZ (ORCPT + 99 others); Tue, 27 Mar 2018 12:37:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46224 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754886AbeC0QhS (ORCPT ); Tue, 27 Mar 2018 12:37:18 -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 1CA53F92; Tue, 27 Mar 2018 16:37:17 +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.14 079/101] selftests/x86/ptrace_syscall: Fix for yet more glibc interference Date: Tue, 27 Mar 2018 18:27:51 +0200 Message-Id: <20180327162754.925376966@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@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.14-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);