OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4daf0b3
)
bpf: ensure all memory is initialized in bpf_get_current_comm
author
Barret Rhoden
<brho@google.com>
Fri, 7 Apr 2023 00:18:08 +0000
(20:18 -0400)
committer
Alexei Starovoitov
<ast@kernel.org>
Fri, 7 Apr 2023 01:48:24 +0000
(18:48 -0700)
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>
Link:
https://lore.kernel.org/r/20230407001808.1622968-1-brho@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c
patch
|
blob
|
history
diff --git
a/kernel/bpf/helpers.c
b/kernel/bpf/helpers.c
index
6be16db
..
b6a5cda
100644
(file)
--- 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);