From patchwork Thu Feb 28 18:32:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159424 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987674oce; Thu, 28 Feb 2019 10:32:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzHIEgZvKTVsXpwmNPWEwisQoUnR0ptTckilgwrIA8NjMebuWKhpWcQNS+RBjKP32tnkkbd X-Received: by 2002:a17:902:c81:: with SMTP id 1mr768200plt.155.1551378755081; Thu, 28 Feb 2019 10:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378755; cv=none; d=google.com; s=arc-20160816; b=lfhmqE0ZZPkQwWxWdA/1CQ91GkYgjdqsvt2uOgvfzgIKMT7+Nsa3OWWvTA4HRI9gmu wrKPYiBJAn+bvGxWaWOrfKzYVQtwIeh2qCuynvJLPIBLAxKl+7wAidEvbu9frp5qlvRB svxOSWxvRWdv7rpIOKsqlFwfnuz/1rfq0t6Nk703WKDwAHZOqbiA3LEPmiYZQG6A6iTZ rAWuBq1/kM5WdEUFB4waMUwTdsHfMMdq/0PrI5N18PHgnpRJunEbfw9Ka22eI/oL+Kw/ 7gr4DzFo36a9ZDLdspSFLZnY0+ZxUI7GiqX/XaasFZSf1Z2m5Ibn6ZBXpah/vR6Wz8Ia 68MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=NApX76a4jRjAdwybrT6hvLt06LtIdHx6H3mmVUhism8=; b=RrXMgS32DHpDuXxgJHSZ31ortNguvFpG3uydjuQOg+oW6ZICDuxNiRHXy5fHzu0OWu pDVF+AeEGQxHoD01d7TUVL4k2zPvo5ZNkwbWdikCXMu9YpKG+4y0oktFD6MMjqZwEQvf fnZY2wTtu5w6/2jLIN/xajokT96PP8DDDmgYQxDjYTRlHuIARMSu/oTPbaN4RCwjl+8f 3dBwv4zbK5IkW68ht8/krLWS59Hn+lys/R0WIw2QX7Gf0pqbIbaPruXUT+b3bxoEJULQ STGfbTLlslBP9iy/xQW0BzgUp9OEESJmL/s+XGuEsAZV/LeFKgtYUHdxpaLAfS1L2V6t sKYQ== 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 l8si17657951plt.88.2019.02.28.10.32.34; Thu, 28 Feb 2019 10:32:35 -0800 (PST) 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 S2387484AbfB1Scd (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:33 -0500 Received: from foss.arm.com ([217.140.101.70]:52854 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732645AbfB1Scc (ORCPT ); Thu, 28 Feb 2019 13:32:32 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B4D921596; Thu, 28 Feb 2019 10:32:31 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E53333F5C1; Thu, 28 Feb 2019 10:32:28 -0800 (PST) From: Sudeep Holla To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Sudeep Holla , Catalin Marinas , Will Deacon , Oleg Nesterov , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Ingo Molnar , Richard Weinberger , jdike@addtoit.com, Steve Capper , Haibo Xu , Bin Lu Subject: [PATCH 1/6] ptrace: move clearing of TIF_SYSCALL_EMU flag to core Date: Thu, 28 Feb 2019 18:32:15 +0000 Message-Id: <20190228183220.15626-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228183220.15626-1-sudeep.holla@arm.com> References: <20190228183220.15626-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the TIF_SYSCALL_EMU is set in ptrace_resume independent of any architecture, currently only powerpc and x86 unset the TIF_SYSCALL_EMU flag in ptrace_disable which gets called from ptrace_detach. Let's move the clearing of TIF_SYSCALL_EMU flag to ptrace_detach after we return from ptrace_disable to ensure there's no change in the flow. Cc: Oleg Nesterov Cc: Paul Mackerras Cc: Michael Ellerman Cc: Thomas Gleixner Cc: Ingo Molnar Signed-off-by: Sudeep Holla --- arch/powerpc/kernel/ptrace.c | 1 - arch/x86/kernel/ptrace.c | 3 --- kernel/ptrace.c | 4 ++++ 3 files changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index cdd5d1d3ae41..cb7e1439cafb 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -2508,7 +2508,6 @@ void ptrace_disable(struct task_struct *child) { /* make sure the single step bit is not set. */ user_disable_single_step(child); - clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); } #ifdef CONFIG_PPC_ADV_DEBUG_REGS diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 4b8ee05dd6ad..45792dbd2443 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -746,9 +746,6 @@ static int ioperm_get(struct task_struct *target, void ptrace_disable(struct task_struct *child) { user_disable_single_step(child); -#ifdef TIF_SYSCALL_EMU - clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); -#endif } #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 771e93f9c43f..4fa3b7f4c3c7 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -534,6 +534,10 @@ static int ptrace_detach(struct task_struct *child, unsigned int data) /* Architecture-specific hardware disable .. */ ptrace_disable(child); +#ifdef TIF_SYSCALL_EMU + clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); +#endif + write_lock_irq(&tasklist_lock); /* * We rely on ptrace_freeze_traced(). It can't be killed and