Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2190199ybg; Fri, 5 Jun 2020 07:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaLHTXvFhJcNBrNlBwRuXQShnD80S2wRqvN0ELEWTukCYJLSbu/tHphkoq308TCGX7XNv6 X-Received: by 2002:a17:906:51c9:: with SMTP id v9mr8818224ejk.337.1591368458022; Fri, 05 Jun 2020 07:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591368458; cv=none; d=google.com; s=arc-20160816; b=0RFnN5nOngkm5BWdWrsnhWzh0yOEEjSeCnFvEmVrSeAMu6wyWgi0P+OW5rbzMf52kE xiI2bAaZae9o0uIHxA9u4Z1Txs0VScWohfyerx9eCjgPdYxNJdkp9WLNrnNJay3pEWXW Tsj4VcNeNpCYR6Vaa5lT1QjeO+eZ/yKoz66DJaN4AI7HCluY3nVvDYO9qbxuvWOXUGED wfCCp5Z67R03oo0SjIpLmawyOL/UclqAei2hDff+okdtVL0st8Z49gztB3lBdFosZxzA EpTy1SgDQSZJwfsPsjs/dkFB56wJcJWjRyihc2szdH1NZRXzO3tfIvrZ57QQiZF41AKW kEwQ== 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:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2KqS9GDLfei9p1sb6woUsx+zVR7cGlA+3c0QP7ohtJE=; b=ikqrQ4AFhsk3i2bKimMO4QWyilX/qDSQkiz2vHW9tv0xPv+eo2Rknry4ByM+ZcLb3A 7oIHfFhnpYub4nhhQhrCbA2qGk2RDdB3ftBg7do/Z+iBTQS32VOyEQR7S7qgH6JSCRgT vfanDyH7iWJHkCwn+ltBXbhFmRfpW6OksD9yAKgg4jOBej0lOv4413NCM6E7yErkzA31 tRgTbspZ4Rx1gfxWR6gchanppGwfeH1mUM/led/TAYQZVPHoytdiipr3KT9qD3PN8Mj3 fu5+K5e9AJOZDOnNMIY7vv2KJssVDguCwbdoo5obCTNLreSyVuM9nQBxXfq4zCPnsyT/ SCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=eGAfBDDR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si3736850eds.168.2020.06.05.07.47.14; Fri, 05 Jun 2020 07:47:38 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=eGAfBDDR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727945AbgFEOpY (ORCPT + 99 others); Fri, 5 Jun 2020 10:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727113AbgFEOpY (ORCPT ); Fri, 5 Jun 2020 10:45:24 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B660AC08C5C2 for ; Fri, 5 Jun 2020 07:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2KqS9GDLfei9p1sb6woUsx+zVR7cGlA+3c0QP7ohtJE=; b=eGAfBDDR7VUNIJzUpO+py0WWxs BZuhWABbN4umtgrUOxi0KQDThDNapT2Y1yAdhk3iFtrsXKYHw/WUrd4VIEdLR+nl+sj/NMFPTHclo Tzsf+CuoDXhf8R3h8hX01pjeC7EQEnF0xUk+YjSs641SLUg/TjCKTkkpg1NJYj7RMtvidKG048JC+ c7mb8z+X8AGcls8wVUy01BRpMh+uTth0oq9WQy/ammynLRuK7vkPMB3CtEm8bMU39GJz5gNyAqQeo TruqEvcTdD8xVNDN7AMnFDMbf8aUFd4pcqOML6X7ulX/hZJQVRMRJ4h3QXrOunvTUGgO4l3PLtmPM 9Bcb+IMA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jhDac-0004EE-OP; Fri, 05 Jun 2020 14:44:58 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3D3D8301ABC; Fri, 5 Jun 2020 16:44:57 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 27DB921A74B41; Fri, 5 Jun 2020 16:44:57 +0200 (CEST) Date: Fri, 5 Jun 2020 16:44:57 +0200 From: Peter Zijlstra To: Daniel Thompson Cc: Jason Wessel , Douglas Anderson , sumit.garg@linaro.org, pmladek@suse.com, sergey.senozhatsky@gmail.com, will@kernel.org, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org, Masami Hiramatsu Subject: Re: [RFC PATCH 0/4] kgdb: Honour the kprobe blacklist when setting breakpoints Message-ID: <20200605144457.GD2948@hirez.programming.kicks-ass.net> References: <20200605132130.1411255-1-daniel.thompson@linaro.org> <20200605142953.GP2750@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200605142953.GP2750@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 05, 2020 at 04:29:53PM +0200, Peter Zijlstra wrote: > On Fri, Jun 05, 2020 at 02:21:26PM +0100, Daniel Thompson wrote: > > 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 does intrinsically > > provide 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 ;-) ) but the current no safety rail approach is not easy to > > defend, especially given kprobes provides us with plenty of machinery to > > mark parts of the kernel where breakpointing is discouraged. > > > > This patchset introduces some safety rails by using the existing > > kprobes infrastructure. It does not cover all locations where > > breakpoints can cause trouble but it will definitely block off several > > avenues, including the architecture specific parts that are handled by > > arch_within_kprobe_blacklist(). > > > > This patch is an RFC because: > > > > 1. My workstation is still chugging through the compile testing. > > > > 2. Patch 4 needs more runtime testing. > > > > 3. The code to extract the kprobe blacklist code (patch 4 again) needs > > more review especially for its impact on arch specific code. > > > > To be clear I do plan to do the detailed review of the kprobe blacklist > > stuff but would like to check the direction of travel first since the > > change is already surprisingly big and maybe there's a better way to > > organise things. > > Thanks for doing these patches, esp 1-3 look very good to me. > > I've taken the liberty to bounce the entire set to Masami-San, who is > the kprobes maintainer for comments as well. OK, after having had a second look, one thing we can perhaps address with the last patch, or perhaps on top of that, is extending the kprobes_blacklist() with data regions. Because these patches only exclude kgdb from setting breakpoints on code; data breakpoints do not match what we do with arch_build_bp_info().