“4e2f3472297bfdb780a365326a82db7457c981bc”上不存在“...sun/tools/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 a851748a 编写于 作者: B Brendan Jackman 提交者: Zheng Zengkai

bpf: Clarify return value of probe str helpers

mainline inclusion
from mainline-5.12-rc1
commit c6458e72
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6458e72f6fd6ac7e390da0d9abe8446084886e5

-------------------------------------------------

When the buffer is too small to contain the input string, these helpers
return the length of the buffer, not the length of the original string.
This tries to make the docs totally clear about that, since "the length
of the [copied ]string" could also refer to the length of the input.
Signed-off-by: NBrendan Jackman <jackmanb@google.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NKP Singh <kpsingh@kernel.org>
Acked-by: NYonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210112123422.2011234-1-jackmanb@google.com
(cherry picked from commit c6458e72)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 7683e305
...@@ -2994,10 +2994,10 @@ union bpf_attr { ...@@ -2994,10 +2994,10 @@ union bpf_attr {
* string length is larger than *size*, just *size*-1 bytes are * string length is larger than *size*, just *size*-1 bytes are
* copied and the last byte is set to NUL. * copied and the last byte is set to NUL.
* *
* On success, the length of the copied string is returned. This * On success, returns the number of bytes that were written,
* makes this helper useful in tracing programs for reading * including the terminal NUL. This makes this helper useful in
* strings, and more importantly to get its length at runtime. See * tracing programs for reading strings, and more importantly to
* the following snippet: * get its length at runtime. See the following snippet:
* *
* :: * ::
* *
...@@ -3025,7 +3025,7 @@ union bpf_attr { ...@@ -3025,7 +3025,7 @@ union bpf_attr {
* **->mm->env_start**: using this helper and the return value, * **->mm->env_start**: using this helper and the return value,
* one can quickly iterate at the right offset of the memory area. * one can quickly iterate at the right offset of the memory area.
* Return * Return
* On success, the strictly positive length of the string, * On success, the strictly positive length of the output string,
* including the trailing NUL character. On error, a negative * including the trailing NUL character. On error, a negative
* value. * value.
* *
......
...@@ -2994,10 +2994,10 @@ union bpf_attr { ...@@ -2994,10 +2994,10 @@ union bpf_attr {
* string length is larger than *size*, just *size*-1 bytes are * string length is larger than *size*, just *size*-1 bytes are
* copied and the last byte is set to NUL. * copied and the last byte is set to NUL.
* *
* On success, the length of the copied string is returned. This * On success, returns the number of bytes that were written,
* makes this helper useful in tracing programs for reading * including the terminal NUL. This makes this helper useful in
* strings, and more importantly to get its length at runtime. See * tracing programs for reading strings, and more importantly to
* the following snippet: * get its length at runtime. See the following snippet:
* *
* :: * ::
* *
...@@ -3025,7 +3025,7 @@ union bpf_attr { ...@@ -3025,7 +3025,7 @@ union bpf_attr {
* **->mm->env_start**: using this helper and the return value, * **->mm->env_start**: using this helper and the return value,
* one can quickly iterate at the right offset of the memory area. * one can quickly iterate at the right offset of the memory area.
* Return * Return
* On success, the strictly positive length of the string, * On success, the strictly positive length of the output string,
* including the trailing NUL character. On error, a negative * including the trailing NUL character. On error, a negative
* value. * value.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册