[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EFF086F-81EB-48BE-AC78-F8DB8B29003F@fb.com>
Date: Wed, 16 Jan 2019 17:48:48 +0000
From: Song Liu <songliubraving@...com>
To: Stanislav Fomichev <sdf@...gle.com>
CC: Netdev <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>
Subject: Re: [PATCH bpf 2/3] bpf: zero out build_id for BPF_STACK_BUILD_ID_IP
> On Jan 15, 2019, at 2:54 PM, Stanislav Fomichev <sdf@...gle.com> wrote:
>
> When returning BPF_STACK_BUILD_ID_IP from stack_map_get_build_id_offset,
> make sure that build_id field is empty. Since we are using percpu
> free list, there is a possibility that we might reuse some previous
> bpf_stack_build_id with non-zero build_id.
>
> Fixes: 615755a77b24 ("bpf: extend stackmap to save binary_build_id+offset instead of address")
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
Acked-by: Song Liu <songliubraving@...com>
> ---
> kernel/bpf/stackmap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
> index 8975d1768dcb..f4b57c68c45f 100644
> --- a/kernel/bpf/stackmap.c
> +++ b/kernel/bpf/stackmap.c
> @@ -315,6 +315,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
> for (i = 0; i < trace_nr; i++) {
> id_offs[i].status = BPF_STACK_BUILD_ID_IP;
> id_offs[i].ip = ips[i];
> + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
> }
> return;
> }
> @@ -325,6 +326,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
> /* per entry fall back to ips */
> id_offs[i].status = BPF_STACK_BUILD_ID_IP;
> id_offs[i].ip = ips[i];
> + memset(id_offs[i].build_id, 0, BPF_BUILD_ID_SIZE);
> continue;
> }
> id_offs[i].offset = (vma->vm_pgoff << PAGE_SHIFT) + ips[i]
> --
> 2.20.1.97.g81188d93c3-goog
>
Powered by blists - more mailing lists