Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3748450pxb; Tue, 26 Jan 2021 03:51:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSma2d82oKqhDQgC1jze1aKzvBkeN3OYusWrf27zUeoeK5jh5MFU/7+dnl1glrTDS2DYyU X-Received: by 2002:a05:6402:6c4:: with SMTP id n4mr4347991edy.257.1611661890529; Tue, 26 Jan 2021 03:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611661890; cv=none; d=google.com; s=arc-20160816; b=XLaDx9U8m+6Q2HoI+krEuOdddjMg8tRy75TYwvkAdL9rNUb+4L+h2avrd0d+GwgBe9 sISgH6IsQQPU10mqqMYmcQTDYH7nycksEwPdsgCLAnNhVvSpcmbB/Jgr18hj5KKthUct noxUGEK0SVliJeFPZgJYw3xVSyF4R0Y2tMgbsSg9T8QQ79mxxuZThGaub132McrVH2we TpkutmtFZjkn0nt6poVlOi56QPdB1IsxkNRzf38FZOTltRkiLACIAi0mzhjb4/AeLOum w3dibJznjyg9ET+8y8kdsUex45doXo8/NqHfa1/1BrNEN7giMOMKrddWIWkGo4GSAW7l kejw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AbnKjRHoewJ2viG2j8Rr6WGPjsCo5Vt+p9CXyMcwXOk=; b=wD8mDKMHq60LU8KV4sowuYIsk7993G1/8q2RmeTK9doLNR69mZdKUJe/2SFFirLy9Y dMuiogHKRR9mxDj/IEZztujb0QAlaZHhS74RxJ1bZqz+9m+61bNh0FvthC1bqMFGVIEX xnhjr2jiOp5g8h0Cxe7Tm32ziELBRBGhOSj95fyzS2ZCaS8IudUtsOYLoBvRLN27hmzf uL1Yb+k8MBysqbSjSPMdQe0s0PwS7wJ+UY2PbBUTt5NR8/NmNROZeJVOT4lkY0EIjrSx ErYvigckdImYlHl3Syj+L2PT0yTJgW0bSr/Rqr9dyN+JahkPPawtxde32lmfYR/3J2Hy oipA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=oH9KAHVU; 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 gb7si7307877ejc.286.2021.01.26.03.51.05; Tue, 26 Jan 2021 03:51:30 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=oH9KAHVU; 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 S2404228AbhAZLrl (ORCPT + 99 others); Tue, 26 Jan 2021 06:47:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405419AbhAZLmP (ORCPT ); Tue, 26 Jan 2021 06:42:15 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9884C061573 for ; Tue, 26 Jan 2021 03:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=AbnKjRHoewJ2viG2j8Rr6WGPjsCo5Vt+p9CXyMcwXOk=; b=oH9KAHVUh9+wpMxSKtW92vpsOb 9gP3FfICNKOt5B4iPRZidUc/sVYaA7745HMvHOMwEW/TR8H6n3NDdlA0uWbUUg4cfOm1gggN8+6Y3 xUH9uAf5+JLRhAAZWDZyRnaP2GMNBGVxnybANESjkLhR7kFC/8ygE0ze4A2EXYLtnUTJN5++3s8RO WjUtE5HcYQy8aIe2V+uOMhTuwvrnkVIZhvsZo+fl9GJ7PqQfd0Ew4lX9No1SW2Q4iMUmx6+ZtEKr/ tGeoIVsaRIwu+2Pjdd/6OM07XQtlCsQnmvhH3yo/L/tiK/I+7fTpmhPwazjnuWKNGKKIEZRasfhyt jzBKF5uQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l4Mgo-005WPV-Kl; Tue, 26 Jan 2021 11:39:33 +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 889403010C8; Tue, 26 Jan 2021 12:39:17 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 776DD2128500F; Tue, 26 Jan 2021 12:39:17 +0100 (CET) Date: Tue, 26 Jan 2021 12:39:17 +0100 From: Peter Zijlstra To: Stefan Saecherl Cc: x86@kernel.org, linux-kernel@i4.cs.fau.de, Lorena Kretzschmar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Alexandre Chartre , Mike Rapoport , Ira Weiny , Adrian Hunter , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/kgdb: Allow removal of early BPs Message-ID: References: <20201214141314.5717-1-stefan.saecherl@fau.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201214141314.5717-1-stefan.saecherl@fau.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 14, 2020 at 03:13:12PM +0100, Stefan Saecherl wrote: > One thing to consider when doing this is that code can go away during boot > (e.g. .init.text). Previously kgdb_arch_remove_breakpoint handled this case > gracefully by just having copy_to_kernel_nofault fail but if one then calls > text_poke_kgdb the system dies due to the BUG_ON we moved out of > __text_poke. To avoid this __text_poke now returns an error in case of a > nonpresent code page and the error is handled at call site. So what if the page is reused and now exists again? We keep track of the init state, how about you look at that and not poke at .init.text after it's freed instead?