Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp612391pxb; Wed, 27 Jan 2021 16:46:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTbovAw4fTbYFaBXMfVSkP14dUmh7yCv+ZBsgaUUd6FzjkxhaO3PnLwr8iD3lRfpvoSW4W X-Received: by 2002:a17:906:c410:: with SMTP id u16mr8482362ejz.159.1611794766401; Wed, 27 Jan 2021 16:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611794766; cv=none; d=google.com; s=arc-20160816; b=sGfmmhzhEopZsryuF1LlvwJo61KTR3v22T2kf/76MOVfyTUxm7L1NzDkBXNx0CZCtp t27bdD0OFjPrjBYb1Jlst/RURNzECdsoPkMwr5AplWzqOws2WQ/473JZ9y2T55qZheUQ Fy2NU0bZEXCCx+hK+KmEoXmErzpraPi+PozqrhlZs/PgA7DdALgPidnjK0wzow3o46eO 7KKf0if8ACqbDxy5jsycDfL4U6zI4KVRr7GqEo3b+gYuKeAXFO2tJ74XElnJd3EgD5CU JFexf2lAeqihvq8wXNDW7XoYEmWUK+niodr7loOxTVlyiaDP350YWTvUBcUVgW1sUzqW +RTA== 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; bh=HBxCTB6ji+7NY8gFoBPKqCGfZTGDjvdo12COuvn5Y14=; b=YoQgXpAwXg0Cn9YUtn+959QXYqHVNFjF95HFsMaFjcuHfzWEjphc/5QLT+ialKRviR FBhVOrTPaP7XiU+0DT1xQ6oS3TtqJJj3jVJfhJiqVsnlkj0hwEKlJbKZKT1uT84h51u4 uZsX9QGhgSPY8r+LvXJlUM+E1USzRjRKFrWdf+7YKfT+nxCQnN0LBzmugT5nA6ttvK3u XpDzR9wEXkL/03LHhXsp1onNPxx/+3D/QFG81BdiXV/kSSroJuzUyW9IAL4fk2jDBsTd 1mRg78Gzk8PoxYVijrPVh4GY7XvcybxxZUIo5xf81LUrif6A7IOgF8z5UT7JUKBqTVeF BBHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si1839064edn.568.2021.01.27.16.45.42; Wed, 27 Jan 2021 16:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234811AbhA0XMx (ORCPT + 99 others); Wed, 27 Jan 2021 18:12:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:40904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234488AbhA0XGS (ORCPT ); Wed, 27 Jan 2021 18:06:18 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56ABA64DD2; Wed, 27 Jan 2021 22:29:52 +0000 (UTC) Date: Wed, 27 Jan 2021 17:29:50 -0500 From: Steven Rostedt To: Masami Hiramatsu Cc: Jianlin Lv , Oleg Nesterov , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing/kprobe: Fix to support kretprobe events on unloaded modules Message-ID: <20210127172950.7911317a@gandalf.local.home> In-Reply-To: <161176187132.1067016.8118042342894378981.stgit@devnote2> References: <161176187132.1067016.8118042342894378981.stgit@devnote2> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 28 Jan 2021 00:37:51 +0900 Masami Hiramatsu wrote: > Fix kprobe_on_func_entry() returns error code instead of false so that > register_kretprobe() can return an appropriate error code. > > append_trace_kprobe() expects the kprobe registration returns -ENOENT > when the target symbol is not found, and it checks whether the target > module is unloaded or not. If the target module doesn't exist, it > defers to probe the target symbol until the module is loaded. > > However, since register_kretprobe() returns -EINVAL instead of -ENOENT > in that case, it always fail on putting the kretprobe event on unloaded > modules. e.g. > > Kprobe event: > /sys/kernel/debug/tracing # echo p xfs:xfs_end_io >> kprobe_events > [ 16.515574] trace_kprobe: This probe might be able to register after target module is loaded. Continue. > > Kretprobe event: (p -> r) > /sys/kernel/debug/tracing # echo r xfs:xfs_end_io >> kprobe_events > sh: write error: Invalid argument > /sys/kernel/debug/tracing # cat error_log > [ 41.122514] trace_kprobe: error: Failed to register probe event > Command: r xfs:xfs_end_io > ^ > > To fix this bug, change kprobe_on_func_entry() to detect symbol lookup > failure and return -ENOENT in that case. Otherwise it returns -EINVAL > or 0 (succeeded, given address is on the entry). > > Reported-by: Jianlin Lv > Signed-off-by: Masami Hiramatsu Is this something that should go to stable? And if so, can you supply a Fixes tag? Thanks Masami, -- Steve