Re: [PATCH] perf: fix temporary file ownership check

From: Pekka Enberg
Date: Fri Aug 12 2011 - 01:17:52 EST


On Fri, 2011-08-12 at 00:55 +0400, Vasiliy Kulikov wrote:
> A file in /tmp/ might be a symlink, so lstat() should be used
> instead of stat().
>
> Cc: Pekka Enberg <penberg@xxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>

Acked-by: Pekka Enberg <penberg@xxxxxxxxxx>

> ---
> tools/perf/util/symbol.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index a8b5371..5db39f6 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1506,7 +1506,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
> if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
> struct stat st;
>
> - if (stat(dso->name, &st) < 0)
> + if (lstat(dso->name, &st) < 0)
> return -1;
>
> if (st.st_uid && (st.st_uid != geteuid())) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/