Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1604931rwd; Tue, 16 May 2023 21:23:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66LCWBdyPEQfmac29snpF1OGxet4osLfqtC/kF/6zigW0QjiJ9Pvsue7PPHCX8X8u07rmC X-Received: by 2002:a05:6a21:3284:b0:100:9a80:2e90 with SMTP id yt4-20020a056a21328400b001009a802e90mr43345786pzb.59.1684297426930; Tue, 16 May 2023 21:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684297426; cv=none; d=google.com; s=arc-20160816; b=mUjzRpnd48oSxkllhMm7kxi2LZtkeKAoLFTn6NYZe/2lJAs/BUfSTR9MNKo95wKkeg 1gN4uBGF0jRrfriE6xAoOoJoQO9YIE+agY2l0Q9EovrE8J5Fop5m9+MCWOP2njeNIRvh dpOcGmXTRlOTANwKm3WVdxo6s4n7uBux/RWS7OvDmV31T1LRMW3EkWOwF4C+9B6D/14f GmnAmUWOYK6AEl3YsVgUf+8ZMmqLBGmj9Ag879TB6M+fqn8frw2e1YYWCH56+NexdQmd 1UZohjs6EvCLaq3pLW9br1CZ5DYfPDYZIjB0WEw5eN4jdGePo0kNfNtKYVDleA2a1YAh cWaw== 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=n0fdPmeINo3M3GEcsjn+DqgIArQ+TF8t88l9Aksr7VQ=; b=YRM302VHaHp39PWAIJpmrdSZ2hJv/dvXv2htZ4QeL8lI7uqzdj2cahlxJ/8sLdZ0Z2 Hnmhj7qeZDV9BE02tgOeERPDtbwXgG+3ia6WePqxXH1TQk6PwKMi6jhsb3He10kZ4jjB eccxI8Jn5DkN2CfNP9pd/0xn/Qzhfvy80fzlHjcWQo0Wy5V7HSsvyDFM4mAa1oQCbdRz T+CHfvxXAC72PGmsnDBPc4ZGWuRZnrLMXJb1dMlzY0OqLDIGUOP8Q+hJhJ4A/v4cdv/M 7foKX3PBH9XGXJ6+9jml6AZEB5o3D3N9CPYXPwZ3YCbxGu6ptzxtGW0+wZwREAebd8hs HisA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Dy5EDllK; 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 bs3-20020a632803000000b0052ca7192675si19684774pgb.729.2023.05.16.21.23.34; Tue, 16 May 2023 21:23:46 -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=Dy5EDllK; 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 S232528AbjEQDpY (ORCPT + 99 others); Tue, 16 May 2023 23:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232123AbjEQDpV (ORCPT ); Tue, 16 May 2023 23:45:21 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7750730E8; Tue, 16 May 2023 20:45:20 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-53202149ae2so134187a12.3; Tue, 16 May 2023 20:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684295120; x=1686887120; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n0fdPmeINo3M3GEcsjn+DqgIArQ+TF8t88l9Aksr7VQ=; b=Dy5EDllK8uVJFjPdvz1RUbi2yk4rgd1PjqZJX+ibJORvvteuhARUVlChiDWi2GdYyj ornOQnlZWAccsQTsX9fLi2XGvQ4x2OgrV6l+T2ZMZvd75JIePFW+SoFmsNoYqlf4tmj6 mu8MFImYX/tmrIswvc9vSL7jdvTVtA3XMoOw2H5DMKVzaHKqWcXvCHVJhmLlIYe3M0zg DYvxBvbgYH6iW3+axk10pT1phM6PW493USZleI0YoHLDNsChz3x3uojs4ai7zGPrwo1S IyPBHmYqqM0fciz6V34Z9NRne8SpZebj4C4tOarrPY2uQ/ucSWcFEYkSxS9uD+fy6URe cVdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684295120; x=1686887120; 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=n0fdPmeINo3M3GEcsjn+DqgIArQ+TF8t88l9Aksr7VQ=; b=l0ksyFCRoVbMcBPmlWi6PK9EeCg7RZBTX08SVqJn2wRD7oqD0FqHMRv+13bREZ6NJO 8KI7e2gbgWLm02wYBaMd389o/UcMDzSci6yEdk0M9BFnWNMEydtVdWWoR3EgFo92bZNC /gtZtydupaC0Vk/2oLLAd/yWgv0l19zC+4xWwR0DWQcDmknLPzNU/B3UMTAh1xgalzYa ri9b7rjawpMozv/CEIa/mewKQ2fC4CtwyroQ1bSMu0p2fbe+wTpsPLY3PAi0pAuGWCea BIHEQqdZ+LbabjQFDhsEm4dmkrCE6N5eA3MjEYp/dvPWNi4nPOPyVLTCcH/WV4XmAA70 EEFg== X-Gm-Message-State: AC+VfDxvMh/x76YgZmG+c7gIxnNWJP8uuR6L2adgGKyMMz7p99FkhQrw vLExXrQc46eykkQMW9Rg6z8= X-Received: by 2002:a17:903:110f:b0:1a2:8c7e:f310 with SMTP id n15-20020a170903110f00b001a28c7ef310mr48043595plh.35.1684295119892; Tue, 16 May 2023 20:45:19 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.83]) by smtp.googlemail.com with ESMTPSA id t2-20020a170902e84200b001a19196af48sm16336746plg.64.2023.05.16.20.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 20:45:19 -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, 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 Subject: [PATCH v3 0/3] Make fprobe + rethook immune to recursion Date: Wed, 17 May 2023 11:45:05 +0800 Message-Id: <20230517034510.15639-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 3rd version of patch series that fix the ftrace rethook recursion problem. Changes since v2: - refine commit message of [PATCH v2 2/4] fprobe: make fprobe_kprobe_handler recursion free v1: https://lore.kernel.org/linux-trace-kernel/cover.1684120990.git.zegao@tencent.com/T/ v2: https://lore.kernel.org/linux-trace-kernel/ZGP4ypidaxQGdp7Y@krava/T/#mb9e74fe74d5800ee424234b26c6def9d5135237b The original discussions of this bug can be checked out here: https://lore.kernel.org/bpf/CAD8CoPCfPmqZH6BJCk3Y1-02BLVVsbQ6OeaNOhcfGWmdF0oX8A@mail.gmail.com/T/#t 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 rethook, 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 | 73 ++++++++++++++++++++++++------- kernel/trace/rethook.c | 4 +- 5 files changed, 64 insertions(+), 17 deletions(-) -- 2.40.1