-
Notifications
You must be signed in to change notification settings - Fork 182
Description
The auxmap in driver/modern_bpf/helpers/store/auxmap_store_params.h assumes an ebpf program runs exclusively on a CPU without preemption.
But I only see ebpfs run with migrate_disable().
So an ebpf could be preempted after it started writing to the auxmap.
Then another program scheduled on that CPU overwrites the auxmap.
Then the original program is scheduled again and with bpf_ringbuf_output() it copies a malformed event from the auxmap.
Is there some other place where preemption gets disabled? I don't see anything i.e. in sys_exit.
I see also that historically epbf used preempt_disable().
In linux 5.7 it changed to migrate_disable() [1], although at the time migrate_disable() was just an alias for preempt_disable().
In 5.11 migrate_disable() moved away from preempt_disable() [2].
There was an bpf_preempt_disable() added in linux 6.10, quite late.
For 5.1+ there's bpf_spin_lock() that disables preemption.