From bacf439175b9bda26eb9c1d01abe3888a16be497 Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Thu, 12 Mar 2026 11:21:23 -0700 Subject: [PATCH] ci/diffs: Add a patch fixing up bpftool_helpers.c Signed-off-by: Ihor Solodrai --- ...mp-path-and-command-buffer-sizes-in-.patch | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 ci/diffs/20260312-selftests-bpf-Bump-path-and-command-buffer-sizes-in-.patch diff --git a/ci/diffs/20260312-selftests-bpf-Bump-path-and-command-buffer-sizes-in-.patch b/ci/diffs/20260312-selftests-bpf-Bump-path-and-command-buffer-sizes-in-.patch new file mode 100644 index 0000000..c703054 --- /dev/null +++ b/ci/diffs/20260312-selftests-bpf-Bump-path-and-command-buffer-sizes-in-.patch @@ -0,0 +1,72 @@ +From 8b6db30a1ca47875070ce6b282316a5148a5c4c0 Mon Sep 17 00:00:00 2001 +From: Ihor Solodrai +Date: Thu, 12 Mar 2026 11:13:14 -0700 +Subject: [PATCH] selftests/bpf: Bump path and command buffer sizes in + bpftool_helpers.c + +Signed-off-by: Ihor Solodrai +--- + tools/testing/selftests/bpf/bpftool_helpers.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/tools/testing/selftests/bpf/bpftool_helpers.c b/tools/testing/selftests/bpf/bpftool_helpers.c +index 929fc257f431..6a5e99b5e542 100644 +--- a/tools/testing/selftests/bpf/bpftool_helpers.c ++++ b/tools/testing/selftests/bpf/bpftool_helpers.c +@@ -2,18 +2,18 @@ + #include + #include + #include ++#include + + #include "bpf_util.h" + #include "bpftool_helpers.h" + +-#define BPFTOOL_PATH_MAX_LEN 64 +-#define BPFTOOL_FULL_CMD_MAX_LEN 512 ++#define BPFTOOL_FULL_CMD_MAX_LEN (PATH_MAX * 2) + + #define BPFTOOL_DEFAULT_PATH "tools/sbin/bpftool" + + static int detect_bpftool_path(char *buffer, size_t size) + { +- char tmp[BPFTOOL_PATH_MAX_LEN]; ++ char tmp[PATH_MAX]; + const char *env_path; + + /* First, check if BPFTOOL environment variable is set */ +@@ -29,7 +29,7 @@ static int detect_bpftool_path(char *buffer, size_t size) + /* Check default bpftool location (will work if we are running the + * default flavor of test_progs) + */ +- snprintf(tmp, BPFTOOL_PATH_MAX_LEN, "./%s", BPFTOOL_DEFAULT_PATH); ++ snprintf(tmp, PATH_MAX, "./%s", BPFTOOL_DEFAULT_PATH); + if (access(tmp, X_OK) == 0) { + strscpy(buffer, tmp, size); + return 0; +@@ -38,7 +38,7 @@ static int detect_bpftool_path(char *buffer, size_t size) + /* Check alternate bpftool location (will work if we are running a + * specific flavor of test_progs, e.g. cpuv4 or no_alu32) + */ +- snprintf(tmp, BPFTOOL_PATH_MAX_LEN, "../%s", BPFTOOL_DEFAULT_PATH); ++ snprintf(tmp, PATH_MAX, "../%s", BPFTOOL_DEFAULT_PATH); + if (access(tmp, X_OK) == 0) { + strscpy(buffer, tmp, size); + return 0; +@@ -50,7 +50,7 @@ static int detect_bpftool_path(char *buffer, size_t size) + + static int run_command(char *args, char *output_buf, size_t output_max_len) + { +- static char bpftool_path[BPFTOOL_PATH_MAX_LEN] = {0}; ++ static char bpftool_path[PATH_MAX] = {0}; + bool suppress_output = !(output_buf && output_max_len); + char command[BPFTOOL_FULL_CMD_MAX_LEN]; + FILE *f; +@@ -84,4 +84,3 @@ int get_bpftool_command_output(char *args, char *output_buf, size_t output_max_l + { + return run_command(args, output_buf, output_max_len); + } +- +-- +2.53.0 +