Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3523976pxp; Tue, 8 Mar 2022 16:35:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzy8BChKrIM8BQqj1qYhqgi9wad8Nne9hw5G+e1AhuGAjPrQ2LVvCRJiSdr7M7LUO07BtA X-Received: by 2002:a65:4c47:0:b0:37d:5eea:232d with SMTP id l7-20020a654c47000000b0037d5eea232dmr16600883pgr.536.1646786141596; Tue, 08 Mar 2022 16:35:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646786141; cv=none; d=google.com; s=arc-20160816; b=On1KKXm86KjMjQpztWZQd8BXHl6VTtIRfOi8p0QLOleprtlml8cQT8ZJAbpvJUXdrM iJ4bG8K14+tmuvHPX2EC+yViH+8AZn49VDpZzO6N3UCqgo9yJG4fmiMefi90I5M+FsJ8 ESQZEgDw16Q6TXx3Ri2vDF7p0crdAJfE4E0+jUsdtMO3IbrH+SP349XvsTmEikIhCKA5 SVihUc4jOiq8vbHrxVRUgbD4ydJ6S3o6ISVViK9W7v7kd80ql7Gdb9+zT+h//fMAPVmw T+iKKc/DsJ2pH+ntcEPSYDltHpI85X1txF7qI/tkOjDiQSW8SUcnvijBUIL/aPppqE4V GtYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eiuLq9YhRrYN0FpJ7mTqNGyJkUH/vrr7SSWu39B1rkk=; b=M/736qR9EyGpb9GOT2CvosNzaOuo/SSrK2o95FITzoCJ6og918pT/oOsxDzeE8ZOlj Mzol8tNu9vz5FbpClB1ki907y537JnpOfQDNEzob6/at3UQ3qoI1+KkPTNE4WVWnUb+z O938A32349+6N2gAbP7pcWLF20H4bCJMVxWm4tTaBZWwvIG+3XDOsCJzG+NRdmGBIj8+ nPtvweLEpV+mMj1zxwy3j1KpaXSpaplThsBPv16sBe33QzYDYLSlP9BEdAyvG+GYIEEX FimBGSLNgqRwHjGCnN7Lfx2ewzleiY2yxvl1MfqDG/Ui3Lx2mWJJoAFljrshmkqfFSQl ePiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DHPRtv8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w22-20020a656956000000b0037874781f29si360444pgq.332.2022.03.08.16.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 16:35:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DHPRtv8b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BCFB9118626; Tue, 8 Mar 2022 15:53:00 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237175AbiCHOWq (ORCPT + 99 others); Tue, 8 Mar 2022 09:22:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbiCHOWo (ORCPT ); Tue, 8 Mar 2022 09:22:44 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 241594B413; Tue, 8 Mar 2022 06:21:48 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id bi12so26484836ejb.3; Tue, 08 Mar 2022 06:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eiuLq9YhRrYN0FpJ7mTqNGyJkUH/vrr7SSWu39B1rkk=; b=DHPRtv8bf5XL0wSnjyq/223qiCx2+c0HD4LGpwpDw8yQYqAcbEFl1AUh9EDG4oUVX0 FdBkiFBEyU++sUleXZPCAYnocTqhZkx+rT/2jCAnEMIBw7NgQ0lYxsleIODTOzOFTNM7 0o8r10K0yVy9pMJUPI6F2/BUoEJN4kW9G4WEBF3ST1J/+lG0TinTXDXjR5xSwrZ4uhFr rf/c2M8oA2VAlued+b28tvqO+FQGY60kB5ZgbBfLTWeWkt4Wju39LlabLBVubH3TFuzl EI/wyZ840EeWv9ALhewWyGBOm1lvNZYehQ4u5EwN+UL0r/quBRRqapDUOwxSMn+ej00T FalA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eiuLq9YhRrYN0FpJ7mTqNGyJkUH/vrr7SSWu39B1rkk=; b=lYP+eM3i9GQGgyRlZa5w+Kd1r3dCCmumy+OuAA+Tftuv4ohcKijWXsOPvhmG1hoGlU CRcZXBrQ7sECLvv3DGeSqh3kUOYU4KhGmuy1v4EYX15IUIK32GDQEbb0MNhBl73UTEao OGEgK5N/5R5GD6jAwXD2bMWt0iqUzeLVBOy5U2u24Bqg5QXPiNKgG3utba86B+/QYpAe 4XNzF23waSGiLhpx71WTJWqjd0CaK/+dEPK8dk980Bvwv/9rFad8IxWRhInHB54RcxqK xFzOq3OPTYtWoo762VyTHyFOwF/ygEYcBQ6O2H0yjcND5fpO9UXgUBJv+ZeBP82ByCzz tJgg== X-Gm-Message-State: AOAM530vc5bWgW2TcjCH3GlihIq0GCXQELr0FGEmyBo0W2sETZ2k0LOZ wgbtIkaOQDhGFkCEZu6dlLU= X-Received: by 2002:a17:907:7b9e:b0:6db:2b7f:3024 with SMTP id ne30-20020a1709077b9e00b006db2b7f3024mr8522631ejc.29.1646749306525; Tue, 08 Mar 2022 06:21:46 -0800 (PST) Received: from krava ([193.85.244.190]) by smtp.gmail.com with ESMTPSA id m10-20020a056402510a00b00415eee901c0sm7018115edd.61.2022.03.08.06.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 06:21:46 -0800 (PST) Date: Tue, 8 Mar 2022 15:21:43 +0100 From: Jiri Olsa To: Andrii Nakryiko Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Networking , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt Subject: Re: [PATCH 02/10] bpf: Add multi kprobe link Message-ID: References: <20220222170600.611515-1-jolsa@kernel.org> <20220222170600.611515-3-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Mar 07, 2022 at 05:23:34PM -0800, Andrii Nakryiko wrote: > On Sun, Mar 6, 2022 at 9:28 AM Jiri Olsa wrote: > > > > On Fri, Mar 04, 2022 at 03:11:01PM -0800, Andrii Nakryiko wrote: > > > > SNIP > > > > > > +static int > > > > +kprobe_multi_resolve_syms(const void *usyms, u32 cnt, > > > > + unsigned long *addrs) > > > > +{ > > > > + unsigned long addr, size; > > > > + const char **syms; > > > > + int err = -ENOMEM; > > > > + unsigned int i; > > > > + char *func; > > > > + > > > > + size = cnt * sizeof(*syms); > > > > + syms = kvzalloc(size, GFP_KERNEL); > > > > + if (!syms) > > > > + return -ENOMEM; > > > > + > > > > + func = kmalloc(KSYM_NAME_LEN, GFP_KERNEL); > > > > + if (!func) > > > > + goto error; > > > > + > > > > + if (copy_from_user(syms, usyms, size)) { > > > > + err = -EFAULT; > > > > + goto error; > > > > + } > > > > + > > > > + for (i = 0; i < cnt; i++) { > > > > + err = strncpy_from_user(func, syms[i], KSYM_NAME_LEN); > > > > + if (err == KSYM_NAME_LEN) > > > > + err = -E2BIG; > > > > + if (err < 0) > > > > + goto error; > > > > + > > > > + err = -EINVAL; > > > > + if (func[0] == '\0') > > > > + goto error; > > > > > > wouldn't empty string be handled by kallsyms_lookup_name? > > > > it would scan and compare all symbols with empty string, > > so it's better to test for it > > I don't mind, but it seems like kallsyms_lookup_name() should be made > smarter than that instead, no? true, I'll do that jirka