Message ID | 20230407001808.1622968-1-brho@google.com (mailing list archive) |
---|---|
State | Accepted |
Commit | f3f21349779776135349a8e6f114a1485b2476b7 |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next] bpf: ensure all memory is initialized in bpf_get_current_comm | expand |
Hello: This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Thu, 6 Apr 2023 20:18:08 -0400 you wrote: > BPF helpers that take an ARG_PTR_TO_UNINIT_MEM must ensure that all of > the memory is set, including beyond the end of the string. > > Signed-off-by: Barret Rhoden <brho@google.com> > --- > kernel/bpf/helpers.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Here is the summary with links: - [bpf-next] bpf: ensure all memory is initialized in bpf_get_current_comm https://git.kernel.org/bpf/bpf-next/c/f3f213497797 You are awesome, thank you!
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 6be16db9f188..b6a5cda5bb59 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -258,7 +258,7 @@ BPF_CALL_2(bpf_get_current_comm, char *, buf, u32, size) goto err_clear; /* Verifier guarantees that size > 0 */ - strscpy(buf, task->comm, size); + strscpy_pad(buf, task->comm, size); return 0; err_clear: memset(buf, 0, size);
BPF helpers that take an ARG_PTR_TO_UNINIT_MEM must ensure that all of the memory is set, including beyond the end of the string. Signed-off-by: Barret Rhoden <brho@google.com> --- kernel/bpf/helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)