From patchwork Tue Sep 20 10:03:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 76597 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1393627qgf; Tue, 20 Sep 2016 02:56:52 -0700 (PDT) X-Received: by 10.66.16.97 with SMTP id f1mr54247487pad.39.1474365412262; Tue, 20 Sep 2016 02:56:52 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r195si43547239pfr.240.2016.09.20.02.56.51; Tue, 20 Sep 2016 02:56:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751594AbcITJ4v (ORCPT + 3 others); Tue, 20 Sep 2016 05:56:51 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36457 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbcITJ4u (ORCPT ); Tue, 20 Sep 2016 05:56:50 -0400 Received: by mail-pa0-f49.google.com with SMTP id id6so5563960pad.3 for ; Tue, 20 Sep 2016 02:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=v6PAeXMgGFH1VfkuNfiYamq/qgVjUZCXj9Dk3M8lSgM=; b=Kl6aX3YMDcrtK779QgptE47fJqW+CCDnCVd7JvqaHfMTMfJ1cAJ+PDXYZaHJQhba5W rG/U6DMMzRlFIW6cQ9YCr+S5a508mKU+Wx+UzP5MviRRuoAmSjMW3h24hn8iUWE6CU3G M+ped5L40NE7gAP/6vOsagE5uYrw8iH64Ui0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=v6PAeXMgGFH1VfkuNfiYamq/qgVjUZCXj9Dk3M8lSgM=; b=JffwhcxIRWwhmAJmnze0rs7oMRhYhQfvpSsLuT5kzGBJIwhFCzmJvtEEHkNeqh58Es XCQswekAKfgRVayzyN/ucuZ/tSwITrm44348NzKaSXlU6jPGTXQe/baPSG4R8mN49jRJ hdy5V/Q17h8ueWuDhY/xdzf7s6Lhsp30FCqPOaeBC8H0t4pAYHKPFnhbgymL2hnvNUZk u5jTEPPWwtwKvN5x4LByPWbvV6z0JoQVdH7XbBj+1DchLS/hQvuBpX6E4A2mYucWRgOj /W50/UwoERd+V2mc02IoiOgpy2s4lmfkCyAtOZVI0BaqWRS5Nqdw6Ls3Jqk8e05AAqMp 99sQ== X-Gm-Message-State: AE9vXwNq3qGouJLdWvO1g8Q190QnzhiGJPAmu5hJ8n91WK750LwmIVICsYiL15iooOsEcYT2 X-Received: by 10.67.16.76 with SMTP id fu12mr40211954pad.171.1474365410039; Tue, 20 Sep 2016 02:56:50 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id s12sm77718059pfj.73.2016.09.20.02.56.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Sep 2016 02:56:49 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, jason.wessel@windriver.com Cc: linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, stable@vger.kernel.org, AKASHI Takahiro Subject: [PATCH] arm64: kgdb: handle read-only text / modules Date: Tue, 20 Sep 2016 19:03:21 +0900 Message-Id: <20160920100321.17846-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.10.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Handle read-only cases (CONFIG_DEBUG_RODATA/CONFIG_DEBUG_SET_MODULE_RONX) by using aarch64_insn_write() instead of probe_kernel_write(). See how this works: commit 2f896d586610 ("arm64: use fixmap for text patching") Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Cc: Jason Wessel Cc: # 4.0- --- arch/arm64/kernel/kgdb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.10.0 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index 6732a27..133cfe3 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c @@ -382,3 +382,23 @@ struct kgdb_arch arch_kgdb_ops = { KGDB_DYN_BRK_INS_BYTE(3), } }; + +int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) +{ + int err; + + BUILD_BUG_ON(AARCH64_INSN_SIZE != BREAK_INSTR_SIZE); + + err = aarch64_insn_read((void *)bpt->bpt_addr, (u32 *)bpt->saved_instr); + if (err) + return err; + + return aarch64_insn_write((void *)bpt->bpt_addr, + (u32)AARCH64_BREAK_KGDB_DYN_DBG); +} + +int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) +{ + return aarch64_insn_write((void *)bpt->bpt_addr, + *(u32 *)bpt->saved_instr); +}