]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: dispatch to sleepable file dynptr
authorMykyta Yatsenko <yatsenko@meta.com>
Sun, 26 Oct 2025 20:38:52 +0000 (20:38 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 27 Oct 2025 16:56:27 +0000 (09:56 -0700)
commit2c52e8943a437af6093d8b0f0920f1764f0e5f64
tree68e993ce0973cc679de4fb7087f64068b77b22f8
parentd869d56ca848415b1169ba08b4f92a32968de8a2
bpf: dispatch to sleepable file dynptr

File dynptr reads may sleep when the requested folios are not in
the page cache. To avoid sleeping in non-sleepable contexts while still
supporting valid sleepable use, given that dynptrs are non-sleepable by
default, enable sleeping only when bpf_dynptr_from_file() is invoked
from a sleepable context.

This change:
  * Introduces a sleepable constructor: bpf_dynptr_from_file_sleepable()
  * Override non-sleepable constructor with sleepable if it's always
  called in sleepable context

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20251026203853.135105-10-mykyta.yatsenko5@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/helpers.c
kernel/bpf/verifier.c