lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201114135126.29462-1-dev@der-flo.net>
Date:   Sat, 14 Nov 2020 14:51:26 +0100
From:   Florian Lehner <dev@...-flo.net>
To:     bpf@...r.kernel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
        john.fastabend@...il.com, peterz@...radead.org, mingo@...hat.com,
        acme@...nel.org, Florian Lehner <dev@...-flo.net>
Subject: [PATCH bpf,perf]] bpf,perf: return EOPNOTSUPP for attaching bpf handler on PERF_COUNT_SW_DUMMY

At the moment it is not possible to attach a bpf handler to a perf event
of type PERF_TYPE_SOFTWARE with a configuration of PERF_COUNT_SW_DUMMY.

Signed-off-by: Florian Lehner <dev@...-flo.net>
---
 kernel/events/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index da467e1dd49a..4e8846b7ceda 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd)
 	if (event->prog)
 		return -EEXIST;
 
+	if (event->attr.type == PERF_TYPE_SOFTWARE &&
+	    event->attr.config == PERF_COUNT_SW_DUMMY)
+		return -EOPNOTSUPP;
+
 	prog = bpf_prog_get_type(prog_fd, BPF_PROG_TYPE_PERF_EVENT);
 	if (IS_ERR(prog))
 		return PTR_ERR(prog);
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ