lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <505ee6e414ee701c9ea899220154d1ec3a1f647f.1735595687.git.dxu@dxuuu.xyz>
Date: Mon, 30 Dec 2024 14:55:11 -0700
From: Daniel Xu <dxu@...uu.xyz>
To: ast@...nel.org,
	daniel@...earbox.net,
	andrii@...nel.org
Cc: martin.lau@...ux.dev,
	eddyz87@...il.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	john.fastabend@...il.com,
	kpsingh@...nel.org,
	sdf@...ichev.me,
	haoluo@...gle.com,
	jolsa@...nel.org,
	bpf@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH bpf-next] bpf: uapi: Document front truncation in bpf_d_path()

bpf_d_path() will truncate the resolved path from the front if the
provided buffer is too small. This is somewhat non-intuitive but makes
sense when you think about it. So document it.

Signed-off-by: Daniel Xu <dxu@...uu.xyz>
---
 include/uapi/linux/bpf.h       | 4 ++++
 tools/include/uapi/linux/bpf.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 2acf9b336371..91218c5fd207 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -4845,6 +4845,10 @@ union bpf_attr {
  *		including the trailing NUL character. On error, a negative
  *		value.
  *
+ *		If *buf* is too small, the resolved path is truncated from
+ *		the front and -ENAMETOOLONG is returned. The buffer is valid
+ *		in this case.
+ *
  * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
  * 	Description
  * 		Read *size* bytes from user space address *user_ptr* and store
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 2acf9b336371..91218c5fd207 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -4845,6 +4845,10 @@ union bpf_attr {
  *		including the trailing NUL character. On error, a negative
  *		value.
  *
+ *		If *buf* is too small, the resolved path is truncated from
+ *		the front and -ENAMETOOLONG is returned. The buffer is valid
+ *		in this case.
+ *
  * long bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)
  * 	Description
  * 		Read *size* bytes from user space address *user_ptr* and store
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ