Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1297952ybh; Thu, 16 Jul 2020 08:23:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ9zYDyF9BUlvt3MjNkBjCVE6A48Cs2l5M+NXMKK5J5HH6z+XhVwbOZFm+SSy7EQePsOY3 X-Received: by 2002:a50:cf09:: with SMTP id c9mr5118817edk.90.1594912988329; Thu, 16 Jul 2020 08:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594912988; cv=none; d=google.com; s=arc-20160816; b=Eqxx0mLX2fTj9/aFpcbv6OX7chIaBRhv6XSkiI4xNrePuvx+cRM2++gHlqj4sz20H/ oAF1tcBDvuSnTzJmP9NJX7xgCgipiFHmKhqhXv+oCvjrolWhQfcLvYn0Y9CX0dNtmdfi vaSs7kMGcdcDNrHUc4EjM8KgLYcnd5oSdT9DhEUSaa35kltf6SelLbZjRHnChVkr8O1w 9DAizc3C4NGzSjWA2zPpDsJdjF2h9M5+7ArAebRXpMtuTDSJ0fHeCnRFtY9n9JawZQYp bLtCmp7xWdP9dElmo23g97URZdd+xxYylijJ6X/HR+B8mm5lpf97UXoTe4A2faf5JJVz dktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lvV+kZFJ+bicRAujhVqigbzFyFgwaE2AZB7+TjHL0wQ=; b=pVUQ0wHKN4zYelSsQvbxPg/sBLmJ1+NcmsOEyGQ3rfZ/GeM45m/b5IHq2q0cft087+ YpEiEnMBaob1t6+wOrKS6EQ8e2WIkcyeskL+2K84UArTT8HRhKrmds5CHt54R/bSsjnm 5wn0Sj1mBNzw7A8iTnPzYa/7FqUVckz2mDeCL7/exGt193xTkxqY9TbDFb+EpXnMb2mH nWAUoH1G2JiXEwzjlMlLv0/XJo9PtyyaplXaMKLSqvU619OoTp1buttjgbKijGhI2CuB F3FTIFYX3ztbpkiG9cLPSKTXZ9IpJ682YSg9Fw91FjUlWawQ47SHjknuWE1K9HOddtBu +qTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EKI/7sa6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si3325918ejm.346.2020.07.16.08.22.45; Thu, 16 Jul 2020 08:23:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EKI/7sa6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729031AbgGPPUG (ORCPT + 99 others); Thu, 16 Jul 2020 11:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728515AbgGPPUG (ORCPT ); Thu, 16 Jul 2020 11:20:06 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA52C061755 for ; Thu, 16 Jul 2020 08:20:06 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id k6so7494167wrn.3 for ; Thu, 16 Jul 2020 08:20:05 -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:mime-version :content-transfer-encoding; bh=lvV+kZFJ+bicRAujhVqigbzFyFgwaE2AZB7+TjHL0wQ=; b=EKI/7sa6o0FAd3JpJEwHJfrgB5xUNL0OcbuVaKplDph58T1lYOzZjdBhP5dKoWmGYI sXeEjWOazGVnXWV0Yc0TQC4ZiOaCbPkx83Q9aJSunxrfALQeqcykNaJ9XSeMBNrgiRY+ LaM/JhelnlGBhQmf+ZTb+y4UJ9M8KgBkFRlwSxlbELIRG+M229S++tv1nUvFQdZdAHVX Agkwi2ecorBoRct3RZvOKHVpZXe6yVQIvgaWbKVjw0KWboDskHI/7dvFkx1eaE3z5KJa gOzvKZkPl3QT+rAtFg+vDZqX/Fd2qbPOQpMaA2NG274TTDPe8yevyQSl8ZNcUnicKilF 94RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lvV+kZFJ+bicRAujhVqigbzFyFgwaE2AZB7+TjHL0wQ=; b=sIQoGGI3jHe5a+D+cQbPhv1ILBgqvQBNm/DNZ/0cSa9ABuEk4O8u/K5dF4kAV5p7RX L3qLQs8T8rM2XWN/6LDz2PcsyS8YfS49RY9xES7vcQOwdx1xQobQCrah3uzWWugU+cXS QjYkjPiRFTLltoYINR9nkVcKcAqgSp2MHZu9Jx4c0zJcJZt9u5nwcKbTbQVFyJkohP2R uTHUT5yWqPxTmcZRCkwMjIcb053WPHyxW5zAZpD5/q1AFpVgtuE7+e5KDXhkHMBaUoCz e2NYI9pZwdyzkVA3IrKZRx7OZC2BpSs2YUgShPD8jOUUPnR31hLW+3B6idYH3+57ZW7i k/5w== X-Gm-Message-State: AOAM531zlyMng0trzL6JSkm6pODfv5n/jy+uTo6bliP0kP1quJjytlyx lg5YLVGg5NLT+AeQmZ9c5PlzaQ== X-Received: by 2002:a5d:420b:: with SMTP id n11mr5493759wrq.91.1594912804657; Thu, 16 Jul 2020 08:20:04 -0700 (PDT) Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id u17sm9877687wrp.70.2020.07.16.08.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 08:20:03 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , Douglas Anderson Cc: Daniel Thompson , Peter Zijlstra , sumit.garg@linaro.org, pmladek@suse.com, sergey.senozhatsky@gmail.com, will@kernel.org, Masami Hiramatsu , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v2 0/3] kgdb: Honour the kprobe blacklist when setting breakpoints Date: Thu, 16 Jul 2020 16:19:40 +0100 Message-Id: <20200716151943.2167652-1-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kgdb has traditionally adopted a no safety rails approach to breakpoint placement. If the debugger is commanded to place a breakpoint at an address then it will do so even if that breakpoint results in kgdb becoming inoperable. A stop-the-world debugger with memory peek/poke intrinsically provides its operator with the means to hose their system in all manner of exciting ways (not least because stopping-the-world is already a DoS attack ;-) ). Nevertheless the current no safety rail approach is difficult to defend, especially given kprobes can provide us with plenty of machinery to mark the parts of the kernel where breakpointing is discouraged. This patchset introduces some safety rails by using the existing kprobes infrastructure and ensures this will be enabled by default on architectures that implement kprobes. At present it does not cover absolutely all locations where breakpoints can cause trouble but it will block off several avenues, including the architecture specific parts that are handled by arch_within_kprobe_blacklist(). Daniel Thompson (3): kgdb: Honour the kprobe blocklist when setting breakpoints kgdb: Use the kprobe blocklist to limit single stepping kgdb: Add NOKPROBE labels on the trap handler functions include/linux/kgdb.h | 19 +++++++++++++++++++ kernel/debug/debug_core.c | 25 +++++++++++++++++++++++++ kernel/debug/gdbstub.c | 10 +++++++++- kernel/debug/kdb/kdb_bp.c | 17 +++++++++++------ kernel/debug/kdb/kdb_main.c | 10 ++++++++-- lib/Kconfig.kgdb | 14 ++++++++++++++ 6 files changed, 86 insertions(+), 9 deletions(-) -- 2.25.4