Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2033241iof; Tue, 7 Jun 2022 17:37:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKbIlRUWinvJcxtzapbTdERbD76UGWrGuwUQdaBXirdE0RL1ipnzixkg3H3GVNv/cptb4w X-Received: by 2002:a17:902:7582:b0:162:1131:23c2 with SMTP id j2-20020a170902758200b00162113123c2mr31786731pll.83.1654648657079; Tue, 07 Jun 2022 17:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654648657; cv=none; d=google.com; s=arc-20160816; b=szrmurCM/WSvnpeoayGJoTqNT+lhptBqrDRDlqhYJsQ7+wSUplFuvqYFvfc0KM/ChE 1PGCRRTPoTsRdaQkecMIr+Qh9pYIpSx13ullkOhSLCRaS44ojnaHDpOtyVIOhZkg0vU4 wybGjS7pzQnqIK1QM8Mbblf6tRTlTa+EmOYHCcWsBOOzc6GDFg3p7vYIOP33Knc7IGAR ydIguuUfeGo9tHx7MVlqGynuATyn/h+FP1SdocXnXc4okL8OfV0uvANlNs7VIDFekcHJ ufByRAYku5jKzQ/iNjSIxJpwUYktzDu75ck2EkY+vEzKaAYYzdJyOtysNlsZkk9fWnWf qbOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GXW2rL4NXVvRk2JDX2m18WOLhnXkn5o6+TY+7wVjtRE=; b=RJbLplAjB4pleXrOQq35cA3zhaNrQiaH3/duo7f5JTxLN8LWov8pYZtX/ec6Uju/A4 +vPYPi2tXLDfIMuLCUs7l9AyLHM6fk97lj+0CeA+h7HytG6SiO8n8VT9hQeOMljq3/LY 03PWc7sIqnOR8cK9Ev43aefd7IBFhfoDeuWvNutckVPV6iRdKys7/nxOWQTlWQK/OkJI I4IxB8K2olDLnHKcMMLL73NbExAxNfO/b/f1n4rcM92x50nlIiGqKFIOQyH9NsiRkcwn MNBa6/A1PE1fwJ7EQuhwgxV7Fkkx+A6oRontC+IYTsfvS2b7uwhzlPr/gyU3dWc5AY7U urrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N1Vd8aWm; 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 b13-20020a170902d88d00b00163f35b2aafsi24516701plz.508.2022.06.07.17.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 17:37:37 -0700 (PDT) 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=N1Vd8aWm; 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 060B51E44F1; Tue, 7 Jun 2022 17:27:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381582AbiFGVsN (ORCPT + 99 others); Tue, 7 Jun 2022 17:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377955AbiFGUvO (ORCPT ); Tue, 7 Jun 2022 16:51:14 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C3AC1FDE91; Tue, 7 Jun 2022 11:41:01 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id b8so7451054edj.11; Tue, 07 Jun 2022 11:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GXW2rL4NXVvRk2JDX2m18WOLhnXkn5o6+TY+7wVjtRE=; b=N1Vd8aWmM1ySk0mcW8trc9dPBtxtE5CftSphFS3k/DOJ5xs8NntlPTLMsbV9eB2G3s jDH1jzVIBP9rhvsgxrEvleACfClys8746/KX2ydKGjWjNHjtdF8iixR/BIXxGhEXscDZ RfZNydJIpQ6qHFpL/g/sKhupfs1rhEQJoqsECwgXUs7pH8Ks1HCpYqUr4YdgFnxEWJAn skSU7VYd+Vf+n/AxTsPxO5cAJ4zEvaE71/vFjeQe9cCDcYGJbKG9KV4hF4756Z9ZRtH1 2t/SWs7guc+T8E6dUW+5Y2uy/A0DHimYVsTI3N9Wp1mAiFcX/S8c30nwBig5jyoQdwfi sLbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GXW2rL4NXVvRk2JDX2m18WOLhnXkn5o6+TY+7wVjtRE=; b=GqUjQ1vyi6Xs6EpgmHIPe8z6BbgBYzkpkT+gibD1HhwXC1VOuSKAd99PfOYTZwxgIK P4og1CSLQbpbB57KiQKMgUsvCnKkxy5yasyzZ1Nwr1uWJCY8+4XOppXudmxJfHT7nrOz Em3sUbAGM7rEbiPmccrQ1cmRTlXE1xf+eIxts8pvnIZBg6Gcxe7+qYJTFAKQwk+b3OXb k3kbpMyLOxl7ZoXN4163bP/OJovIshbMaIhSRR25aGYJRJhFqxgpzJTw6hdx5HVdeNhF gilUHmXVHBgG3n4Q3CehKWzOZubrXU3nEb0ZfO9BC3IL48NrA69nEt2jaKjavlC2Xrpc B9tA== X-Gm-Message-State: AOAM530Fmi9VClKsNQLBYwrivZ1KcDy1VXeeksb6RrBVTNtyNGG3UtcL 3cAdox2t9NMynTPH6MPHCJSB4b3hZgIGX1+JBME= X-Received: by 2002:a05:6402:120b:b0:42f:aa44:4d85 with SMTP id c11-20020a056402120b00b0042faa444d85mr25727948edw.338.1654627259569; Tue, 07 Jun 2022 11:40:59 -0700 (PDT) MIME-Version: 1.0 References: <20220606184731.437300-1-jolsa@kernel.org> <20220606184731.437300-4-jolsa@kernel.org> In-Reply-To: <20220606184731.437300-4-jolsa@kernel.org> From: Alexei Starovoitov Date: Tue, 7 Jun 2022 11:40:47 -0700 Message-ID: Subject: Re: [PATCHv2 bpf 3/3] bpf: Force cookies array to follow symbols sorting To: Jiri Olsa Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Network Development , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , Masami Hiramatsu Content-Type: text/plain; charset="UTF-8" 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, Jun 6, 2022 at 11:48 AM Jiri Olsa wrote: > > When user specifies symbols and cookies for kprobe_multi link > interface it's very likely the cookies will be misplaced and > returned to wrong functions (via get_attach_cookie helper). > > The reason is that to resolve the provided functions we sort > them before passing them to ftrace_lookup_symbols, but we do > not do the same sort on the cookie values. > > Fixing this by using sort_r function with custom swap callback > that swaps cookie values as well. > > Fixes: 0236fec57a15 ("bpf: Resolve symbols with ftrace_lookup_symbols for kprobe multi link") > Signed-off-by: Jiri Olsa It looks good, but something in this patch is causing a regression: ./test_progs -t kprobe_multi test_kprobe_multi_test:PASS:load_kallsyms 0 nsec #80/1 kprobe_multi_test/skel_api:OK #80/2 kprobe_multi_test/link_api_addrs:OK #80/3 kprobe_multi_test/link_api_syms:OK #80/4 kprobe_multi_test/attach_api_pattern:OK #80/5 kprobe_multi_test/attach_api_addrs:OK #80/6 kprobe_multi_test/attach_api_syms:OK #80/7 kprobe_multi_test/attach_api_fails:OK test_bench_attach:PASS:get_syms 0 nsec test_bench_attach:PASS:kprobe_multi_empty__open_and_load 0 nsec libbpf: prog 'test_kprobe_empty': failed to attach: No such process test_bench_attach:FAIL:bpf_program__attach_kprobe_multi_opts unexpected error: -3 #80/8 kprobe_multi_test/bench_attach:FAIL #80 kprobe_multi_test:FAIL CI is unfortunately green, because we don't run it there: #80/1 kprobe_multi_test/skel_api:OK #80/2 kprobe_multi_test/link_api_addrs:OK #80/3 kprobe_multi_test/link_api_syms:OK #80/4 kprobe_multi_test/attach_api_pattern:OK #80/5 kprobe_multi_test/attach_api_addrs:OK #80/6 kprobe_multi_test/attach_api_syms:OK #80/7 kprobe_multi_test/attach_api_fails:OK #80 kprobe_multi_test:OK