Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2048601rwd; Wed, 17 May 2023 05:11:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BLkDKzWdUF2SQ6jdpBDUt9hStbPvFmBqsFWEgSGc6HQKv2cQlCG2y47sY5LnRzC7mzcrq X-Received: by 2002:a17:902:bc83:b0:1ad:fcdc:2a9f with SMTP id bb3-20020a170902bc8300b001adfcdc2a9fmr14118706plb.51.1684325509542; Wed, 17 May 2023 05:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684325509; cv=none; d=google.com; s=arc-20160816; b=ydDERCZU1srz1LcR4RUntx2MnhI38zZT6ouvjhWdCy7VbhElu1dT+IW03F8opQYr8y v3YHgzP43Dox3XtgjVNb648Y7UBEhuCATqeowe2LklAoBKVgtwf5TgjwRYyFCf+TPDHG 2fmyTHRQywy9iQxYvWHuVuMHJhQO8pa6eRzOQ91eETDT5+9caLtwXgageBrLPppyz2Ur 4jeug9jkYiMuIdX92tDzPYnIY8V6OOPVWhv8xm1qa1vmdkeetM6yS08bm9sMhO/t7sLk CoK2hzFZnho3XGpG7jV7q0OGgEN3Wz8oO6aXFq28Ab7S3Yw0/phtE6AhusUSd6orY1wM yL+w== 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=eLqqHEnSmBCrbzVnSwJUVHod/A2Oq88/aPEWuovqe7Q=; b=zlirzLc1JhuKlHHI30HDg/yqAe1GXYWZC0ccE8xwS+vXhHKl1Ni8XxajMPW/hFANMM Yye1WcbiMs9800LI8o4p+Z8S0ZX5vBfrZqGy302ZLj292D8WXH44eLW/cRDC+THPCh+P ziznyGZooEcYNYGF48SNrvIbyIxKTWfvo0QUWM6q5fNKF8gy0D3nyGPLB34OKLU2sAxh aw8wZDFU7yJE/giEu5NyakOwihIOjZCq/3zT29l7NPgN8Un3w9hMS7g2KHSGOGQw6GsI CeJTPyYLAgZcWmP3o3J5VV8nTv6RM8AdC1n8bbXOgbat7W3MWsqGPWAKdm2f7tymqBZ1 3pFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="A3wxgK//"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a170902d2c800b001a6ce2cdb20si21924504plc.244.2023.05.17.05.11.33; Wed, 17 May 2023 05:11:49 -0700 (PDT) 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="A3wxgK//"; 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 S231466AbjEQMAE (ORCPT + 99 others); Wed, 17 May 2023 08:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbjEQL74 (ORCPT ); Wed, 17 May 2023 07:59:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E29421D; Wed, 17 May 2023 04:59:55 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id B9D7D638AE; Wed, 17 May 2023 11:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8FEC4339B; Wed, 17 May 2023 11:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684324794; bh=+KJCyW8UcBpWC8n/rNnAChXGAO9waLTlJQG8Dp7ZVa0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=A3wxgK//Fl+HRbw82WER6yeLjIrBy7NjkG7nKzaC9v+P1fj78NXLtyfTUYg6p8RW3 bcAK0NdVb6cmJkcuG45bfXlMqsGuVB3TLoZ9orpTFPY1byepkeSx7xQjtgNU8zrKKD wTdJxIXAMwBx6Iy/a0uF9S1BYxfeG0GyYWMfIWmHRxsQhRcHkH1v9LzjA+kNLKpqv7 e8r084YNf5nre8CudRHdqPB1LnJmYIUgarQqld+w/Od+y+7vBvaKV14OCnreYJC/FG 6y/C9GMB3OgNGppJUtg0r4xA4tjwSUsps1xz2PWr2TMPKYhtqmtc7D/8CKGwlHTkOb B2qnlglxsW41Q== Date: Wed, 17 May 2023 20:59:47 +0900 From: Masami Hiramatsu (Google) To: Ze Gao Cc: Steven Rostedt , Albert Ou , Alexander Gordeev , Alexei Starovoitov , Borislav Petkov , Christian Borntraeger , Dave Hansen , Heiko Carstens , "H. Peter Anvin" , Ingo Molnar , Palmer Dabbelt , Paul Walmsley , Sven Schnelle , Thomas Gleixner , Vasily Gorbik , x86@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Conor Dooley , Jiri Olsa , Yonghong Song , Ze Gao , stable@vger.kernel.org Subject: Re: [PATCH v3 1/4] rethook: use preempt_{disable, enable}_notrace in rethook_trampoline_handler Message-Id: <20230517205947.c1710ed175519b59f56e09b1@kernel.org> In-Reply-To: <20230517034510.15639-2-zegao@tencent.com> References: <20230517034510.15639-1-zegao@tencent.com> <20230517034510.15639-2-zegao@tencent.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Ze Gao, On Wed, 17 May 2023 11:45:06 +0800 Ze Gao wrote: > This patch replaces preempt_{disable, enable} with its corresponding > notrace version in rethook_trampoline_handler so no worries about stack > recursion or overflow introduced by preempt_count_{add, sub} under > fprobe + rethook context. > > Fixes: 54ecbe6f1ed5 ("rethook: Add a generic return hook") > Signed-off-by: Ze Gao > Acked-by: Masami Hiramatsu (Google) > Cc: > Link: https://lore.kernel.org/linux-trace-kernel/20230516071830.8190-2-zegao@tencent.com Note that you don't need to add Link tag of the previous version for each patch. I'll add it when I pick it :) Thank you, > --- > kernel/trace/rethook.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/rethook.c b/kernel/trace/rethook.c > index 32c3dfdb4d6a..60f6cb2b486b 100644 > --- a/kernel/trace/rethook.c > +++ b/kernel/trace/rethook.c > @@ -288,7 +288,7 @@ unsigned long rethook_trampoline_handler(struct pt_regs *regs, > * These loops must be protected from rethook_free_rcu() because those > * are accessing 'rhn->rethook'. > */ > - preempt_disable(); > + preempt_disable_notrace(); > > /* > * Run the handler on the shadow stack. Do not unlink the list here because > @@ -321,7 +321,7 @@ unsigned long rethook_trampoline_handler(struct pt_regs *regs, > first = first->next; > rethook_recycle(rhn); > } > - preempt_enable(); > + preempt_enable_notrace(); > > return correct_ret_addr; > } > -- > 2.40.1 > -- Masami Hiramatsu (Google)