From patchwork Thu Dec 1 14:38:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 2489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp304112wrr; Thu, 1 Dec 2022 06:53:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf4v1IWTPvuX47LqvuzpCLpF353n59Z/K+1/JTolG+yDHNyDU1kP6BmWg38lqeLGsfKdt7KQ X-Received: by 2002:a17:906:fcda:b0:7c0:a728:6cbb with SMTP id qx26-20020a170906fcda00b007c0a7286cbbmr5245737ejb.104.1669906413292; Thu, 01 Dec 2022 06:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669906413; cv=none; d=google.com; s=arc-20160816; b=OSOKwc6CQSR7qsVaRzQfXL3ckdDX21UPa9OqUAdUQSGcFnPxpAVGdi7xw8MyRIbKqB xJA3ixpZtapn8PHR3p4akNH5v2fTdQMe8O5RShtUJxlLhrB/ubr7nwwAYyYZJHp2lrm1 hYAjuMIjdCQM70Avuuvo/tOvn7jFGa/E9jjYC7xGc9dkjSGYx3MTlfw3bNYnqjxOXsOE ORUYUfcGswJpqFOQrsDtPGDInQoWRtaeY/wQM317pQscRP8xr+KfK3++8qAuqTkrz2JW WH1jRMe0voPt8aYCWB6i+WGtk7RyswRuy26R3kz9Zeu7gAHhtaSVXvVZJ+Ycp95AQJjJ WmUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=UXXD894Cno/cxd9PC1cspsvIakP/mCePXiPyAN7InHU=; b=zcwbNHm5szQNCcz5rjGV+IDsFNED69CFBpFq0nHpg091CPrpBjBASJdrbSVqir0/9z uRoO9AK4/iTFJqaaYIyHkqXsbtrMUKi+8wgSSRhuXYWK7T6oSmjhbKGWifguUSmtw+Xn 6P3N0kDWaid/LJjKXb1eR4KOSC6VXlmsmexJcSnJmpNzVSUQdNK6hKI5nxLn6eQj1Fi8 VwmzSrYR6MG/LswBOYb68PJhQ4Gt+8ujJzHSAsaGSbqKo+rPiEXqrK2yeWXYjmLmUhLQ z+/vzi8QubQKyRVIxtDB6aZWmb4++h+rKqqCObXmcB/oUYY4p55P/Pa98BRCGepg+DCN yjBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LptiEmZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd18-20020a1709076e1200b007c09d706525si3853679ejc.108.2022.12.01.06.53.09; Thu, 01 Dec 2022 06:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LptiEmZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231781AbiLAOjC (ORCPT + 99 others); Thu, 1 Dec 2022 09:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbiLAOjA (ORCPT ); Thu, 1 Dec 2022 09:39:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B23A6040 for ; Thu, 1 Dec 2022 06:38:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BAD9B81F65 for ; Thu, 1 Dec 2022 14:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0151AC433D6; Thu, 1 Dec 2022 14:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669905536; bh=zjg9hqyT/cvW+xoLTuMA96NteGmgZ6jPNBUY+Kiab1s=; h=From:To:Cc:Subject:Date:From; b=LptiEmZWEYpFEm+OjQAbOIb9Nkdoc9xQrQqR0Xmc42JD7Ql2j0ejidB+Ri1/jWPSM XvU3HdECIe2WbTuIibMcmo5hDFiwCipgyyemKBTjjSVBhxelQPMZgimOqtNdPcVJed U+RT2jOTRKFaWHnw2Z/SwFz2xr29Wc+8Tx8K9FN/fFqmjLfPX3IW0L63y7CDU9Qr3N PCw8V2be87+djYeRst4QZ6LZlOr0qFO7zPoftndI2IsFAKoQ9oeVBh89GRbj2FdxpW 8QeqGBmrnxCQ41sT6lh6npE89dI04VmDE4EsZeQIPyne0vR3NC8T85pfeDlpK2FusG b6JLucNxahpbQ== From: "Masami Hiramatsu (Google)" To: Catalin Marinas , Will Deacon Cc: Mark Rutland , Mark Brown , Kalesh Singh , Masami Hiramatsu , Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sandeepa Prabhu Subject: [PATCH 0/3] arm64: kprobes: Fix bugs in kprobes for arm64 Date: Thu, 1 Dec 2022 23:38:52 +0900 Message-Id: <166990553243.253128.13594802750635478633.stgit@devnote3> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751023787252023533?= X-GMAIL-MSGID: =?utf-8?q?1751023787252023533?= Hi, I found some bugs in kprobes for arm64. One is a critical issue, which will cause a kernel crach easily with lockdep[1/3]. Others are minor issues and rare cases. [2/3] let do_page_fault() fixup the page fault in kprobes user handler, and [3/3] is more like code cleanup and returns DBG_HOOK_ERROR if it can not handle kprobe's BRK (but that should not happen.) Thank you, --- Masami Hiramatsu (Google) (3): arm64: Prohibit probing on arch_stack_walk() arm64: kprobes: Let arch do_page_fault() fix up page fault in user handler arm64: kprobes: Return DBG_HOOK_ERROR if kprobes can not handle a BRK arch/arm64/kernel/probes/kprobes.c | 87 +++++++++++++++--------------------- arch/arm64/kernel/stacktrace.c | 7 ++- 2 files changed, 41 insertions(+), 53 deletions(-) -- Masami Hiramatsu (Google)