From patchwork Mon Mar 18 10:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 160484 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp2500458jad; Mon, 18 Mar 2019 03:49:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJqUsYRlL9/2Y4ZjUexpm2Sj0NlqJntf1U1P55XDvmaNv/jysW+Us3qr5Mpzu6b1ubcn1n X-Received: by 2002:a17:902:2903:: with SMTP id g3mr18867981plb.222.1552906189439; Mon, 18 Mar 2019 03:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552906189; cv=none; d=google.com; s=arc-20160816; b=NTq14aXW7Psqgj6KMGZbTFW1BfNapCx00YZ/4/FZ7E4QMzrOtQ75ZnYAaM7yhg8CK4 XFavJP8VLJica07hsDOm9WgRKcbO3TBx8yKuERSJiDPpkUtl+F3KrTQiUFlhGYTEQwMn BuiXrUosKJxFcupjmxFYVqtoKrhVxELLXXxTvT+XLgX4rFQxzWvLy1uZasExig3/PF8j AzEif0DOjkLfxnsp8o70ENcPR0KyRbh3nzbjzMSNQVUuu9UOPXMYn2sREF1VXFqbAphS aWPmQQn+4CwV40zbz/EQY2ZcdCgeIPSPwCmVBe69z5VDlB5g3SMa/4PqbS3IxZhOAVgG 2DCA== 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=WWcMzIDrjlOXdZz6rHwQrTNxBR7/csCbjCmYSoVBofY=; b=VAoQ2X3EQK13zc0jyMIhFYgkv/dVLdUIlkWzvqia8GcBGORDP0Ow7ls6qAwgxExNwN tAVkTOyMzk3G1aP/Rzt7L75ptRJYTgcZghQ8SO+tV+FGm1ye5dEyidt17ik4wcBYbQXp d2vcJgG1BaFUnRAFgGhM9CU4Z0s9aD2IesyEoA4yZc1MgzYQ14upOrRs33fweFZCql4E GFe8uZi5PBF8LymFQIFLBW9QSjhTLmdkoED4iuA+cUJMntO0JKFQ8FI7BStfcBDAo41F OS5CDGCbj+fWpD8/0fTAYct6g50mIpBJaSn4o0oznulnM6jJAenPccprXqUUgDUZMS5Z XYfg== 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 y5si9007474plk.150.2019.03.18.03.49.49; Mon, 18 Mar 2019 03:49:49 -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 S1727674AbfCRKtr (ORCPT + 31 others); Mon, 18 Mar 2019 06:49:47 -0400 Received: from foss.arm.com ([217.140.101.70]:59722 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfCRKtp (ORCPT ); Mon, 18 Mar 2019 06:49:45 -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 4E6271A25; Mon, 18 Mar 2019 03:49:45 -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 372653F614; Mon, 18 Mar 2019 03:49:42 -0700 (PDT) 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 , Andy Lutomirski , Borislav Petkov Subject: [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Date: Mon, 18 Mar 2019 10:49:22 +0000 Message-Id: <20190318104925.16600-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190318104925.16600-1-sudeep.holla@arm.com> References: <20190318104925.16600-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have a new hook ptrace_syscall_enter that can be called from syscall entry code and it handles PTRACE_SYSEMU in generic code, we can do some cleanup using the same in syscall_trace_enter. Further the extra logic to find single stepping PTRACE_SYSEMU_SINGLESTEP in syscall_slow_exit_work seems unnecessary. Let's remove the same. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Signed-off-by: Sudeep Holla --- arch/x86/entry/common.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 7bc105f47d21..5d7590994964 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -70,22 +70,16 @@ static long syscall_trace_enter(struct pt_regs *regs) struct thread_info *ti = current_thread_info(); unsigned long ret = 0; - bool emulated = false; u32 work; if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) BUG_ON(regs != task_pt_regs(current)); - work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY; - - if (unlikely(work & _TIF_SYSCALL_EMU)) - emulated = true; - - if ((emulated || (work & _TIF_SYSCALL_TRACE)) && - tracehook_report_syscall_entry(regs)) + if (unlikely(ptrace_syscall_enter(regs))) return -1L; - if (emulated) + work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY; + if ((work & _TIF_SYSCALL_TRACE) && tracehook_report_syscall_entry(regs)) return -1L; #ifdef CONFIG_SECCOMP