perf tests: Use scandirat for shell script finding
authorIan Rogers <irogers@google.com>
Wed, 21 Feb 2024 03:41:53 +0000 (19:41 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 22 Feb 2024 17:12:53 +0000 (09:12 -0800)
commitf3295f5b067d3c2655f0b2cd14d0b91b83ca41eb
tree94cd88d1bfc40af8ff7e60df05594263b6ab081b
parentd5bcade989a86caa4314aa91d6d3f652e8a82fe5
perf tests: Use scandirat for shell script finding

Avoid filename appending buffers by using openat, faccessat and
scandirat more widely. Turn the script's path back to a file name
using readlink from /proc/<pid>/fd/<fd>.

Read the script's description using api/io.h to avoid fdopen
conversions. Whilst reading perform additional sanity checks on the
script's contents.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: llvm@lists.linux.dev
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240221034155.1500118-7-irogers@google.com
tools/perf/tests/builtin-test.c
tools/perf/tests/tests-scripts.c
tools/perf/tests/tests-scripts.h