Re: [PATCH bpf] bpf: Fix offset calculation error in __copy_map_value and zero_map_value

From: Kumar Kartikeya Dwivedi
Date: Fri Nov 11 2022 - 14:35:24 EST


On Fri, Nov 11, 2022 at 06:26:20PM IST, Xu Kuohai wrote:
> From: Xu Kuohai <xukuohai@xxxxxxxxxx>
>
> Function __copy_map_value and zero_map_value miscalculated copy offset,
> resulting in possible copy of unwanted data to user or kernel.
>
> Fix it.
>
> Fixes: cc48755808c6 ("bpf: Add zero_map_value to zero map value with special fields")
> Fixes: 4d7d7f69f4b1 ("bpf: Adapt copy_map_value for multiple offset case")
> Signed-off-by: Xu Kuohai <xukuohai@xxxxxxxxxx>
> ---

Acked-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>

I also have a fix here for bpf-next, since this won't apply to it:
https://lore.kernel.org/bpf/20221111193224.876706-4-memxor@xxxxxxxxx

I think it'd be best if this one gets applied to bpf and mine to bpf-next, and
any conflicts are resolved when merging both trees (the conflict is trivial),
but I'll leave it up to the maintainers to decide.