Message ID | 20230516071830.8190-1-zegao@tencent.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp240782vqo; Tue, 16 May 2023 00:33:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7f/M8BtUGCYoqM8p1ippmnnSQVIdYVTUsME+1NMgr4VDTC3z1XBOD76sPEINRp5hG1tCpr X-Received: by 2002:a05:6a20:8e09:b0:100:9eff:9b95 with SMTP id y9-20020a056a208e0900b001009eff9b95mr38102037pzj.18.1684222400833; Tue, 16 May 2023 00:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684222400; cv=none; d=google.com; s=arc-20160816; b=A38Vh1iYP0qxcoqGxAjbsvWEXhzEJxENEzzH0zW/3qdmOjR7u9nsC4i/jf8YvQi9sm aNo3HVUuPIz9UxcEETXCstrR7kGL6ZfCoDVtNaq3zIXkDfIXTTzZo4quQYtcn/iE1beN OPILRtNKAyCnUKSnWdWjZHSmHHKu7edXJi26/4W0pZKBj5ugIeNQQIbkvPoV3k9ANLuv WthZG2qOaRt+CwC29Oa/gA47VmVZvKWBaxYn5WgKamkTuL+FMEm/Cd6B7YL4ZGGBWEe0 /HthozC0yTbbxrIRLIKV4Cll/M4LKlzhZYWtHN92x2co9MfPbC++WPgqwLsV3MGRCv99 Cqaw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=tnAI2sXUbiQvd6mgY7NnxOBWPf3gGQ8XWTI5xmKxwWU=; b=ZfMSqOE9GHM/RwAnL65EttXtPbwVNdhZfP32WRx2eZxJHTEl8i5HGwIch6gAgzCkn/ 7nPGeup7KKIRrUOBGzaEXqiwjAnmCi6SVU8hvJ0uweaCX5V1Zqz1Fa/kddEvOrh/vHYx 6d+oJeSk2vqhMOAq5iM1ojwIPid4z2A7zyLfqz78I0S9Y8FpnKnaCFU5NqqgRtCZUxOF gYeYfR1VojQKkM6YNYyr+U92L17+dcnMm/XgmRJ/E7bg2mEuJjsbIGrnCl6Qq5sB04nd Kmxv8Y2H+0AW+2cBIaW+ubzyFMl/48wPVVVqSSlRCmUF/A8100XDS+ZPaWeoJ8WYfxG4 7Ldw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=np4y4iLN; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q23-20020a638c57000000b004e4b651bb5esi18390289pgn.172.2023.05.16.00.33.07; Tue, 16 May 2023 00:33:20 -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=np4y4iLN; 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 S231225AbjEPHSv (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Tue, 16 May 2023 03:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjEPHSt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 16 May 2023 03:18:49 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A6F419A; Tue, 16 May 2023 00:18:48 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-51f6461af24so9604156a12.2; Tue, 16 May 2023 00:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684221528; x=1686813528; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tnAI2sXUbiQvd6mgY7NnxOBWPf3gGQ8XWTI5xmKxwWU=; b=np4y4iLNUIexTfiyIkMxgYRriRCWr8e/v0OflxMm2NmIfb1jr2jheNFm1Ks54g+2f0 yCdYdJ105s74b2lGBaMJLO0sY+u2TSGBBk/upTjlyWrV3Rs6gbgs5BY1+Kq8xDzyI+qs or9CRP5q7DogGW9pPPIMj3dhNLzm4sJV0HhgI2UuKgXUPRqEE9qfYM773droKbYS9THF 3LheMjghgJSOiC7tR5xsEGfU1ycFZGm9Ifcvu0Sj41VX3pRDwF7ieFsEAz/F0fB8KzhU xZbMj9nEIukEPVK/IjlfIdLQjS86Sr7zMUAEtRTHXSlv6XbORqIwDInXPJvWyHYibCgD yAyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684221528; x=1686813528; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tnAI2sXUbiQvd6mgY7NnxOBWPf3gGQ8XWTI5xmKxwWU=; b=Ll16AUr5XYXwy2QrzQusSZ/TJshAbctUagrMJL54lEjqcMbEl8AY4ItnOgPZBEaJ0n hNli2kmkZYIVePYCMG+TXCsKwUr8B3hdizAv3NWgE3npwvRb5cnuO4MUsqpU8fcrO+Gt UsrPCKK+nwA4plhHURnStwufJDdpy7vRl0xFwuAUmQ/ZjH0Ayhm5JZ0PhDVgbg8Gtj/6 2MOYoYNEaT+3gJhSzcnxT6YlIX8SBr4H05fGiGHlHYhM/yuoTYUU2SKexV3kh8Mc7JfV dPH9XsKaTAi8hqnX2zVd8KjqeXufovSMU5tfVns7psM2UkPVBHBvzcDL0Yq4vhnhQUWt RCkw== X-Gm-Message-State: AC+VfDzRKkp/W5THEopU52RNPyBD2NsANIJQ06crO7t/LUYD563CYT19 wSJtBmKxyUpOruFPE9Jy28E= X-Received: by 2002:a05:6a20:3d82:b0:104:2200:8949 with SMTP id s2-20020a056a203d8200b0010422008949mr21473230pzi.56.1684221527736; Tue, 16 May 2023 00:18:47 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.15]) by smtp.googlemail.com with ESMTPSA id 17-20020aa79251000000b006468222af91sm12849830pfp.48.2023.05.16.00.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 00:18:47 -0700 (PDT) From: Ze Gao <zegao2021@gmail.com> X-Google-Original-From: Ze Gao <zegao@tencent.com> To: Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org> Cc: Albert Ou <aou@eecs.berkeley.edu>, Alexander Gordeev <agordeev@linux.ibm.com>, Alexei Starovoitov <ast@kernel.org>, Borislav Petkov <bp@alien8.de>, Christian Borntraeger <borntraeger@linux.ibm.com>, Dave Hansen <dave.hansen@linux.intel.com>, Heiko Carstens <hca@linux.ibm.com>, "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>, Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Sven Schnelle <svens@linux.ibm.com>, Thomas Gleixner <tglx@linutronix.de>, Vasily Gorbik <gor@linux.ibm.com>, x86@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Conor Dooley <conor@kernel.org>, Jiri Olsa <jolsa@kernel.org>, Yonghong Song <yhs@fb.com>, Ze Gao <zegao@tencent.com> Subject: [PATCH v2 0/4] Make fprobe + rethook immune to recursion Date: Tue, 16 May 2023 15:18:26 +0800 Message-Id: <20230516071830.8190-1-zegao@tencent.com> X-Mailer: git-send-email 2.40.1 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766035188206324530?= X-GMAIL-MSGID: =?utf-8?q?1766035188206324530?= |
Series |
Make fprobe + rethook immune to recursion
|
|
Message
Ze Gao
May 16, 2023, 7:18 a.m. UTC
Hi all, This is the 2nd version of patch series to fix the ftrace rethook recursion problem. v1: https://lore.kernel.org/linux-trace-kernel/cover.1684120990.git.zegao@tencent.com/T/ +++#md4c0bae6a6cae28dadf2a2c6105ff140b35fddea As Steven suggested, this version removes unnecessary notrace annotations from fprobe and rethook functions from v1 [PATCH 2,3,4/4] and replaces with makefile changes to filter out compiler flags which ftrace depends upon for rethook related objects. Ze Gao (4): rethook: use preempt_{disable, enable}_notrace in rethook_trampoline_handler fprobe: make fprobe_kprobe_handler recursion free fprobe: add recursion detection in fprobe_exit_handler rehook, fprobe: do not trace rethook related functions arch/riscv/kernel/probes/Makefile | 2 + arch/s390/kernel/Makefile | 1 + arch/x86/kernel/Makefile | 1 + kernel/trace/fprobe.c | 72 ++++++++++++++++++++++++------- kernel/trace/rethook.c | 4 +- 5 files changed, 63 insertions(+), 17 deletions(-)
Comments
On Tue, May 16, 2023 at 03:18:26PM +0800, Ze Gao wrote: > Hi all, > > This is the 2nd version of patch series to fix the ftrace rethook recursion problem. > > v1: https://lore.kernel.org/linux-trace-kernel/cover.1684120990.git.zegao@tencent.com/T/ +++#md4c0bae6a6cae28dadf2a2c6105ff140b35fddea > > As Steven suggested, this version removes unnecessary notrace annotations from fprobe > and rethook functions from v1 [PATCH 2,3,4/4] and replaces with makefile changes to filter > out compiler flags which ftrace depends upon for rethook related objects. > > Ze Gao (4): > rethook: use preempt_{disable, enable}_notrace in > rethook_trampoline_handler > fprobe: make fprobe_kprobe_handler recursion free > fprobe: add recursion detection in fprobe_exit_handler > rehook, fprobe: do not trace rethook related functions hi, what tree is this based on? I have troubles to apply that thanks, jirka > > arch/riscv/kernel/probes/Makefile | 2 + > arch/s390/kernel/Makefile | 1 + > arch/x86/kernel/Makefile | 1 + > kernel/trace/fprobe.c | 72 ++++++++++++++++++++++++------- > kernel/trace/rethook.c | 4 +- > 5 files changed, 63 insertions(+), 17 deletions(-) > > -- > 2.40.1 >