• Li Zhang's avatar
    perf symbols: Check access permission when reading symbol files · 36c8bb56
    Li Zhang authored
    There 2 problems when reading symbols files:
    
    *  It doesn't report any errors even if when users specify symbol
       files which don't exist with --kallsyms or --vmlinux. The result
       just shows the address without symbols, which is not what is expected.
       So it's better to report errors and exit the program.
    
    *  When using command perf report --kallsyms=/proc/kallsyms with a
       non-root user, symbols are resolved. Then select one symbol and
       annotate it, it reports the error as the following:
       Can't annotate __clear_user: No vmlinux file with build id xxx was
       found.
    
       The problem is caused by reading /proc/kcore without access permission.
       /proc/kcore requires CAP_SYS_RAWIO capability to access, so it needs to
       change access permission to allow a specific user to read /proc/kcore or
       use root to execute the perf command.
    
    This patch is to report errors when symbol files specified by users
    don't exist. And check access permission of /proc/kcore when reading it.
    Signed-off-by: default avatarLi Zhang <zhlcindy@linux.vnet.ibm.com>
    Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
    Link: http://lkml.kernel.org/r/1434704253-2632-1-git-send-email-zhlcindy@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    36c8bb56
builtin-report.c 25.9 KB