Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp86257pxf; Wed, 31 Mar 2021 17:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbuICNKXiXP7JdXqxgQiOOTgwCpYrcdM4DQ5OKB0ZAb/QfJ4ZFi+1JJx344wwnPc4POZ5X X-Received: by 2002:a17:906:7ac9:: with SMTP id k9mr6637185ejo.229.1617237161778; Wed, 31 Mar 2021 17:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617237161; cv=none; d=google.com; s=arc-20160816; b=hiT0ZcstBwglv4e/AxfXrmqBYAkl5KnkQyac8+/wtlAbWzeu/sdMJCDkRVHKfjmEuQ ICLMNp1RFoi273ztQmiVdtdKFUREQur/GnZJGuNvvEblnTknJKrJ0wSZ9zSL+w8jLwRI 6oyZl1PfBdBxWr5sFRwVvdxplwRMgItEhfCgIgWHI2sLddErc2z70PVnONp47rH5c9WL sY80zhWsRHfFbw+uuBn/5JXazLIqXkjFTui9/zUQ9tI0uiiG7jN5HLzPOV1QgJB772Bi 6Pfmbt05FoD2EZZPvLS0ulJA2lJvrAJkZ0nF3jYU47VlPxxYofVCPAJ8UUJm+hYg5scA kvew== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=XygdbC/t6qPnkSYqIwZDrHBMz7+6rXKsnsHPU3KRhLk=; b=NnZqWpCr82Mqo2mnBIprgQk7aC4dkOco6bSU4hYezm9kXmAYyTUNTu61rw5472B9kJ F3DcY49lUKyvsnapxUQxTo9QhTfn2yesTqA7GUycNAWjACyMnOTZnVuGtCztqatbswCy olX4ENcB7NXy7RhdJxDYRlBTNQiMiOXxRVljHlxdx6qIsQHLJEvxAbyYjVS3LkgAKcoQ v8xl1cmKr5byHeIhpk+F8k5JMO+5WIln1Qzb++9CGJs+3OLA3MxEd/3CemoN9v73Gtbx Hfo8y140Ssq1EgGlq8UUAgsswroqgP14G1lM1gnngW3plXhzh31d0nHcG+Uh6r5k91n+ yumQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kW/E6Lbg"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si3209923ede.545.2021.03.31.17.32.19; Wed, 31 Mar 2021 17:32:41 -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=@kernel.org header.s=k20201202 header.b="kW/E6Lbg"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbhDAAbJ (ORCPT + 99 others); Wed, 31 Mar 2021 20:31:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:44986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbhDAAak (ORCPT ); Wed, 31 Mar 2021 20:30:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C2C546101E; Thu, 1 Apr 2021 00:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617237040; bh=62oBHtP8b4XwyEoNVJI6VmhrBZdgCYFCTbD8I+sP/zg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kW/E6LbgqWEEZAvhHiViofcw5zhxPQblmj3TNdcAS3uwY90IWH7VBOq8nCZPcsyBI WfGxVMo/O0WED0VA8ycLnreGZ5zQFUQEQ+otYNAxAIYhkwGMopGSPl8/VW7VPsNABl 4iNicD4J2OkAAgUt5uET2fEDmtMlrvufR2/KJw81J6uIytfaR/hpg9x9pMvroVq3S9 RRC+UbZ/Kr8dpzqeKOwVgb9Xvp1kg70kXuIwMHezmrrsq42DxMrIuduQJwFfzLXTZz 9nfteii8VYEc6Bp1fpZZ4IE8V+zoZ4y1FLVA3DBXBE33AfdBOXX87VDtRRyeb+cag9 VHqKnyOnshqhA== Date: Thu, 1 Apr 2021 09:30:36 +0900 From: Masami Hiramatsu To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception Message-Id: <20210401093036.037f2abbce7ed5d1e68466b7@kernel.org> In-Reply-To: <20210331222244.45a5807c@xhacker> References: <20210330021624.2b776386@xhacker> <20210330183316.942215efe8e6e8455ad14113@kernel.org> <20210331222244.45a5807c@xhacker> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, 31 Mar 2021 22:22:44 +0800 Jisheng Zhang wrote: > On Tue, 30 Mar 2021 18:33:16 +0900 > Masami Hiramatsu wrote: > > > Hi Jisheng, > > Hi Masami, > > > > > On Tue, 30 Mar 2021 02:16:24 +0800 > > Jisheng Zhang wrote: > > > > > From: Jisheng Zhang > > > > > > Current riscv's kprobe handlers are run with both preemption and > > > interrupt enabled, this violates kprobe requirements. Fix this issue > > > by keeping interrupts disabled for BREAKPOINT exception. > > > > Not only while the breakpoint exception but also until the end of > > the single step (maybe you are using __BUG_INSN_32 ??) need to be > > disable interrupts. Can this do that? > > > > interrupt is disabled during "single step" by kprobes_save_local_irqflag() > and kprobes_restore_local_irqflag(). The code flow looks like: > > do_trap_break() // for bp > kprobe_breakpoint_handler() > setup_singlestep() > kprobes_restore_local_irqflag() > > do_trap_break() // for ss > kprobe_single_step_handler() > kprobes_restore_local_irqflag() OK, thanks for the confirmation! Reviewed-by: Masami Hiramatsu Thanks, -- Masami Hiramatsu