From patchwork Thu May 23 09:06: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: 164948 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1913662ili; Thu, 23 May 2019 02:06:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4VO2uh+tFfK3t/+3JMNadfPszXxPd6VINk5Yz4JIJpXUW0DLhiPG1ZGcKRATjPeuDKvgx X-Received: by 2002:a17:902:bd94:: with SMTP id q20mr74074807pls.146.1558602397327; Thu, 23 May 2019 02:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558602397; cv=none; d=google.com; s=arc-20160816; b=1E+WU9X6A+5Xnf4ZsRzJAzFJnL874Ftu4z2RKgLbtk7JvGfM/f0WWz0scMV+i2tGpi ZXQ4chEGQ82PFBfR2KYRGZgP74BNJLKXAAxgS7ElzC3PH9LCNUUoVWHJ5oYuetyI0XKO IFMln/q+jf3CJEpqgNzPp1YEgYv04dGWdImKFWPrOo/usrvDVjpDLFoWs/nuoBeo7Xyq sG9hjzEr3MIP7M43W4wlqmGORyma9tk2MxGYCdjjbReejI8MVfwHkAlEVFwegO10FVHp viCNXzf5CtrDGx8oCyHXhugTgnX0FJhNSPunPUeOC7K9k3n9knv665u7YVytBrGHuRWk LKMQ== 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=aimtCuPzQEVgfDlhJyeEqqK//gIgFGXq12SDBI9UmpE=; b=uG5sugjLj80O1HzHxxOZ2JPggGLptYDyiMuR8rYTqiIpbssm6kXpeqihApGTK801Q0 8Ixj+JbJobwx4r40r9VxWeXuNQ043zB97k6d5f7btBmNkdPHY+xK0EjSj1Gwyuj3AgTr eXe/JZZ3CnfFpi6EqQJyJyns21PhhVQhX28IpS0RHBXlQlF9nS0XyJ6Ex411TBtHQ/UG P1hcMedOjeRtc3CpwQsyAQ/UutWIFIpUY4kndo271hsSqsPmR43HVUCXj/7kvvFVW4es ak2OVChcwe6latNQInvwRxPPUvvMp6nxvbwNjO7noVS+wrCwlmttHnTse1T7dk+m+kTb 471g== 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 x16si118099pjt.85.2019.05.23.02.06.37; Thu, 23 May 2019 02:06:37 -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 S1730225AbfEWJGg (ORCPT + 30 others); Thu, 23 May 2019 05:06:36 -0400 Received: from foss.arm.com ([217.140.101.70]:40732 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730170AbfEWJGe (ORCPT ); Thu, 23 May 2019 05:06:34 -0400 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 7A6F1A78; Thu, 23 May 2019 02:06:34 -0700 (PDT) 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 CD7EC3F575; Thu, 23 May 2019 02:06:31 -0700 (PDT) From: Sudeep Holla To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Catalin Marinas , Will Deacon , Oleg Nesterov , Richard Weinberger , jdike@addtoit.com, Steve Capper , Haibo Xu , Bin Lu , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Ingo Molnar Subject: [PATCH v4 1/4] ptrace: move clearing of TIF_SYSCALL_EMU flag to core Date: Thu, 23 May 2019 10:06:15 +0100 Message-Id: <20190523090618.13410-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190523090618.13410-1-sudeep.holla@arm.com> References: <20190523090618.13410-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_unlink which gets executed from ptrace_detach and also keep it along with or close to clearing of TIF_SYSCALL_TRACE. Cc: Paul Mackerras Cc: Michael Ellerman Cc: Thomas Gleixner Cc: Ingo Molnar Acked-by: Oleg Nesterov Signed-off-by: Sudeep Holla --- arch/powerpc/kernel/ptrace.c | 1 - arch/x86/kernel/ptrace.c | 3 --- kernel/ptrace.c | 3 +++ 3 files changed, 3 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 684b0b315c32..8c92febf5f44 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -2521,7 +2521,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 6f357f4fc859..16c7fc1eabcf 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -117,6 +117,9 @@ void __ptrace_unlink(struct task_struct *child) BUG_ON(!child->ptrace); clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); +#ifdef TIF_SYSCALL_EMU + clear_tsk_thread_flag(child, TIF_SYSCALL_EMU); +#endif child->parent = child->real_parent; list_del_init(&child->ptrace_entry);