perf symbols: Introduce filename__readable to check readability
authorMasami Hiramatsu <mhiramat@kernel.org>
Sat, 28 May 2016 15:15:13 +0000 (00:15 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 30 May 2016 16:15:01 +0000 (13:15 -0300)
commit11870d714a1b744a0225e90b0b395346357defe9
treeb0cabbde5a55ad879ec9505710bef357a385239c
parentdcd1e2a7ba63710843d559f1570628321e62223e
perf symbols: Introduce filename__readable to check readability

Introduce filename__readable to check readability by opening the file
directly. Since the access(R_OK) just checks the readability based on
real UID/GID, it is ignored that the effective UID/GID and capabilities
for some special file (e.g.  /proc/kcore).

filename__readable() directly opens given file with O_RDONLY so that the
kernel checks it by effective UID/GID and capabilities.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160528151513.16098.97576.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/symbol.c