Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3309092imu; Sun, 11 Nov 2018 12:05:21 -0800 (PST) X-Google-Smtp-Source: AJdET5evK48oEhLsMBIUR/4n4DjxeJZxK73QaVhoVhVcv3ax01eGUk5t2fcFlKULtSS5VLPA4m2f X-Received: by 2002:a63:36c4:: with SMTP id d187mr14747484pga.404.1541966721111; Sun, 11 Nov 2018 12:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966721; cv=none; d=google.com; s=arc-20160816; b=ZPSpnxavIJohNAmXVRuuWDWDKVaHr6GWj1qDJQryHr6JwikI4F53lUHASf/4LhZN/1 VqKTbl8hqW2UpObUe5JZqtL/84Cz2JavMulO0Bb3B3pJziRGeOgQwJ9nNUXrgoCPO4ji 9JmwMA3EMsPy/hH/g0Rp5tWRn+xRstiVZF4oVzruNbpP7n7vrtAY3aMMbfhPJOimTiKm VdMK6sXn7AYF76WzQubbSG/qoOvWpn+mDTvYt7hkfjV99ZlsgnYjIufN6zS5U3UrsukT BaPoWQf0xZ02CbseRuDtymxdWd4Yc1uW2HBinMU0bfwX7xCLPZwbTDYiBPMUdch0X2bi UL7A== 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:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=Y2rigw7hHUZ3bb5pvLQx4QO1WiqzaTLAXm1OTAIt3qg=; b=O+qJY/sY/Q60qmiqY1QfdmQfv0mhtu0PRUXNQpfrNNRPHNMJj4yFJDoYRqoxLUq/l+ 4aeu/RRUenqGGeSuLfyvhfemtc5UWuE0pyBZxJtUc3oGFIUValOFj5FfZqYOU6eZ4FdF ts5/DljcMImPdbXDQy/aPIzLR/GxRhRwonMJ8pA9ITOrtJOIfrQPg5fAbvUpy4nIA7ES QKYC5d8+9bnqxHA6pPxedQY7gBHLdvhHtEV8sfQNHESYdLuCep7yRE0rEO+Tsjq1+IXw DxY1xNyHA8TmxNzaEh5RlnZLZJuztfCKGO9mXZdy30+FFFGxCplneiVxqnwuFYY2ufUw TDYQ== 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 u7si14815130pgg.357.2018.11.11.12.05.05; Sun, 11 Nov 2018 12:05:21 -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 S1730934AbeKLFxa (ORCPT + 99 others); Mon, 12 Nov 2018 00:53:30 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51600 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbeKLFx3 (ORCPT ); Mon, 12 Nov 2018 00:53:29 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt8-0000l7-Eu; Sun, 11 Nov 2018 19:59:18 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsP-0001Rf-N9; Sun, 11 Nov 2018 19:58:33 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Michael Ellerman" , "Michael Neuling" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 070/366] powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 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") Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Signed-off-by: Ben Hutchings --- arch/powerpc/kernel/ptrace.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -1011,6 +1011,7 @@ int ptrace_set_debugreg(struct task_stru /* 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);