lkml.org 
[lkml]   [2022]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH bpf 1/2] bpf: Do not copy spin lock field from user in bpf_selem_alloc
On Mon, Nov 14, 2022 at 5:31 AM Xu Kuohai <xukuohai@huawei.com> wrote:
>
> bpf_selem_alloc function is used by inode_storage, sk_storage and
> task_storage maps to set map value, for these map types, there may
> be a spin lock in the map value, so if we use memcpy to copy the whole
> map value from user, the spin lock field may be initialized incorrectly.
>
> Since the spin lock field is zeroed by kzalloc, call copy_map_value
> instead of memcpy to skip copying the spin lock field to fix it.
>
> Fixes: 6ac99e8f23d4 ("bpf: Introduce bpf sk local storage")

The tag is wrong. When local storage was introduced it was not
possible to use spin_locks there.
Pls resubmit.

\
 
 \ /
  Last update: 2022-11-16 06:28    [W:2.099 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site