Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4283586pxb; Mon, 25 Oct 2021 00:54:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA8DbfdwVldVwuCiXSnEzsvYNLiCucAYUDZu7w0IGnsDVLFvy4hN300wspl622pCLyk9FZ X-Received: by 2002:a17:906:c102:: with SMTP id do2mr10187157ejc.111.1635148452583; Mon, 25 Oct 2021 00:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635148452; cv=none; d=google.com; s=arc-20160816; b=T0VJ1T3BxPQCYEfA9Cu2047fdK+PYZ7h7QHvcqBqFu5hevlz/M6AoOZU0LlUJQMcYN 7nFLc8rcy3TAYl0trgxYmsXgiyCfgWKjYTASEyGZO7Edh43AEDUoVevHylDo4SE6AU8J hDjJs+7YzZ4OvuScLR4LDudMe6dg/qgyJ9duoFKmM5B2WaJNk23Hha0eaVEeQyRGTtri KK+iaMMBLj7nBu9R7FDuAYtPn9cj61XSgEEltHkPvR+uaYpMfF/pyKsApTvEjgJLO1eH Keb/6uLf/ajNYKk+NY9g2ZWK1DIBKNRKdZdK/ZQkVOSdFUgRV0z0oLmO8IlLWxzoQwq4 kV0A== 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 :dkim-signature; bh=3Dwruy4xURD+OdfqJcZ0OWCjrw/vDAbgRbb1jfwubH8=; b=CH/vN/LVKaiEVzJBHA0U4gIS0qSWOCkr6GEkjM/jlpdlOccX7PbRTtjL+OzjiOQff1 v0q21StUxB/NVHId5GGSjqH81vta8KWrzNgYrQ/kvhvjZ2OJLR3PzqsaRbaNYw9RWGae HSp1etxDeOFRwFWRVv4FJ7XhP68WJUi3VQ62Xqzsjr2Qyq+/FOxPwsiLBbqMOieGvqT1 vUfq2JCHjoDAR5xrlQjnhvba/yMAecu3RGKt11T1prD3uxsl1yYMH3+mZAaGmZvaksNC PHakcpJgNF33Wf/RA9hzdfjxioFRFAbtooDfe2uX46f3pHq0RkTSAHQTQp2OY3pY4YLr hKKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4t8tGCG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si17838636eda.402.2021.10.25.00.53.47; Mon, 25 Oct 2021 00:54:12 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4t8tGCG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbhJYGRm (ORCPT + 99 others); Mon, 25 Oct 2021 02:17:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbhJYGRm (ORCPT ); Mon, 25 Oct 2021 02:17:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF11660F02; Mon, 25 Oct 2021 06:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635142520; bh=qyOhpd50WpRpY/Lo5509L0KMMjOyAIQWbMcSHHc+igQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=e4t8tGCGTJ7UJisB6RNO3CRmsan5gSsSJeLeN1+T4zvabWObcBaJLAcoPEtvkrVWV s8qUaXRpZ27CjWUl+eI/d+adjpIXj7cNwqsx/RLEyUDB2fPELSM22Opt20KX2qkJHI W8CpdOlQ0eGwRUtQFdoYFeZVwCSR2I/P7+1GGWMyuH0m4CLjYSBprqURpBoE8FWr6h atdp+n7LTeCWhNR0tS7jaRzN0z4xqaaQdTOMUtYCj2aAi43GkpCrXuVmvzPNO4VAN5 WagR70vKIYoY1I7+XdmCiQfpXhMHY6hcKjoyOa7wF2O2Ui47M8KTiOxZ2RfXylZl3u uaNBzoMQw70CA== Date: Mon, 25 Oct 2021 15:15:17 +0900 From: Masami Hiramatsu To: Tiezhu Yang Cc: naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, corbet@lwn.net, ananth@in.ibm.com, akpm@linux-foundation.org, randy.dunlap@oracle.com, mathieu.desnoyers@polymtl.ca, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed Message-Id: <20211025151517.f295f7804993e55997f0258f@kernel.org> In-Reply-To: <1635132660-5038-2-git-send-email-yangtiezhu@loongson.cn> References: <1635132660-5038-1-git-send-email-yangtiezhu@loongson.cn> <1635132660-5038-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; 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 Mon, 25 Oct 2021 11:30:57 +0800 Tiezhu Yang wrote: > Use the actual return value instead of always -1 if register_kretprobe() > failed. > > E.g. without this patch: > > # insmod samples/kprobes/kretprobe_example.ko func=no_such_func > insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted > > With this patch: > > # insmod samples/kprobes/kretprobe_example.ko func=no_such_func > insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module > > Fixes: 804defea1c02 ("Kprobes: move kprobe examples to samples/") > Signed-off-by: Tiezhu Yang This looks good to me. Acked-by: Masami Hiramatsu Thanks! > --- > samples/kprobes/kretprobe_example.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c > index 5dc1bf3..228321e 100644 > --- a/samples/kprobes/kretprobe_example.c > +++ b/samples/kprobes/kretprobe_example.c > @@ -86,7 +86,7 @@ static int __init kretprobe_init(void) > ret = register_kretprobe(&my_kretprobe); > if (ret < 0) { > pr_err("register_kretprobe failed, returned %d\n", ret); > - return -1; > + return ret; > } > pr_info("Planted return probe at %s: %p\n", > my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr); > -- > 2.1.0 > -- Masami Hiramatsu