On Thu, Aug 21, 2025 at 9:08 AM Leon Hwang <leon.hwang@xxxxxxxxx> wrote: > > It is to unify map flags checking for lookup, update, lookup_batch and > update_batch. > > Therefore, it will be convenient to check BPF_F_CPU flag in this helper > function for them in next patch. > > Signed-off-by: Leon Hwang <leon.hwang@xxxxxxxxx> > --- > kernel/bpf/syscall.c | 45 ++++++++++++++++++++++---------------------- > 1 file changed, 22 insertions(+), 23 deletions(-) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index 0fbfa8532c392..19f7f5de5e7dc 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -1654,6 +1654,17 @@ static void *___bpf_copy_key(bpfptr_t ukey, u64 key_size) > return NULL; > } > > +static int check_map_flags(struct bpf_map *map, u64 flags, bool check_flag) "check_map_flags" is super generically named... (and actually misleading, it's not map flags you are checking), so I think it should be something along the lines of "check_map_op_flag", i.e. map *operation* flag? but also check_flag bool argument name for a function called "check flags" is so confusing... The idea here is whether we should enforce there is no *extra* flags beyond those common for all operations, right? So maybe call it "allow_extra_flags" or alternatively "strict_extra_flags", something suggesting that his is something in addition to common flags alternatively, and perhaps best of all, I'd move that particular check outside and just maintain something like ARRAY_CREATE_FLAG_MASK for each operation, checking it explicitly where appropriate. WDYT? pw-bot: cr [...]