Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp297671rwd; Tue, 16 May 2023 00:54:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TbtD/DuHH1TEPtp0VSQmPkZNFwm4MpYknTJbtFVKscJt90O+WycY+rqC3NFQQN+PiFn3M X-Received: by 2002:a05:6a20:12cd:b0:106:70af:a5b9 with SMTP id v13-20020a056a2012cd00b0010670afa5b9mr5664969pzg.31.1684223642410; Tue, 16 May 2023 00:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684223642; cv=none; d=google.com; s=arc-20160816; b=K9YK33cE+X516VebgXSs/yXIR9pZKmkjYSCyeNUGOkjZJrN632likcLUQLcSNIRLfP SsP3F4jzKylzIqnKgtiRae1iVjBTGdZ2+PxXSVYcNp+KHcx+PG4rP24K7lUYkDjuSCB1 s/oETNvR739yQrgJWD8R1FVNNkdiAnpJufjXs+OPfdhpQjjC9N17z/7Q2SRs/6Bbr6Ub OMq/MzzNNISs1wqaH0YMF4isUOjyVTL2ynjXgQ7ErfFYiBJEdKXDFMmTIyUJDOihSiya QdAu1ieglGfiqT4JRpP4nwT5wU5BVtxH3nvkz3E9ViJdgmMSToxAvrFeUMMLG5or8h0j L43g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a637543000000b0051372ec9316si16603358pgn.166.2023.05.16.00.53.50; Tue, 16 May 2023 00:54:02 -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 S231223AbjEPHSu (ORCPT + 99 others); Tue, 16 May 2023 03:18:50 -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 ); 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 X-Google-Original-From: Ze Gao To: Steven Rostedt , Masami Hiramatsu Cc: 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, 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 , Jiri Olsa , Yonghong Song , Ze Gao 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: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.40.1