Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3253415imu; Mon, 19 Nov 2018 13:02:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xev68ofn2uDrt+DaPsjDVFacnVXvaj6a8AiyRfic+jsM419RyNNPdyJpTVnGZ/9GDGVIQp X-Received: by 2002:a17:902:7686:: with SMTP id m6mr9906813pll.179.1542661355287; Mon, 19 Nov 2018 13:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542661355; cv=none; d=google.com; s=arc-20160816; b=CpWE1ptYpOSP2R7/wBvTKvw3a3lz7S7/K/IsooQkgOzboHcozIQ6VM+ajOZsZ/pNVR jeALOxb3To6XM3KBIMlK66ZFx1yFSJCcCjUjhMv2uNxdFBUikSD5R+/i/rW8xcr+4jod oDfP8Rjsdimc1fxwVurSWth5miT9/ycD40S4OBBNDPDt2SH38VFpwzyHg2AZVrZ2rz7w s4TWpHjQXyE/B8OVhB+JQYURPye3R4KOzdd3gzCMdb/2F0gZsRSwA2weHIcBM9sbuj9r bSggCAGz0PDa8udFPRxsBTUvzsEWxosFL6krJbMvfJMH0MAzufjm2yR91YIcX6j5eG0w KnfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=pMvp+8OmzLUcOGDh3MDW+1shdLEwudJAH+5hNsEMD6s=; b=qSQvpEPO5fT+fur1lkX8tzMCmf8k32NnnFQA0iD0HIKcHO2p936aOuGW4aNVc6LiUC 65VrFE9W1l1KcaWhcs/Nx9sr8nxshpvzecdrU3LbCr5Jkhs3E3dtTfV2q65DdUng3m7f kre7bA4xrlXPImZqGpnm91BnFj9TVMAZGI/iVofbjpz9q8XjlVho1yfBX/eR+tbEQzfB 1fgw3Q0dFWTBhKdawYfy2/msyKvMx+ckj6FKMxjdDHsaKvO5a1F/jcYcBJzB5DGinzuO Wk1LiBvy3PBDrKXGqtpcmgZ2c4cNUkbn10bhuPfEcHtNOZRvYsSezx8uVk2OmaI8f3Ee QnFg== 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 e6si36747084pgl.471.2018.11.19.13.02.19; Mon, 19 Nov 2018 13:02: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 S1730892AbeKTH1H (ORCPT + 99 others); Tue, 20 Nov 2018 02:27:07 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:37280 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730755AbeKTH1H (ORCPT ); Tue, 20 Nov 2018 02:27:07 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id A348372CA5E; Tue, 20 Nov 2018 00:01:39 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 956EB7CD1FF; Tue, 20 Nov 2018 00:01:39 +0300 (MSK) Date: Tue, 20 Nov 2018 00:01:39 +0300 From: "Dmitry V. Levin" To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: Oleg Nesterov , Breno Leitao , Andy Lutomirski , Eugene Syromyatnikov , Elvira Khabirova , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call Message-ID: <20181119210139.GA8360@altlinux.org> References: <20181116121701.14359da0@akathisia> <87ftw12nyn.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ftw12nyn.fsf@concordia.ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Elvira Khabirova Arch code should use tracehook_*() helpers as documented in include/linux/tracehook.h, ptrace_report_syscall() is not expected to be used outside that file. Co-authored-by: Dmitry V. Levin Fixes: 5521eb4bca2d ("powerpc/ptrace: Add support for PTRACE_SYSEMU") Signed-off-by: Elvira Khabirova Signed-off-by: Dmitry V. Levin --- v3: add a descriptive comment v2: explicitly ignore tracehook_report_syscall_entry() return code arch/powerpc/kernel/ptrace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index afb819f4ca68..e84220d91bbd 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -3266,7 +3266,12 @@ long do_syscall_trace_enter(struct pt_regs *regs) user_exit(); if (test_thread_flag(TIF_SYSCALL_EMU)) { - ptrace_report_syscall(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. + */ + (void) tracehook_report_syscall_entry(regs); /* * Returning -1 will skip the syscall execution. We want to * avoid clobbering any register also, thus, not 'gotoing' -- ldv