From: Stanislav Fomichev <sdf@google.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net,
songliubraving@fb.com, Stanislav Fomichev <sdf@google.com>
Subject: [PATCH bpf 2/3] bpf: zero out build_id for BPF_STACK_BUILD_ID_IP
Date: Tue, 15 Jan 2019 14:54:46 -0800 [thread overview]
Message-ID: <20190115225447.245788-2-sdf@google.com> (raw)
In-Reply-To: <20190115225447.245788-1-sdf@google.com>
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@google.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
next prev parent reply other threads:[~2019-01-15 22:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-15 22:54 [PATCH bpf 1/3] bpf: don't assume build-id length is always 20 bytes Stanislav Fomichev
2019-01-15 22:54 ` Stanislav Fomichev [this message]
2019-01-16 17:48 ` [PATCH bpf 2/3] bpf: zero out build_id for BPF_STACK_BUILD_ID_IP Song Liu
2019-01-15 22:54 ` [PATCH bpf 3/3] selftests/bpf: retry tests that expect build-id Stanislav Fomichev
2019-01-16 17:49 ` Song Liu
2019-01-16 17:45 ` [PATCH bpf 1/3] bpf: don't assume build-id length is always 20 bytes Song Liu
2019-01-16 17:50 ` Stanislav Fomichev
2019-01-16 18:11 ` [PATCH bpf v2 " Stanislav Fomichev
2019-01-16 18:20 ` Song Liu
2019-01-16 21:59 ` Daniel Borkmann
2019-01-16 22:01 ` Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190115225447.245788-2-sdf@google.com \
--to=sdf@google.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).