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 From patchwork Thu Feb 28 18:32:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159425 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987728oce; Thu, 28 Feb 2019 10:32:38 -0800 (PST) X-Google-Smtp-Source: APXvYqya/x7ulRrgY/bY3iDHwItUWMmh/qMQlFjHIBLr9a8XQjrXadXvMitgKLlsKS9aCuxjhy5z X-Received: by 2002:a63:545:: with SMTP id 66mr555563pgf.102.1551378758425; Thu, 28 Feb 2019 10:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378758; cv=none; d=google.com; s=arc-20160816; b=SBBgc5ZJSTXox+RB7UpqloiSFt/tcw+nSmUm6pyIUYBSUvGJEK5bazFGzcDLrFVTr8 1XXy9GiT+Y1f+/T2DIC9fUC0KRipaAUX8VQ5TNQoFwm3mv5NDIe2+pW8QXJcxlMLWxoq q+HUKhMKI2IOU9maEPsKqRfkeQ13GPo9TpszA4Yo98M2qQ5GsOhNOmsXsBwI3bcLNUbp p+9AoWDJeep097uYxJuatcrhUjaH6DmjX3/qcywYnun7xUqiWTYiDfEYDNKTZhAJqVUG jcy3NUSmpexEwqJeZ5FBX9+fntEGkpnryrmHEIu36CgH1Y0+rMLUToYn4aLd6nl1Y2d/ 50mQ== 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=at6N6ssaZjC6lmdVgXImiNAFkkaVQHY4gTvRWworWOs=; b=y8ruQGjcJsSJOT3/f4u1d3CQfjW/31fKRq50SQs/MaQMVuo2aFQUAwpm+mad8rF1ih EuksU02/Omz+UCdAJVamcPev8PPr3Hr5ZbRVXSPXKktGFVJf+iWePzNRg1jSjdEP1bBt xF4uor/hccw/513o8gsQCaOqGVc6uCtLRyxdzh2GQb+v5C91iVsB9EuUcXZZ7TJiHedM keK7vi8xr3D7MNJ7P610vrRMASyi5XeEKDaFE0ZILZmOwMQcXX26pDxpy2cK7uBT8FDt 2b4nrOyU2uwvlznFUMt9Y30HNLxDD30zYrdr3qbEcCmrxAPmC+xP0y0Xf6y8h6/cWqls 1Y2g== 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.38; Thu, 28 Feb 2019 10:32:38 -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 S2387558AbfB1Sch (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:37 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52884 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732645AbfB1Scf (ORCPT ); Thu, 28 Feb 2019 13:32:35 -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 C37C81684; Thu, 28 Feb 2019 10:32:34 -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 F38093F5C1; Thu, 28 Feb 2019 10:32:31 -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 2/6] ptrace: introduce ptrace_syscall_enter to consolidate PTRACE_SYSEMU handling Date: Thu, 28 Feb 2019 18:32:16 +0000 Message-Id: <20190228183220.15626-3-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 Currently each architecture handles PTRACE_SYSEMU in very similar way. It's completely arch independent and can be handled in the code helping to consolidate PTRACE_SYSEMU handling. Let's introduce a hook 'ptrace_syscall_enter' that arch specific syscall entry code can call. Cc: Oleg Nesterov Signed-off-by: Sudeep Holla --- include/linux/ptrace.h | 1 + kernel/ptrace.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) -- 2.17.1 diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index edb9b040c94c..e30f51e3363e 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -407,6 +407,7 @@ static inline void user_single_step_report(struct pt_regs *regs) #define current_user_stack_pointer() user_stack_pointer(current_pt_regs()) #endif +extern long ptrace_syscall_enter(struct pt_regs *regs); extern int task_current_syscall(struct task_struct *target, long *callno, unsigned long args[6], unsigned int maxargs, unsigned long *sp, unsigned long *pc); diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 4fa3b7f4c3c7..6724eaf98e79 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -29,6 +29,7 @@ #include #include #include +#include /* * Access another process' address space via ptrace. @@ -557,6 +558,21 @@ static int ptrace_detach(struct task_struct *child, unsigned int data) return 0; } +/* + * Hook to check and report for PTRACE_SYSEMU, can be called from arch + * arch syscall entry code + */ +long ptrace_syscall_enter(struct pt_regs *regs) +{ +#ifdef TIF_SYSCALL_EMU + if (test_thread_flag(TIF_SYSCALL_EMU)) { + if (tracehook_report_syscall_entry(regs)); + return -1L; + } +#endif + return 0; +} + /* * Detach all tasks we were using ptrace on. Called with tasklist held * for writing. From patchwork Thu Feb 28 18:32:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159426 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987826oce; Thu, 28 Feb 2019 10:32:42 -0800 (PST) X-Google-Smtp-Source: APXvYqz2S1SoCMufm2sm79WA1Da0zIJCn/EW6/iOSKGVTh79gBL5DlojtKQ7dA/gj0OgdYE6WILk X-Received: by 2002:a63:5a5e:: with SMTP id k30mr499014pgm.345.1551378762738; Thu, 28 Feb 2019 10:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378762; cv=none; d=google.com; s=arc-20160816; b=kmwZVXBV6cu4W96LGycK5VQrrBc/fIWCOnkyPcd8C6hhpoVR60VMxou8ZztlkgFN1F 8qtvUZ9pSAR6XVFe2OS6bSRX4N4gXtIHVomKVlt4q3BmZilsVhm2jyi4w2Ih05f2YeyO MqA6HoHx4LEHB/HFRkvpvmn8nm4a5G6ltdXJk696fNECZC1H4/InSm2aEqyRdHkZvw5k iuTPIJ9d0xo5bPwS4Ul8w6oVcDDlvM/KvmQ6D6UFp71dt7khwKCoDqjSgxh0qrs5rEXH 5EuCJTVzkGxp1ph/0McotcCIWwAwYM6b7lmA8dpXy+mvSRmr/eQ/6Xu1Da5NNfM/fQzR EFKg== 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=N+55Ubr8avT5uyxaBxho2pYETM+TH/SRUuscP2L1KN4=; b=VR2lvRt2pP5ZapuOSTtQDW7SMPflWpVJaJsoOI7INsqBmkO67ahXF8ODZtyIFB39IA BETbuWjaQE8XFCZptc0Tl2H5r5ew67GOksszr9MoSgCCRhtZoAaaLgjCW/0C05CzfBqT RPh6Q6t7vdq63pAIeGECuzGfiyq6DIXJ/X6tZ9K2UWTcd1gU7NyFkKu3AVQAfeSWbVM6 HD1pqdiZRaGwYNvYUFpZXkWQAJ6HB90daR6mvzeIC8h2kHe9ogTjE/nwPzKeArmMl4sX a54LBxmAAOp8ae/L02cUMxesUJqmKuUqOfBLfCvhQlmXiuZznl8tanSPMXCdHV7I2Z/N jjjA== 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 26si18242274pgq.348.2019.02.28.10.32.41; Thu, 28 Feb 2019 10:32:42 -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 S2387658AbfB1Sck (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:40 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732645AbfB1Sci (ORCPT ); Thu, 28 Feb 2019 13:32:38 -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 2508416A3; Thu, 28 Feb 2019 10:32:38 -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 0DDEE3F5C1; Thu, 28 Feb 2019 10:32:34 -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 , Andy Lutomirski , Borislav Petkov Subject: [PATCH 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Date: Thu, 28 Feb 2019 18:32:17 +0000 Message-Id: <20190228183220.15626-4-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 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 | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 7bc105f47d21..36457c1f87d2 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 @@ -227,15 +221,7 @@ static void syscall_slow_exit_work(struct pt_regs *regs, u32 cached_flags) if (cached_flags & _TIF_SYSCALL_TRACEPOINT) trace_sys_exit(regs, regs->ax); - /* - * If TIF_SYSCALL_EMU is set, we only get here because of - * TIF_SINGLESTEP (i.e. this is PTRACE_SYSEMU_SINGLESTEP). - * We already reported this syscall instruction in - * syscall_trace_enter(). - */ - step = unlikely( - (cached_flags & (_TIF_SINGLESTEP | _TIF_SYSCALL_EMU)) - == _TIF_SINGLESTEP); + step = unlikely((cached_flags & _TIF_SINGLESTEP)); if (step || cached_flags & _TIF_SYSCALL_TRACE) tracehook_report_syscall_exit(regs, step); } From patchwork Thu Feb 28 18:32:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159427 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987886oce; Thu, 28 Feb 2019 10:32:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxOAnuRBoH64BNddim9auKDbvBdTx0ndgCPJ1NvH50zwQ47XGPR6KV4G3d9WkKDWoTVFjHE X-Received: by 2002:a17:902:282b:: with SMTP id e40mr767458plb.111.1551378765208; Thu, 28 Feb 2019 10:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378765; cv=none; d=google.com; s=arc-20160816; b=lQra93QesFc1SwwQnhiYlhlzdReA3Tqc19bx66s8MJ14LdkulJ0R4Z/TORJS5UAgsT TVDDqQtg1Mot4LXPH7URVMvnjYqW4ppk151R5t+WGlYI8HkJlw/O29s9B7ITBj0LRndW Dn365Z8WqQDIYMEfBO1MkEuRHZtngUsUmlY2Sydg5VEFahsQc2sqzrnWNe+dW/WbUG4P iMSWTwITqt0ucRPYEFP63a0AaZeieLKRdC5x0hvnytl1I1jzg/4OhONsLCiAASoXJtpM WIW0jJe7uq9XBwZ+9IQwRA2uZ02pu0mTtECvp36HUcpjGs74063sRNe/9J5wvifoiZYl x0Vw== 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=tJXSkxSqlnGSIWoUyWccRwyDJ0zxcD2O2YaMUB6+ANU=; b=Dmx+Qf1Nsdj8T0volaA/yNkl+77gzmkm5qAHkv4IwmWuLryXmJ8wJhLeWnbFeWzg/k wLuq0FS1vyBOnO7BJrzoiYukqyX5kWGmhVUbtqb3u7wJPF+GmXQwrhaUfheYYWlTlX9c Wz4MDC6qns2JTwcsG47esIVbi5YFadTwrfLRvbMjX5hVq21r6lEr+2zY+Y/RhKMDNMPy /M2FB3qPSQNPghE+InnXSJlx5JyCmhgyJ+xYDA+jhGrsWSRFiOhvvj8HfvOLJzIZxW4t kCXWGr6roJKtobR41+ce40tBa77ALGQxKi2C2tl5LdGtOGWL/SBTanRgfQtrTEi9x8l7 OD4A== 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 11si18065511pfh.90.2019.02.28.10.32.44; Thu, 28 Feb 2019 10:32:45 -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 S2387725AbfB1Scn (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:43 -0500 Received: from foss.arm.com ([217.140.101.70]:52948 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732645AbfB1Scl (ORCPT ); Thu, 28 Feb 2019 13:32:41 -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 34012174E; Thu, 28 Feb 2019 10:32:41 -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 63F233F5C1; Thu, 28 Feb 2019 10:32:38 -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 4/6] powerpc: use common ptrace_syscall_enter hook to handle _TIF_SYSCALL_EMU Date: Thu, 28 Feb 2019 18:32:18 +0000 Message-Id: <20190228183220.15626-5-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 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 do_syscall_trace_enter. Cc: Oleg Nesterov Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Sudeep Holla --- arch/powerpc/kernel/ptrace.c | 50 ++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index cb7e1439cafb..978cd2aac29e 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -3264,37 +3264,31 @@ long do_syscall_trace_enter(struct pt_regs *regs) { u32 flags; - user_exit(); - - flags = READ_ONCE(current_thread_info()->flags) & - (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE); + if (unlikely(ptrace_syscall_enter(regs))) { + /* + * A nonzero return code from tracehook_report_syscall_entry() + * tells us to prevent the syscall execution, but we are not + * going to execute it anyway. + * + * Returning -1 will skip the syscall execution. We want to + * avoid clobbering any registers, so we don't goto the skip + * label below. + */ + return -1; + } - if (flags) { - int rc = tracehook_report_syscall_entry(regs); + user_exit(); - if (unlikely(flags & _TIF_SYSCALL_EMU)) { - /* - * A nonzero return code from - * tracehook_report_syscall_entry() tells us to prevent - * the syscall execution, but we are not going to - * execute it anyway. - * - * Returning -1 will skip the syscall execution. We want - * to avoid clobbering any registers, so we don't goto - * the skip label below. - */ - return -1; - } + flags = READ_ONCE(current_thread_info()->flags) & _TIF_SYSCALL_TRACE; - if (rc) { - /* - * The tracer decided to abort the syscall. Note that - * the tracer may also just change regs->gpr[0] to an - * invalid syscall number, that is handled below on the - * exit path. - */ - goto skip; - } + if (flags && tracehook_report_syscall_entry(regs)) { + /* + * The tracer decided to abort the syscall. Note that + * the tracer may also just change regs->gpr[0] to an + * invalid syscall number, that is handled below on the + * exit path. + */ + goto skip; } /* Run seccomp after ptrace; allow it to set gpr[3]. */ From patchwork Thu Feb 28 18:32:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159428 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987956oce; Thu, 28 Feb 2019 10:32:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IZAcvtjNxjHDps+Ufk8SUKP8Q/h+OqMkgdEHs0ZBj0Y8r/SKoGsH41LmaPhALDunUbP0M6K X-Received: by 2002:a62:b608:: with SMTP id j8mr979261pff.183.1551378769645; Thu, 28 Feb 2019 10:32:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378769; cv=none; d=google.com; s=arc-20160816; b=zTddwaHlixec3CCNglofwz67FOmyEtJ6rPBN4FMVdAuIuFS+Yo9Koi6MDRuPh1xf1d Y/q7tdz4lrqKT7mImJsjO+uQlfKfufTec7L18n+QUQVV8vxt7IHrTvWUFD9+fSLlIDNU BMnN4YT0lnIM3swkT4h55+Oa1SZypAu3FuX/FjLjsONnEyXtAxK/x0OXpV4OH7QbqDfc n3e2/E/fh2Mevx3HjRQLrn7vBXHXKctT2sman8c0nfJbosi/45rzyvCBDorR8k5Wp5zQ JaUmzHhJdTbO8Ym+wmb52OHAvCTblxdU2RTDZykO7fXN0g2ZSGroSF4V+p4sAgcO/+/i EUxw== 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=fEwyPH2L04a9LEFGWv0TdqamdChltjwM0W5NtFoCA4Q=; b=IYlaZ+A2udCLk9mD4794lPn5EkoCnytIpZaDONz4W0wSm6ZuvcubGyygHVQSUpgq2a hqqGFXQ5ejiSQ2FicqVbMspCqilzALoe6SUmyJAZJiSxH1X6x0StfdKCykfJN8pPDZV1 jB6SCu06bYkrr6MoX6hag7obRXVmLWT8mEA9i1IYbQfAn3T/pEumPlbJ+wqTVNCNNTWt vCiriZ9vEIL2akQAS3fyrlEHlbzzJJeVr1+fRgH1jGhgWlxbpHTwuKtF5U5KCwQCOJ02 bxuD+Ef0A9ne5L/KinirOlmWMI7qfB//ZPtj1zE5HSOe9P4m6IzOGbUMa4XxWXmZKLee Jcyg== 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 11si18065511pfh.90.2019.02.28.10.32.49; Thu, 28 Feb 2019 10:32:49 -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 S2388721AbfB1Scr (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:47 -0500 Received: from foss.arm.com ([217.140.101.70]:52978 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732645AbfB1Sco (ORCPT ); Thu, 28 Feb 2019 13:32:44 -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 4BDBF19BF; Thu, 28 Feb 2019 10:32:44 -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 72C713F5C1; Thu, 28 Feb 2019 10:32:41 -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 5/6] arm64: add PTRACE_SYSEMU{, SINGLESTEP} definations to uapi headers Date: Thu, 28 Feb 2019 18:32:19 +0000 Message-Id: <20190228183220.15626-6-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 x86 and um use 31 and 32 for PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP while powerpc uses different value maybe for legacy reasons. Though handling of PTRACE_SYSEMU can be made architecture independent, it's hard to make these definations generic. To add to this existing mess few architectures like arm, c6x and sh use 31 for PTRACE_GETFDPIC (get the ELF fdpic loadmap address). It's not possible to move the definations to generic headers. So we unfortunately have to duplicate the same defination to ARM64 if we need to support PTRACE_SYSEMU. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Sudeep Holla --- arch/arm64/include/uapi/asm/ptrace.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h index 28d77c9ed531..8478b9007f9e 100644 --- a/arch/arm64/include/uapi/asm/ptrace.h +++ b/arch/arm64/include/uapi/asm/ptrace.h @@ -62,6 +62,9 @@ #define PSR_x 0x0000ff00 /* Extension */ #define PSR_c 0x000000ff /* Control */ +/* syscall emulation path in ptrace */ +#define PTRACE_SYSEMU 31 +#define PTRACE_SYSEMU_SINGLESTEP 32 #ifndef __ASSEMBLY__ From patchwork Thu Feb 28 18:32:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 159429 Delivered-To: patch@linaro.org Received: by 2002:ac9:18c7:0:0:0:0:0 with SMTP id i7csp987986oce; Thu, 28 Feb 2019 10:32:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxdPLegVMExGTcecMwgQAv18JsWoP3pqIHk6smL9gdq+WViuE9CLQsU3K5pgvzDBxiG28rr X-Received: by 2002:a63:788a:: with SMTP id t132mr576051pgc.0.1551378772328; Thu, 28 Feb 2019 10:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551378772; cv=none; d=google.com; s=arc-20160816; b=CTLprYU6+D1kA2WsJeNZmReJ4YzLx939G4zTOHlmJMyZTkfTLDp9dF6efMLGbI/qve DPFczqlg470Cy86831lM6fDFMuEWk+73v3Sem8rD2xrp6tH6PNhgExCQDga0Eb8k+Ez8 XADqPvo/h4jIGxW/4NIlMUKoB3HAXq9qxsCXNlqXnZq05w1MpXlMrZU7hU4XMGfcSh8q kzp3JGozi6tK5FssJnHcGARbrbZTRQarnOsoY5aqdruBlVHh1ci3q54hyURvh7BDzdah 9FI9LBzfcHG0+5uZlqS0MaKW2lKpUNP1prVU0bg/qT1SW03n6EeeHptCKo6RqHEh6QJx mHZA== 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=qJlvM9anl/ArMFL6BDg618T6ZEAhJLwzAgsfwVLXg6c=; b=Td/HnxOQStDuJkHl5spWXaw73JZUUA78XwOCh+Xr7HDPs6Mq47YaZU7JkevhuIq3n4 oF+Xv4Sf1jXQzKzZNgdA9rhRcIysFQ18CPYsWR5celhCkYigjQiDzDiAWAtorFl+kKRH CwCaAYQEXC4zXvbJpx87M51HnUlLG6dejmXQgHl4TZMajRC+4PCNYaY5T00K98H7/ASj 9bibsrU2DyJlfOZtC6e5XVUhzWjaQiaSna4kyPGwvr3SKg11RzdgS6YmJXLn63ScW1A1 w3Qv9Wl4chICaMRz841XoqxrXcNL557y0rbMoxx3CwagNZVsm+dGVgjygi7JuvTAU0c/ 3LBg== 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 cm10si19872585plb.295.2019.02.28.10.32.52; Thu, 28 Feb 2019 10:32:52 -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 S2388729AbfB1Scu (ORCPT + 31 others); Thu, 28 Feb 2019 13:32:50 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53006 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388720AbfB1Scr (ORCPT ); Thu, 28 Feb 2019 13:32:47 -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 5AD121A25; Thu, 28 Feb 2019 10:32:47 -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 8AF0D3F5C1; Thu, 28 Feb 2019 10:32:44 -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 6/6] arm64: ptrace: add support for syscall emulation Date: Thu, 28 Feb 2019 18:32:20 +0000 Message-Id: <20190228183220.15626-7-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 Add PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP support on arm64. We can just make sure of the generic ptrace_syscall_enter hook to support PTRACE_SYSEMU. We don't need any special handling for PTRACE_SYSEMU_SINGLESTEP. Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Sudeep Holla --- arch/arm64/include/asm/thread_info.h | 5 ++++- arch/arm64/kernel/ptrace.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index bbca68b54732..c86aeb6379d5 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -75,6 +75,7 @@ void arch_release_task_struct(struct task_struct *tsk); * TIF_SYSCALL_TRACE - syscall trace active * TIF_SYSCALL_TRACEPOINT - syscall tracepoint for ftrace * TIF_SYSCALL_AUDIT - syscall auditing + * TIF_SYSCALL_EMU - syscall emulation active * TIF_SECOMP - syscall secure computing * TIF_SIGPENDING - signal pending * TIF_NEED_RESCHED - rescheduling necessary @@ -92,6 +93,7 @@ void arch_release_task_struct(struct task_struct *tsk); #define TIF_SYSCALL_AUDIT 9 #define TIF_SYSCALL_TRACEPOINT 10 #define TIF_SECCOMP 11 +#define TIF_SYSCALL_EMU 12 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ #define TIF_FREEZE 19 #define TIF_RESTORE_SIGMASK 20 @@ -110,6 +112,7 @@ void arch_release_task_struct(struct task_struct *tsk); #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) +#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) #define _TIF_UPROBE (1 << TIF_UPROBE) #define _TIF_FSCHECK (1 << TIF_FSCHECK) #define _TIF_32BIT (1 << TIF_32BIT) @@ -121,7 +124,7 @@ void arch_release_task_struct(struct task_struct *tsk); #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ - _TIF_NOHZ) + _TIF_NOHZ | _TIF_SYSCALL_EMU) #define INIT_THREAD_INFO(tsk) \ { \ diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index ddaea0fd2fa4..c377ce597f92 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -1672,6 +1672,9 @@ static void tracehook_report_syscall(struct pt_regs *regs, int syscall_trace_enter(struct pt_regs *regs) { + if (unlikely(ptrace_syscall_enter(regs))) + return -1; + if (test_thread_flag(TIF_SYSCALL_TRACE)) tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);