Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp482978imu; Thu, 22 Nov 2018 00:16:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/VlPNf4RXv+hOl7E4iyxj3BGE8pXxsvMHrdTvcTF7L9nhv6FGFkdw/tc7iFatebcnmxY9Jh X-Received: by 2002:a17:902:8648:: with SMTP id y8-v6mr10286158plt.159.1542874579323; Thu, 22 Nov 2018 00:16:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542874579; cv=none; d=google.com; s=arc-20160816; b=LWHjDuB8jZxbhyfEez4J0QIYmvuArTi7JURr+W+eTZB6j9wKwyCYkIeaDAiOVaTX7s r8qKwtXUkJ/gxbuRuV5J3dIRJ7wn9HIluNlHMEEtAANBepE8F66flhIEaa6QI5dwi6HF g7nsUdRGGm7TaoRqiSzG1RO8jc1xl961xd0b5QXDhZ7w/IvavHskW1mjwZMlMCkMc4Y6 ywWiv0MnnokYeFVLyiwt2qQdsnpT/R1veE1thLyoS49a1/1+D/MJcgBvfhVTveLPVdxQ di/9HgSwRNV/u5qsZtCMudvLodFwBu3SZDIuLNxsk0Z6NfTnQ6ufETnthoVp2yoJ1OAc O5xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=tSELGbJIeCvnLYMb38xQTK0yGTjsw3AQ1MtvlkvT1RA=; b=Moa4JPp0BOcEebhX8VMbZyCN3Fyi4h94NtYjc6boMKt7seh3qqh3cN167p1GMn2yEn WJdFhvJ58Jsqe3eFrjNnzdoAjXcuEi/zzz2JdCmw38LMek9uIj/d14616KAXf0zWTKKS STPIzzvhrHRV4rmtKt3yr6Vvv40Rg3Eofofig5QxQsYNRavp2fIbe7hl7mxHajRN/k+w vHkVgJJ3tbYCqDg1z0/JiQocWIWHQQSBHTuOKyXfCdWm8UiwfreN40ZDmZcbZci2DXCR GsiKHp+77CqmcK1OP5Q7X0P6MV8b8rGR1lBoma9MDjSh30Uo0TNKAakD5+/LKQonMs9l trlQ== 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 193si49121314pgc.220.2018.11.22.00.15.30; Thu, 22 Nov 2018 00:16:19 -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 S2389629AbeKVHxb (ORCPT + 99 others); Thu, 22 Nov 2018 02:53:31 -0500 Received: from ozlabs.org ([203.11.71.1]:46451 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731131AbeKVHxb (ORCPT ); Thu, 22 Nov 2018 02:53:31 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 430b4l0dG7z9s29; Thu, 22 Nov 2018 08:17:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: "Dmitry V. Levin" , 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: Re: [PATCH v3] powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call In-Reply-To: <20181119210139.GA8360@altlinux.org> References: <20181116121701.14359da0@akathisia> <87ftw12nyn.fsf@concordia.ellerman.id.au> <20181119210139.GA8360@altlinux.org> Date: Thu, 22 Nov 2018 08:17:25 +1100 Message-ID: <87efbe166y.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, Thanks for the patch. "Dmitry V. Levin" writes: > 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); Unfortunately the (void) cast doesn't work to suppress the must check warning. arch/powerpc/kernel/ptrace.c:3274:3: error: ignoring return value of 'tracehook_report_syscall_entry', declared with attribute warn_unused_result [-Werror=unused-result] AFAIK we don't have a way to suppress that. I guess we should rewrite it to only call tracehook_report_syscall_entry() once, like x86 does. I'll try and get a patch for that done & tested. cheers