Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2972567imm; Sun, 1 Jul 2018 09:27:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIauCkhy9cWVu4OBOLPegsoJl84wl8QeFGUL9Ogo37n8URXa+I7EBXHPc9tM8xdIUzK8aym X-Received: by 2002:a65:6657:: with SMTP id z23-v6mr19378382pgv.257.1530462449298; Sun, 01 Jul 2018 09:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530462449; cv=none; d=google.com; s=arc-20160816; b=b5QNS1B1TkmYUcpwo5FtE1v4Kt/R8EQIueoPMuVEHqQpP8vL8g8R57GKwvYR/9o/ln kYJtOMFjEnDDpvEUmoU+yOVsNAezUyo2spXVNUoLraZR3hNQnbO9uYRrvXulztYZhWnP Acv1y4uRwLnSaaLedN5Rbi5IKQV8UMuIaXviMyKCIrgwrZFg8x37ob+5t+tfEQmvu9TI GIU9TlTLxNSe7C/LleKzEMuocmfEUDo9z8JJEYu8eXzQJ/rCN09d8v4wZpIIncPUa1Nb NjNO1YG8Js2VPKlw4AVa8T9ZLiAypP1Lgzjwx47na8jEvjrrCxZm0zxqF5GjSEfMofoB cpDQ== 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=4G9aUvc0C4ev2MhOr9iBMzKFh0kSabs2ck0reCoY5ag=; b=PdZvR85wzG82vOHwjNwwRirQO2TWeMW5EvU++LUnXeKim5xfXYvUABsdCW3+WT5JyN jIzmn1uEMznC+S4jRW3uM0Izi5wPhQkTjmF7V6SUJCmVA0/Sg6D8TztwPz2SzqzyhN2F QEX+xQA9U9pDNJWi8mTcNfhxa+563xWYefDkkF2WCdzaH6P4WBcPlmRSYSGydOitWrQK o2ZQlQTiYvqTZU5z5FrqtsCUpknk/SOK4XKrcFMuEhw8CCtLelKnxx/FaX9vx+BVFxlp 8GTVUvN2fy9YO4ICHEa01neogbZV46w+MbOO5dF7HZ+x7xoh2+Kh440/hLLWNfPZiXrO vbHw== 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 j2-v6si11873508pgv.575.2018.07.01.09.27.14; Sun, 01 Jul 2018 09:27:29 -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 S965126AbeGAQZR (ORCPT + 99 others); Sun, 1 Jul 2018 12:25:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33628 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932790AbeGAQZJ (ORCPT ); Sun, 1 Jul 2018 12:25:09 -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 4B095ACD; Sun, 1 Jul 2018 16:25:08 +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.9 025/101] powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG Date: Sun, 1 Jul 2018 18:21:11 +0200 Message-Id: <20180701160758.152657125@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Neuling commit 4f7c06e26ec9cf7fe9f0c54dc90079b6a4f4b2c3 upstream. In commit e2a800beaca1 ("powerpc/hw_brk: Fix off by one error when validating DAWR region end") we fixed setting the DAWR end point to its max value via PPC_PTRACE_SETHWDEBUG. Unfortunately we broke PTRACE_SET_DEBUGREG when setting a 512 byte aligned breakpoint. PTRACE_SET_DEBUGREG currently sets the length of the breakpoint to zero (memset() in hw_breakpoint_init()). This worked with arch_validate_hwbkpt_settings() before the above patch was applied but is now broken if the breakpoint is 512byte aligned. This sets the length of the breakpoint to 8 bytes when using PTRACE_SET_DEBUGREG. Fixes: e2a800beaca1 ("powerpc/hw_brk: Fix off by one error when validating DAWR region end") Cc: stable@vger.kernel.org # v3.11+ Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/ptrace.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -2380,6 +2380,7 @@ static int ptrace_set_debugreg(struct ta /* Create a new breakpoint request if one doesn't exist already */ hw_breakpoint_init(&attr); attr.bp_addr = hw_brk.address; + attr.bp_len = 8; arch_bp_generic_fields(hw_brk.type, &attr.bp_type);