BPF List
 help / color / mirror / Atom feed
* [PATCH linu-next] samples/bpf: use absolute path for dd
@ 2022-09-22  9:02 cgel.zte
  2022-09-22 10:08 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-09-22  9:02 UTC (permalink / raw)
  To: ast
  Cc: daniel, andrii, martin.lau, song, yhs, john.fastabend, kpsingh,
	sdf, haoluo, jolsa, bpf, linux-kernel, Xu Panda, Zeal Robot

From: Xu Panda <xu.panda@zte.com.cn>

Not using absolute path when invoking dd can lead to serious security
issues.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
 samples/bpf/trace_event_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 9664749bf618..d841918accc9 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -126,7 +126,7 @@ static void print_stacks(void)

 static inline int generate_load(void)
 {
-       if (system("dd if=/dev/zero of=/dev/null count=5000k status=none") < 0) {
+       if (system("/usr/bin/dd if=/dev/zero of=/dev/null count=5000k status=none") < 0) {
                printf("failed to generate some load with dd: %s\n", strerror(errno));
                return -1;
        }
-- 
2.15.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-22 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-22  9:02 [PATCH linu-next] samples/bpf: use absolute path for dd cgel.zte
2022-09-22 10:08 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox