Re: [PATCH bpf-next 3/4] bpf: task work scheduling kfuncs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 6, 2025 at 7:46 AM Mykyta Yatsenko
<mykyta.yatsenko5@xxxxxxxxx> wrote:
> +
> +struct bpf_task_work_context {
> +       /* map that contains this structure in a value */
> +       struct bpf_map *map;
> +       /* bpf_task_work_state value, representing the state */
> +       atomic_t state;

a hole

> +       /* bpf_prog that schedules task work */
> +       struct bpf_prog *prog;
> +       /* task for which callback is scheduled */
> +       struct task_struct *task;
> +       /* notification mode for task work scheduling */
> +       enum task_work_notify_mode mode;

another hole

> +       /* callback to call from task work */
> +       bpf_task_work_callback_t callback_fn;
> +       struct callback_head work;
> +       struct irq_work irq_work;
> +} __aligned(8);

and
+struct bpf_task_work {
+       __u64 __opaque[16];
+} __attribute__((aligned(8)));

This is way too fragile.
A bunch of data structures in above are not in our control
and might be changed without any one mentioning anything
on the bpf mailing list, and things will break.
If all of the fields were plain pointers we could consider
placing bpf_task_work inline in the map value,
but with inlined irq_work is imo no go.
Indirection is the only option here.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux