Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp61317rwb; Thu, 12 Jan 2023 03:34:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQ5A5Dw5xV62Ns3ZDxthOVA/LAG3v7YHVsEmPLy5gGJkQAdXH80KXz1nIGQypC0oZ1xiJu X-Received: by 2002:aa7:cf09:0:b0:499:b5fc:e56f with SMTP id a9-20020aa7cf09000000b00499b5fce56fmr12088876edy.19.1673523288686; Thu, 12 Jan 2023 03:34:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673523288; cv=pass; d=google.com; s=arc-20160816; b=PxUhYYmrvdxxALu8iaPjkcR41kZ8NQBIwAnGDhJHw5QbR4P/K+sgwVRsITdu40vYgc yZBm/3oONAfS6K0QXsMMNUV3oNnT/QnCv8uwznJtnK7rmK7Rp+QbxCXv04P1ii1li6Ue WXU7mMhPYMlMzZmh9ThMBbUc+LeFoTCn6GUDEyHM8t55wCRgpJmlF3/7CalwFEmIZW+L LjdySo/fx9GzOHLpc/0H/apraZR5BhF8sTDNr4oBMtHTQR+jMBobRzlB0XQm1Klk/g41 KjUNI93p4BftBaJdkmMM5h9R04QfLlzhLNMq7rz8WxQ4y68ayu59iWH58SrAOe5c7WV1 9I+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature:dkim-signature; bh=eh3mq93AtXgPe/EmkZ2p9gcT4rFQEWlM5DDcjcJImZo=; b=N2xm+Nmdn1Gd3W3xrAeC3k52KMewFGLhbvN6hyJ21h2Z4igavp2y+o1nNxH52pgoym iDyrYQsgYV/ELurh2wpVDfy/TeDsAdRRdKP6kKW9/PPzeMF6BFb4jupEiAHga3JF1pu1 bGdqMJDzNd2hfq39q5As5WqLkMJsb8gtGGN4DDlkLPW74h01A4JOE5WkIN/lIDW3j2TT 5nASZZ4yAE80jZy11XvNoiKBG58tl+DFJaCxGNYHnMdiI5d9Y4xjsiDc8nO9wUAvrn5R b3wTf+mEEc6Ya7wuDBT5w7I6VDGtOOVTyXqNW5C/wDXJNraTz654cCCofnvYHveqpsDS t9DA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=1qcf7EeC; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qIB638tp; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a50998f000000b004825e4a6946si6367169edb.371.2023.01.12.03.34.36; Thu, 12 Jan 2023 03:34:48 -0800 (PST) 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=@oracle.com header.s=corp-2022-7-12 header.b=1qcf7EeC; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qIB638tp; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbjALK0l (ORCPT + 49 others); Thu, 12 Jan 2023 05:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233179AbjALKZv (ORCPT ); Thu, 12 Jan 2023 05:25:51 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C612E7F; Thu, 12 Jan 2023 02:20:56 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C9wlpE007835; Thu, 12 Jan 2023 10:20:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=eh3mq93AtXgPe/EmkZ2p9gcT4rFQEWlM5DDcjcJImZo=; b=1qcf7EeCy4nSlXqv33AR1rJOKomfiMIBCopMOMC/GKtGYprwWF4I1wV9T1XFvLYEt3aD QH8nDETlSysyc8wROOJa/HwlESuNl7kUcDUaqh6EA6plza7qlYr4/Blct9qbxEQmSR+n hfaniYrod5BEzju7aGTgIEAsyfhxM6BYrxsSs3jahSQXfbDhaUbOzExLRAXK+tWMGl9f pDYg2Ue94h9dI35YxDsykiK9VKIFx2NJtKkwu3fLu8eHPkGg5watw47hjekJwjSzJBEK vIdcW0kKyRAUX9UmPcrC660F+BRXoS+oKVBuxPAqSbsgGo4L0UaqMx1+w3hL2zeNQS7i CQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n1y1nj4wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 10:20:02 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30C9OeJ6005167; Thu, 12 Jan 2023 10:20:01 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n1k4ayy8m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 10:20:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGzB1cqz2E9+S8x5GRUFOiicH6W9oMSoY56xI2mdTcYvABTNtVC+0Y7fBqh1oR3QXNBiKTGSjn1OEUkWLn4iJv1/K2EDn+d3HvaYjOpSwbfnaSgPNHzjDa8bi44pM+GyWlKZrAuB7Pvolfem8kz1OCRBlT2pPKxgBHh79OI1G+PezkrK98WNVisln6cdrbrx34cqbbilXhbCwL+a0emOl13Omraaa9zicXkQGOsd8i/8X0w7K/9fqaCevFPFcTNAggub0l9w+CMXjOlwRMQUKx4t3PL9CzL9s4Wgvpqcu7aiI/i0gZ0757AK0Fwmgp4ppxqk98wsbQIwM+dYyj4pbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eh3mq93AtXgPe/EmkZ2p9gcT4rFQEWlM5DDcjcJImZo=; b=So166hVf2943Qsszjq0//xnaUv9dWajLvcSG1yrQCBOzdrn3EuIT0GdhucKvZo61nA7aXAP8Cq388nych7P0TVa51FMeN8tp5MQ7VsFWlrpdtycZeGmRPs5NlHskLbpljIub1Cr5hXyLZVXWbZTFE8A9aCiiQs7kAlMqzl+ZUE8GEAOlcs3h0nBccqTqHrVC/XtIQ+/FaxUjxfo/e7gebgwsKBV23Dnx+jgVZxubp7KlRHidgwVq99dBpLwWoI1GYoWRMz6WCucHSKjnj+k1UoSp1qn4zAMvFJF4o2eANFodMJZ6XYreBN/eaCSuT2f700hLeqmSJCQBvgmDHBVjdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eh3mq93AtXgPe/EmkZ2p9gcT4rFQEWlM5DDcjcJImZo=; b=qIB638tpu2GUCLF1DLpd3zx8sRmjfuTWn4QkgNDxooGaHsjeWw576brNPWeaYDhXzegnCjrJIrSbffYctfs6DVMRJl0UTCKS8VTwb6JNaBNe2ndI+tW422nO9AfHSxZOkzOdFrKVx+1GBFaSW7rVV3FZo7eNwSGj5/oZYmyoRRQ= Received: from BLAPR10MB5267.namprd10.prod.outlook.com (2603:10b6:208:30e::22) by DM4PR10MB6741.namprd10.prod.outlook.com (2603:10b6:8:10f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.11; Thu, 12 Jan 2023 10:19:59 +0000 Received: from BLAPR10MB5267.namprd10.prod.outlook.com ([fe80::d952:73ee:eb09:e05e]) by BLAPR10MB5267.namprd10.prod.outlook.com ([fe80::d952:73ee:eb09:e05e%6]) with mapi id 15.20.6002.013; Thu, 12 Jan 2023 10:19:58 +0000 Subject: Re: [PATCH] libbpf: resolve kernel function name optimization for kprobe To: Yonghong Song , Menglong Dong Cc: daniel@iogearbox.net, ast@kernel.org, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Menglong Dong References: <20230109094247.1464856-1-imagedong@tencent.com> <504cc35a-74a8-751a-5899-186d7a0aff87@meta.com> <6c14e7ad-3b6d-4f88-64b8-8e3968d2b2e6@meta.com> From: Alan Maguire Message-ID: <6455133c-87a2-1a0f-7da4-f8b99f02fc95@oracle.com> Date: Thu, 12 Jan 2023 10:19:54 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 In-Reply-To: <6c14e7ad-3b6d-4f88-64b8-8e3968d2b2e6@meta.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DUZPR01CA0080.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::9) To BLAPR10MB5267.namprd10.prod.outlook.com (2603:10b6:208:30e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLAPR10MB5267:EE_|DM4PR10MB6741:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f99574c-bcc5-476b-437d-08daf4868eea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +hJBlclj+HmDzkv2a4Co6/n2qcfWQAUJNShxDqDZjjZFTapWHQUrm7dSMYL5XHpvxPX3T7QQgXlVLYE35xeME7RXnnVG09p/3pETafx2rUY54gDn+gXuMot/amP/7cPv8gskqirqGp6786QRp3wAyiq+Ce+om2CYITvts9l4sTdEXlPAjM0x4qia5LuX/Op3yWkZaqpwHKf4v5kTAWW7culCOgGwAi73m71IwN8Ex55b7VQdRGQO4uxwbn1OoEkxEUvG4hDaJtdOWJx1T3z1A8iuih4i7EbdOG3SC62I0x6EqugXME0WZVdDaJc4MLv0QHtFGK8ptfwSzP8NYngL3fJ43APWTDVNDwq243iN/cnswsVXbT6nf4ku68GZLi06qAzZgxGIuIOAZy7VJF8mhTAjoTGX9PU1w88E9nEwocdhZQHEbEljZU2w8N5RJj88FF8347CneaToEbapZ0j9IDqvGeW48vxJQ0A+SUa1GAret1CqFcm4Os+nVnXXYvcNKCAcumsUCl/w5JsCh/u6MMSJGO4eNpSF9mPJt1YCqWRgKLHojofANQUt2c/ppvhrMJiau9GD0kQauIPzDDcVojMRc7e1lAXRSiXnRAcBkaAiZ+m67RP57DGm0T27MHViQYQlSgXjMxIA1Q7iqYHU4WhDVNPFuO2bd9LUipc5EReyMis1N1W/FRqIrXwxss6FPxGT7xjQ2GEygDBy+SrLJk545kiqKPwctF3RHyEL+jQ/3hgecez+I0qqbaUQjVfaR7eanOUCdeTd5hU4JxD+Vco5qD+Mrgp0B+8fPYKi1eI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB5267.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(366004)(396003)(39860400002)(136003)(451199015)(36756003)(110136005)(38100700002)(316002)(86362001)(2616005)(31696002)(478600001)(83380400001)(6486002)(966005)(6512007)(53546011)(6666004)(186003)(6506007)(66899015)(8936002)(7416002)(5660300002)(2906002)(31686004)(44832011)(41300700001)(4326008)(66476007)(8676002)(66556008)(66946007)(21314003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ejA3ZUkxZzFqSFhqVVVxa2ZySGFVNldBNWFSVHJmSkYxVGxPOWRpaWZ1Mldo?= =?utf-8?B?b3Z6ZzlYSHZENjNyd21ySi9oN3A5VTk4TzNSb1JzajZ2TW1wTzU2K1c5b1Vq?= =?utf-8?B?WmlQcmdEN2x4ajljMUVFNWZCWFdrK2JHOG5iaWJIO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-bcc5-476b-437d-08daf4868eea X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5267.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2023 10:19:58.8421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XIVBf3UWILstG+UcBoSST4UShh3uzn3Amw/gqztSrds6P0mlmCVAZ9Vt/pFqQDkhifunNgKHJt79XH1dpVD4rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6741 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_06,2023-01-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301120072 X-Proofpoint-GUID: tzN7c9lh5yDKHVJyizc41bQmq02S7Pn9 X-Proofpoint-ORIG-GUID: tzN7c9lh5yDKHVJyizc41bQmq02S7Pn9 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 On 12/01/2023 07:23, Yonghong Song wrote: > > > On 1/9/23 7:11 PM, Menglong Dong wrote: >> On Tue, Jan 10, 2023 at 4:29 AM Yonghong Song wrote: >>> >>> >>> >>> On 1/9/23 1:42 AM, menglong8.dong@gmail.com wrote: >>>> From: Menglong Dong >>>> >>>> The function name in kernel may be changed by the compiler. For example, >>>> the function 'ip_rcv_core' can be compiled to 'ip_rcv_core.isra.0'. >>>> >>>> This kind optimization can happen in any kernel function. Therefor, we >>>> should conside this case. >>>> >>>> If we failed to attach kprobe with a '-ENOENT', then we can lookup the >>>> kallsyms and check if there is a similar function end with '.xxx', and >>>> retry. >>> >>> This might produce incorrect result, so this approach won't work >>> for all .isra.0 cases. When a function name is changed from >>> to .isra., it is possible that compiler may have >>> make some changes to the arguments, e.g., removing one argument, >>> chaning a semantics of argument, etc. if bpf program still >>> uses the original function signature, the bpf program may >>> produce unexpected result. >> >> Oops, I wasn't aware of this part. Can we make this function disabled >> by default and offer an option to users to enable it? Such as: >> >>      bpf_object_adapt_sym(struct bpf_object *obj) >> >> In my case, kernel function rename is common, and I have to >> check all functions and do such adaptation before attaching >> my kprobe programs, which makes me can't use auto-attach. >> >> What's more, I haven't seen the arguments change so far, and >> maybe it's not a common case? > > I don't have statistics, but it happens. In general, if you > want to attach to a function like , but it has a variant > .isra., you probably should check assembly code > to ensure the parameter semantics not changed, and then > you can attach to kprobe function .isra., which > I assume current libbpf infrastructure should support it. > After you investigate all these .isra. functions > and confirm their argument semantics won't change, you > could use kprobe multi to do attachment. > I crunched some numbers on this, and discovered out of ~1600 .isra/.constprop functions, 76 had a missing argument. The patch series at [1] is a rough attempt to get pahole to spot these, and add BTF entries for each, where the BTF representation reflects reality by skipping optimized-out arguments. So for a function like static int ip6_nh_lookup_table(struct net *net, struct fib6_config *cfg, const struct in6_addr *gw_addr, u32 tbid, int flags, struct fib6_result *res); Examining the BTF representation using pahole from [1], we see int ip6_nh_lookup_table.isra.0(struct net *net, struct fib6_config *cfg, struct in6_addr *gw_addr, u32 tbid, int flags); Comparing to the definition, we see the last parameter is missing, i.e. the "struct fib6_result *" argument is missing. The calling pattern - where the callers have a struct fib6_result on the stack and pass a pointer - is reflected in late DWARF info which shows the argument is not actually passed as a register, but can be expressed as an offset relative to the current function stack (DW_OP_fbreg). This approach howvever introduces the problem that currently the kernel doesn't allow a "." in a function name. We can fix that, but any BTF encoding that introduced optimized functions containing a "." would have to be opt-in via a pahole option, so we do not generate invalid vmlinux BTF for kernels without that change. An alternative approach would be to simply encode .isra functions in BTF without the .isra suffix (i.e. using "function_name" not "function_name.isra"), only doing the BTF encoding if no arguments were optimized out - i.e. if the function signature matches expectations. The 76 functions with optimized-out parameters could simply be skipped. To me that feels like the simpler approach - it avoids issues with function name BTF encoding, and with that sort of model a loose-matching kallsyms approach - like that described here - could be used for kprobes and fentry/fexit. It also fits with the DWARF representation - the .isra suffixes are not present in DWARF representations of the function, only in the symbol table and kallsyms, so perhaps BTF should follow suit and not add the suffixes. What do you think? Alan [1] https://github.com/acmel/dwarves/compare/master...alan-maguire:dwarves:optimized >> >> (Please just ignore this reply if it doesn't work :/ ) >> >> Thanks! >> Menglong Dong >>> >>>> >>>> Signed-off-by: Menglong Dong >>>> --- >>>>    tools/lib/bpf/libbpf.c | 37 ++++++++++++++++++++++++++++++++++++- >>>>    1 file changed, 36 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >>>> index a5c67a3c93c5..fdfb1ca34ced 100644 >>>> --- a/tools/lib/bpf/libbpf.c >>>> +++ b/tools/lib/bpf/libbpf.c >>>> @@ -10375,12 +10375,30 @@ bpf_program__attach_kprobe_multi_opts(const struct bpf_program *prog, >>>>        return libbpf_err_ptr(err); >>>>    } >>>> >>>> +struct kprobe_resolve { >>>> +     char pattern[128]; >>>> +     char name[128]; >>>> +}; >>>> + >>>> +static int kprobe_kallsyms_cb(unsigned long long sym_addr, char sym_type, >>>> +                           const char *sym_name, void *ctx) >>>> +{ >>>> +     struct kprobe_resolve *res = ctx; >>>> + >>>> +     if (!glob_match(sym_name, res->pattern)) >>>> +             return 0; >>>> +     strcpy(res->name, sym_name); >>>> +     return 1; >>>> +} >>>> + >>>>    static int attach_kprobe(const struct bpf_program *prog, long cookie, struct bpf_link **link) >>>>    { >>>>        DECLARE_LIBBPF_OPTS(bpf_kprobe_opts, opts); >>>> +     struct kprobe_resolve res = {}; >>>>        unsigned long offset = 0; >>>>        const char *func_name; >>>>        char *func; >>>> +     int err; >>>>        int n; >>>> >>>>        *link = NULL; >>>> @@ -10408,8 +10426,25 @@ static int attach_kprobe(const struct bpf_program *prog, long cookie, struct bpf >>>> >>>>        opts.offset = offset; >>>>        *link = bpf_program__attach_kprobe_opts(prog, func, &opts); >>>> +     err = libbpf_get_error(*link); >>>> + >>>> +     if (!err || err != -ENOENT) >>>> +             goto out; >>>> + >>>> +     sprintf(res.pattern, "%s.*", func); >>>> +     if (!libbpf_kallsyms_parse(kprobe_kallsyms_cb, &res)) >>>> +             goto out; >>>> + >>>> +     pr_warn("prog '%s': trying to create %s '%s+0x%zx' perf event instead\n", >>>> +             prog->name, opts.retprobe ? "kretprobe" : "kprobe", >>>> +             res.name, offset); >>>> + >>>> +     *link = bpf_program__attach_kprobe_opts(prog, res.name, &opts); >>>> +     err = libbpf_get_error(*link); >>>> + >>>> +out: >>>>        free(func); >>>> -     return libbpf_get_error(*link); >>>> +     return err; >>>>    } >>>> >>>>    static int attach_ksyscall(const struct bpf_program *prog, long cookie, struct bpf_link **link)