Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp381381rdb; Sat, 19 Aug 2023 05:44:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFr7xgTshSuQ4AVbjYb/0AFWJX5V3YHRhI3dUpk+5t5NsObPZrXAfw4xjRTBWjdjoQxb980 X-Received: by 2002:a05:6a20:7f8b:b0:13d:7aa3:aa6c with SMTP id d11-20020a056a207f8b00b0013d7aa3aa6cmr3094886pzj.0.1692449045602; Sat, 19 Aug 2023 05:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692449045; cv=none; d=google.com; s=arc-20160816; b=1JtlMiEoFGGvpxxKrrpZ1K01buA0MNHQxHbXGapYs75ysIEN7jYHwrdI+qFxyCUWCT QzqxS3H8yWr9qlGd/XRpsQotAzweeZ9yodE5dXuiO0QDxFBDb3x9R+5tINx5AVTUTlmy v8X5ydS5SppywahgecaomlVwvG5S9wzmzZY9QHCFVngX/e3wmJXp4JNnp2em7mdt+TJs iIBQAjcKVyIfui01rfecgDe85YDALYdPl5WFKnsLwHzUBY3Mk738gz1AEDe9v9VC7xHU oX/ylaD4m4UMMPfrq+w5uUMHUUkUxAT4Bq1idHzqVkF70Hqu3+l7cJgmzQiCc+9qKBA/ rwyA== 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=Yd06eXe9QbbbhMwMt7CzPM8So0Gw8wIAsdm5NOe4q84=; fh=G3PlzF+XUvkHUqL6k16HyHUv4lLfJdSSN8q8ztENvks=; b=QJSTMk9tGEGqwjYdVIMFf+G1SghrqcS9BGmUMbG+jDTpkfeNPiSLQEvo9ZCM1M3Vuu fd6k/qrSa86jX4ygWGShrV0gnzoE80HgF4K2XWlLpfO1myLW1D0OPdr3jL1JqRpaAPaM vZQsqZ1ZhYaOWKN+KaX/A6FHjUbIYNEQpf9ZCzrNBpMcHYjF5qCOvxazyA+Hnzk5tnWl I9Apo+E5NIrjAuDD4Wu4dX/KmPJ0y77rOPyBSA1BaztxefObhL2v2XsTEYtY2bQQCv66 gx3lFOLSdHAWys2yAt/DYURSPjtybEuHTRFu8jaMYXhU6WncsDjtD6Ha+HEIcOEs3K2v AaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GTWI0SxK; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d132-20020a63368a000000b005680cb68676si3424024pga.175.2023.08.19.05.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 05:44:05 -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=@kernel.org header.s=k20201202 header.b=GTWI0SxK; 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=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF7A38B329; Sat, 19 Aug 2023 01:38:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245208AbjHPNLb (ORCPT + 99 others); Wed, 16 Aug 2023 09:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245393AbjHPNLR (ORCPT ); Wed, 16 Aug 2023 09:11:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EDC1BFB; Wed, 16 Aug 2023 06:11:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5328D61C4E; Wed, 16 Aug 2023 13:11:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C04BC433C9; Wed, 16 Aug 2023 13:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692191475; bh=zWuvXK7QMRZXyxcMioldJT+UNyw10JlwQNc8/I5Yezk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GTWI0SxKGp1wEgqfo7YBE5wtsKMlhEew8Ab06byaIFdkUrz50ik8wuvOe4ce2cHvg jwfFc0nHs36ks6Kv+rPzQ5qXPcm2pqp0WIUjd2yVM0PvfsaMnx+yjoHQNfLw9g5+Or xwLPPV+4eTmXDPIy9UWP3x/Px/GmK3VxuG9concy7gKpLchjOE85KsrrrbNj3TrbTZ 74Alulf+4B6X7JC2m1k6nWK+Ae7nFFPADkX2Sak6GQ46OBd7NqADHdZzUjSnrpD/If Gqn5UL12zGEvZ3cz+19OWWnuSHYpTZmHVJ/6+itKxvJSkj/tBhv3SoroJ9StX5jJuN u0sluyTu4ywbQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BA6CF404DF; Wed, 16 Aug 2023 10:11:11 -0300 (-03) Date: Wed, 16 Aug 2023 10:11:11 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Fangrui Song , Anshuman Khandual , Andi Kleen , Leo Yan , Madhavan Srinivasan , Carsten Haitzler , Ravi Bangoria , "Naveen N. Rao" , Athira Rajeev , Kan Liang , Yang Jihong , James Clark , Tiezhu Yang , Eduard Zingerman , Andrii Nakryiko , Yonghong Song , Rob Herring , LKML , linux-perf-users , bpf , llvm@lists.linux.dev, Wang Nan , Wang ShaoBo , YueHaibing , He Kuang , Brendan Gregg Subject: Re: [PATCH v1 2/4] perf trace: Migrate BPF augmentation to use a skeleton Message-ID: References: <20230810184853.2860737-1-irogers@google.com> <20230810184853.2860737-3-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Em Tue, Aug 15, 2023 at 07:34:08AM -0700, Ian Rogers escreveu: > On Tue, Aug 15, 2023, 7:25 AM Arnaldo Carvalho de Melo wrote: > > bpf_object__for_each_program(prog, trace.skel->obj) { > > if (prog != trace.skel->progs.sys_enter && prog != > > trace.skel->progs.sys_exit) > > bpf_program__set_autoattach(prog, > > /*autoattach=*/false); > > } > > > > So that we don't have to add new lines disabling attachment when adding > > support for other pointer receiving syscalls. > Makes sense. Thanks, Just taking notes about things to work on top of what is in tmp.perf-tools-next, that will move to perf-tools-next soon: We need to make these libbpf error messages appear only in verbose mode, and probably have a hint about unprivileged BPF, a quick attempt failed after several attempts at getting privileges :-\ Probably attaching to tracepoints is off limits to !root even with /proc/sys/kernel/unprivileged_bpf_disabled set to zero. [acme@quaco perf-tools-next]$ perf trace ls libbpf: Failed to bump RLIMIT_MEMLOCK (err = -1), you might need to do it explicitly! libbpf: Error in bpf_object__probe_loading():Operation not permitted(1). Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value. libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$ [acme@quaco perf-tools-next]$ perf trace -e open* sleep 1 libbpf: Failed to bump RLIMIT_MEMLOCK (err = -1), you might need to do it explicitly! libbpf: Error in bpf_object__probe_loading():Operation not permitted(1). Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value. libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$ sudo mount -o remount,mode=755 /sys/kernel/tracing/ [sudo] password for acme: [acme@quaco perf-tools-next]$ perf trace -e open* sleep 1 libbpf: Failed to bump RLIMIT_MEMLOCK (err = -1), you might need to do it explicitly! libbpf: Error in bpf_object__probe_loading():Operation not permitted(1). Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value. libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$ sudo mount -o remount,mode=755 /sys/kernel/debug [acme@quaco perf-tools-next]$ perf trace -e open* sleep 1 libbpf: Failed to bump RLIMIT_MEMLOCK (err = -1), you might need to do it explicitly! libbpf: Error in bpf_object__probe_loading():Operation not permitted(1). Couldn't load trivial BPF program. Make sure your kernel supports BPF (CONFIG_BPF_SYSCALL=y) and/or that RLIMIT_MEMLOCK is set to big enough value. libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$ sudo sh -c "echo 0 > /proc/sys/kernel/unprivileged_bpf_disabled" [acme@quaco perf-tools-next]$ perf trace -e open* sleep 1 libbpf: prog 'syscall_unaugmented': BPF program load failed: Operation not permitted libbpf: prog 'syscall_unaugmented': failed to load: -1 libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$ cat /proc/sys/kernel/unprivileged_bpf_disabled 0 [acme@quaco perf-tools-next]$ [acme@quaco perf-tools-next]$ [acme@quaco perf-tools-next]$ cat /proc/sys/kernel/perf_event_paranoid 2 [acme@quaco perf-tools-next]$ sudo sh -c "echo -1 > /proc/sys/kernel/perf_event_paranoid" [acme@quaco perf-tools-next]$ perf trace -e open* sleep 1 libbpf: prog 'syscall_unaugmented': BPF program load failed: Operation not permitted libbpf: prog 'syscall_unaugmented': failed to load: -1 libbpf: failed to load object 'augmented_raw_syscalls_bpf' libbpf: failed to load BPF skeleton 'augmented_raw_syscalls_bpf': -1 Error: No permissions to read /sys/kernel/tracing//events/raw_syscalls/sys_(enter|exit) Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/' [acme@quaco perf-tools-next]$