Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2954124imm; Mon, 28 May 2018 20:50:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXTrU02pd9cf2TQGuLyhBAduj0SGt4uobCNKTeC25F5OdxkcE2Bwi07/tH1DBNHN6vOkSP X-Received: by 2002:a17:902:7844:: with SMTP id e4-v6mr15787605pln.296.1527565833103; Mon, 28 May 2018 20:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527565833; cv=none; d=google.com; s=arc-20160816; b=J1bmkQbhlr/ig5uNABqJWV4L1v1gXaysaybd251rxktWYlRuYzJzWg7bitlaORSp8/ XeKi1JiMKHG0WtGKlziJ1b4Hag4oeOcKpl4rP3lTMd2ImiRXnFPNjbXOhmf9U2V26IzS pouB5a7Mtp6lb2mAj18zW2uaznXs0yth4F5sNFsUvqiAOwz3Zr7ldNEqaJj4nuKB6j0l +kMGZarLr2uyH2aXvCQply5NVyFvs3lVGNn2GTJXB898wKmVCyKYSMRgDL9EiAIfrrl9 lkgzeo/VCO/E6YKh/DkuCi16B/Cqx4DFfsnW3EdZQKXltfaOTJwjovIu+P8igTzS6a8q LhUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=YW9qD5e1ED8OfBGliDDlrJsuBOyAUPZsKXPPw1649AI=; b=MoBVS+hN//Qz+lp7W287sugnlDXu1DTBWdS7dFGoPiqVqawm/j45+RhSkkOkxZnkQV SiN14Jcdt/fOy7YgJbNuEtJdNya7+b/urVpTzhsdfqGeIickHjEXSPd7LajgBXDzeQam gijR58QysVAwEzsvhz/7ulF4JouVIimszLO43yke9hONqbrlU1PWXDdm0Rq1Ts0xi+85 yWAevoVbqq09VqDuSSkvFmTVKf1OGhIwGYssxCu0WF04LgN7hVZo7UJGzkd+OVXk+wPB OlhraotA/u6JAO3tGgLmV8MHdd1DG68YmviCZCrjIRt2eBOqXjNh35lUSSPDO5eX0ToN 1xgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PPz9HTF4; 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 1-v6si31725159plw.519.2018.05.28.20.50.18; Mon, 28 May 2018 20:50:33 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PPz9HTF4; 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 S1755757AbeE1T0R (ORCPT + 99 others); Mon, 28 May 2018 15:26:17 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:46191 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755736AbeE1T0Q (ORCPT ); Mon, 28 May 2018 15:26:16 -0400 Received: by mail-ot0-f196.google.com with SMTP id t1-v6so14449387ott.13 for ; Mon, 28 May 2018 12:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=YW9qD5e1ED8OfBGliDDlrJsuBOyAUPZsKXPPw1649AI=; b=PPz9HTF46YcQQONwGq68PnVYBLAgomZTt8i2u9rlP14LNEEGEEh+oY5yx9L/ltiz5y BCUCGnn/3pLNd+q5Lm/GgnROR0PgkaCZA8QRoluBKO3HS+0Ky4xv9YPW8k3/yQKrjCNI nwt2xKmzXZHKmhmkBGKkrk1iqn0ueU74mfTAFcwUdychkCl/868nyuATgNeRCBGjQTe8 /404bmX2vIqtJAnVPHyyIfxjOhdNfgawPSY5ao2kb084hQMG2wbk7duvC5usAGoCy1WS lWb1pSqjHPVJ3RuV8uhi+ZdgtDqvKBxbZWw4itbEVC8UIKHWLHd8/yHTW1GLxv4uLDhe 7qBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=YW9qD5e1ED8OfBGliDDlrJsuBOyAUPZsKXPPw1649AI=; b=Mfr3FFr3A16OqlYXjkMFaPyqb9Jzfa3VP2Ypd9AHSZc5/seOoVtqoPW0ppwlafqDiQ akmCtUWK+841KKweI1eC5P/kitVKI62zxOtmt8FQt+rci6+mX9UB2rS0iTeNrWC/DFVk +h7owh78Qt8pwowQmuL8yjpSia8IBW+pJlE1T3R/rn/u2TVPI8k3rEczc2uLbTa6Gezp jEmNMYZqqOuOitd63+rk71pj3U/xKDNIcKXafdRJT593XDet2/Bi/4XK9EkOVkIEg2J/ r3gcEf6PHiYq9f8imRvsE07ge0hJBtK5UIYk/hv2VRsA/wrV+nNQ3fnRNunocTJqdOQL I5ng== X-Gm-Message-State: ALKqPwdX11ZrMrgjOj86Pz0ndRA8VMTKuM97C8mbFk/e7p4DiFNqhR1z /wlEIm03qSpNYAAx14cHZBiJ6cshF0KiDpyLSc8= X-Received: by 2002:a9d:524d:: with SMTP id q13-v6mr9815804otg.241.1527535575519; Mon, 28 May 2018 12:26:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a8a:305:0:0:0:0:0 with HTTP; Mon, 28 May 2018 12:25:55 -0700 (PDT) In-Reply-To: <20180527223403.GT30522@ZenIV.linux.org.uk> References: <20180527223403.GT30522@ZenIV.linux.org.uk> From: Mathieu Malaterre Date: Mon, 28 May 2018 21:25:55 +0200 X-Google-Sender-Auth: vrBCM9dC2E4YuituK73yNn9pNeM Message-ID: Subject: Re: [PATCH][RFC] [powerpc] arch_ptrace() uses of access_ok() are pointless To: Al Viro Cc: linuxppc-dev , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 12:34 AM, Al Viro wrote: > make it use copy_{from,to}_user(), rather than access_ok() + > __copy_... > > Signed-off-by: Al Viro > --- > arch/powerpc/kernel/ptrace.c | 22 +++++++--------------- > 1 file changed, 7 insertions(+), 15 deletions(-) > > diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c > index d23cf632edf0..d8b0fd2fa3aa 100644 > --- a/arch/powerpc/kernel/ptrace.c > +++ b/arch/powerpc/kernel/ptrace.c > @@ -3081,27 +3081,19 @@ long arch_ptrace(struct task_struct *child, long = request, > #endif /* CONFIG_HAVE_HW_BREAKPOINT */ > #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ > > - if (!access_ok(VERIFY_WRITE, datavp, > - sizeof(struct ppc_debug_info))) > + if (unlikely(copy_to_user(datavp, &dbginfo, > + sizeof(struct ppc_debug_info))) Maybe this is just an RFC, but: CALL ../arch/powerpc/kernel/systbl_chk.sh ../arch/powerpc/kernel/ptrace.c: In function =E2=80=98arch_ptrace=E2=80=99: ../arch/powerpc/kernel/ptrace.c:3086:4: error: expected =E2=80=98)=E2=80=99= before =E2=80=98return=E2=80=99 return -EFAULT; ^~~~~~ Missing closing parenthesis. > return -EFAULT; > - ret =3D __copy_to_user(datavp, &dbginfo, > - sizeof(struct ppc_debug_info)) ? > - -EFAULT : 0; > - break; > + return 0; > } > > case PPC_PTRACE_SETHWDEBUG: { > struct ppc_hw_breakpoint bp_info; > > - if (!access_ok(VERIFY_READ, datavp, > - sizeof(struct ppc_hw_breakpoint))) > - return -EFAULT; > - ret =3D __copy_from_user(&bp_info, datavp, > - sizeof(struct ppc_hw_breakpoint)) = ? > - -EFAULT : 0; > - if (!ret) > - ret =3D ppc_set_hwdebug(child, &bp_info); > - break; > + if (unlikely(copy_from_user(&bp_info, datavp, > + sizeof(struct ppc_hw_breakpoint))) > + return -EFAULT; > + return ppc_set_hwdebug(child, &bp_info); > } > > case PPC_PTRACE_DELHWDEBUG: { > -- > 2.11.0 >