Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1440774rwd; Sun, 14 May 2023 20:15:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4s7ZUKqKKhD0Z73ibjNqB5d++2cAj/UNYdoDiPz6NZX5EWbsJ+ECZhGNWTDFapeTQq/LoO X-Received: by 2002:a05:6a00:1955:b0:64c:9972:f742 with SMTP id s21-20020a056a00195500b0064c9972f742mr4775701pfk.8.1684120558588; Sun, 14 May 2023 20:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684120558; cv=none; d=google.com; s=arc-20160816; b=k2SiJMrOcZ/jtjzIrl4WrEFJKHHsfTftuNWfwqsfS0RCBfLjI6yaVb/SN9yQ0Wq7Im RJhlg4Wy0HVwU/BC4LKe1Q88VAuUAA0DGtAHsQKYKDA5c1mtJIJPkuXOWHpcgL0Gqp7a etWfmU0HYybEpsvX19FWWkDuOWsC8ZEqWp7FUHQSat8tnm3KpUdVPT966rJfX5Sx8iH9 7MuHKDgMRYZBDdeQcAvyEaq9tPhXZm76/gOTCdruFqi7A1B0My5hDSRS303fTmZaa1oX HuVAjXvZzkz/gdkfzNiSGjkilAtWYi7lJLphaunzAGnMtttxidcz53jayb/8jaiJnAYm WTYA== 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:date:subject:cc:to:from :dkim-signature; bh=HfO0FQe7LL8tpwg2PdMURaHU+jV7nrgpfKB4jccXJDQ=; b=SJetWWRjKiyik+RxFH1d/UheWmEAnezRnzpiBTSKmdKU59zcWASsG/GH/lVfiT2arY 03M8kFOHOX/vCBn38VbyB+uv8y054EeO5rxTSVu0yMGmblp2w7Ih9DJYqKQX/GsJhF3K 5YZqawaR65DbctJanFgbX7tL0zJWKeP9BduqFMCg53i+hK4Eov0qmwV1jz1BdejBDXFx A1/2hcWBSn9//MHTOetD3vz8wn6lY2zlsI1tsjvMgMIcVVZvkbSlgo97N8fkrGbyieKz Ieh+wBB3K4i4ZgugzgoR5n3iDQeagpS1cL07oOQmffuZlO3WgpstG/wVFA64eqbKYe/E MZ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AriHxAGw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i30-20020a63585e000000b0052856cec94asi14521052pgm.884.2023.05.14.20.15.42; Sun, 14 May 2023 20:15:58 -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=@gmail.com header.s=20221208 header.b=AriHxAGw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234828AbjEODNp (ORCPT + 99 others); Sun, 14 May 2023 23:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbjEODNn (ORCPT ); Sun, 14 May 2023 23:13:43 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E3B10F8; Sun, 14 May 2023 20:13:42 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-52160f75920so8354957a12.2; Sun, 14 May 2023 20:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684120421; x=1686712421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HfO0FQe7LL8tpwg2PdMURaHU+jV7nrgpfKB4jccXJDQ=; b=AriHxAGwHUCx9Thh3FsC2fX+7ryTYGbNbpqTWfPEJAGknhGeexqWbFK1+boA7T7l2i cvZsPOsPIDZabmoL1UYaQ+W0PbauJN8DEj9jsFE1MONzFGabg2F0r698TyuuiWsH50oP WNj1umDfsuCg8kJggoxamsUhZs+OZeDDFlixPn8g1MsXajPaIUXOBnIqcNt2Mm8I/+uO laHDPUW5/MBzYBYJarVwqxAoi6OOwB5Zw0ic+dsbDsopHMdUSJJd1/BaMGf/WU2MJrLG hSjR4vV3n0yt9gYg/ctMJrrFHZGySk92o/C+2L1l6BXChx8u64b+cCyyN4cYN2OMU/2i V6tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684120421; x=1686712421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfO0FQe7LL8tpwg2PdMURaHU+jV7nrgpfKB4jccXJDQ=; b=TURNCvXJlwtci6WNG/Yc5w/HZs2jo5stgqkBGTAhDwmfWctkltqwLN/lgh4/ajzLwB wmMsmMP3RoyMofXnfXoXGtUyuMZDgL+1LggNAzpETQCBehDOQWQ/DSbMYYLwWJi/dg1W sTB1Z4xy8SrtFW0I1eD03FWe1xypv2OJ7hnE0CAjdgIUiSLrtosGP8gvf6BCC3KZZlod NuCg3WhBjomfCw77IQSNiTc8a5WMAO3pPDKXlMKA4SzgSzNCktmFveDHnCc5mEowpKEw 18MHP2VE1DWaU5hCmWJx6clViXpgbC6N0wop4SCNbsz170p8vb9U4CGA1WikHwwuI1eY E2sg== X-Gm-Message-State: AC+VfDzswF2ciQESfRUy8HROF/Qd5oCakPz6AU2iX1DBxOGD3OXElmV7 S1lEQI6mVElU6zXaeYO7160= X-Received: by 2002:a05:6a20:3d1a:b0:104:d028:ffe8 with SMTP id y26-20020a056a203d1a00b00104d028ffe8mr10782506pzi.45.1684120421467; Sun, 14 May 2023 20:13:41 -0700 (PDT) Received: from localhost.localdomain ([43.132.98.42]) by smtp.googlemail.com with ESMTPSA id o4-20020a17090a744400b00252b3328ad8sm4943577pjk.0.2023.05.14.20.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 May 2023 20:13:41 -0700 (PDT) From: Ze Gao X-Google-Original-From: Ze Gao To: Steven Rostedt , Masami Hiramatsu Cc: Ze Gao , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH 1/4] rethook: use preempt_{disable, enable}_notrace in rethook_trampoline_handler Date: Mon, 15 May 2023 11:13:10 +0800 Message-Id: <20230515031314.7836-2-zegao@tencent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515031314.7836-1-zegao@tencent.com> References: <20230515031314.7836-1-zegao@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 This patch replace 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. Signed-off-by: Ze Gao --- 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