Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3016030imm; Sun, 1 Jul 2018 10:21:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLGNPOZ1SsQV5fcpvtRKYmmy9Hm+q2DXcP6oeVcZTsY4A2eCUgUi+A9iz7KsIDlxTJ930LM X-Received: by 2002:a65:4146:: with SMTP id x6-v6mr19196177pgp.221.1530465670348; Sun, 01 Jul 2018 10:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465670; cv=none; d=google.com; s=arc-20160816; b=Mh6G+i0IkyXf7coKxlOdZFjaLzNtysBQIwgX24gCqR1A77KGE+Eexc8XMMGBFciymK Jo9KEi34JXvdQkQgh9uaAXEpYTZpqGDlynkDOWBvkhhE/ztiRS2TpMjaAwBLgHyGaZhR J93ceSEgasYORk7dYZETaQiFmtgqVcu3nPvpkou4TjXm/4vCOUxl2FD3GWsbOgmXv8xB f3xmj+pT0Zmk9YAGMeasGCKofQH13rbEcNxJBJK6xRF9mpgcYwErHHgrUO+5Kb+CY2go 6G142gIKKFjcinSQiNd5924a0QkqhyHyq6i/i5UVRuW07+hHP1FuAIZ5zNf4kMvqsT3m Ztrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1wKZqHNt2kXaDjqLLmgzXe4Fdua5o1BTZ//3advrxBY=; b=RfOSbPjJwk5uGb98Y1KF+jkEUX68mwZlqRz8KG3/dt+U91YEBkx+hSQjqjKNDB6aJk Ll13FFf/38RIN6OD1maYvgyv9P3bknFRD2EcfU8eLB8w4p/wT4EmZp0Dfy1g6hJj74vw S8YO4PWnyQjw3cyOWb0AEgAmiCFfuknwtKzFJByjq4soCPqh30Oo/i/yrDrnZrNcC5OB lupsSpsI1WrZekhyV7ci39r6pgoP0H80dfNTjKKK3AmdFPI1JWKjEkvFqt8dBAJjBOf2 5u0bPs55kvdm9venKJNVTvfVZYTjYvO73aA765MIs/MDC4qFulXp6AWaXpbEJSBrmNl/ khEg== 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 q185-v6si13985462pfb.216.2018.07.01.10.20.56; Sun, 01 Jul 2018 10:21:10 -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 S1031621AbeGAQio (ORCPT + 99 others); Sun, 1 Jul 2018 12:38:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36750 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031121AbeGAQig (ORCPT ); Sun, 1 Jul 2018 12:38:36 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 936D6A73; Sun, 1 Jul 2018 16:38:35 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Neuling , Michael Ellerman Subject: [PATCH 4.17 048/220] powerpc/ptrace: Fix enforcement of DAWR constraints Date: Sun, 1 Jul 2018 18:21:12 +0200 Message-Id: <20180701160910.326023106@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Neuling commit cd6ef7eebf171bfcba7dc2df719c2a4958775040 upstream. Back when we first introduced the DAWR, in commit 4ae7ebe9522a ("powerpc: Change hardware breakpoint to allow longer ranges"), we screwed up the constraint making it a 1024 byte boundary rather than a 512. This makes the check overly permissive. Fortunately GDB is the only real user and it always did they right thing, so we never noticed. This fixes the constraint to 512 bytes. Fixes: 4ae7ebe9522a ("powerpc: Change hardware breakpoint to allow longer ranges") Cc: stable@vger.kernel.org # v3.9+ Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/hw_breakpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/hw_breakpoint.c +++ b/arch/powerpc/kernel/hw_breakpoint.c @@ -178,8 +178,8 @@ int arch_validate_hwbkpt_settings(struct if (cpu_has_feature(CPU_FTR_DAWR)) { length_max = 512 ; /* 64 doublewords */ /* DAWR region can't cross 512 boundary */ - if ((bp->attr.bp_addr >> 10) != - ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 10)) + if ((bp->attr.bp_addr >> 9) != + ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 9)) return -EINVAL; } if (info->len >