1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-11 04:58:19 +03:00

sd-device: don't use BPF filtering for kernel monitors

BPF filtering accesses fields in the netlink header that are
only filled in by libudev, never by the kernel. Therefore adding
BPF filters for kernel monitors is pointless. Even false filtering
of kernel events might be possible; at least it's hard to prove that
it can't occur.

(cherry picked from commit d8ce385fe3e5be91b6f414415e10f8897e41d942)
This commit is contained in:
Martin Wilck 2021-02-25 17:09:03 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 9d97f2dc56
commit 8f67d7ba3a

@ -627,8 +627,9 @@ _public_ int sd_device_monitor_filter_update(sd_device_monitor *m) {
if (m->filter_uptodate)
return 0;
if (hashmap_isempty(m->subsystem_filter) &&
set_isempty(m->tag_filter)) {
if (m->snl.nl.nl_groups == MONITOR_GROUP_KERNEL ||
(hashmap_isempty(m->subsystem_filter) &&
set_isempty(m->tag_filter))) {
m->filter_uptodate = true;
return 0;
}