public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Cc: acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] perf tools: Check access permission when reading /proc/kcore file.
Date: Wed, 17 Jun 2015 22:56:08 -0700	[thread overview]
Message-ID: <20150618055608.GA2193@us.ibm.com> (raw)
In-Reply-To: <55823B78.3050403@linux.vnet.ibm.com>

Li Zhang [zhlcindy@linux.vnet.ibm.com] wrote:

| >For consistency with rest of the file, use pr_warning() or pr_err().
| 
| ui_warning can report the message to users directly when this
| program is running.
| But if we considered the consistency, pr_warning or pr_err should be better.
| And users can get this message by trying another time.

That seems to be the way perf currently operates - silent by default for
non-fatal errors. -v or -vvv increases verbosity and reports non-fatal
warnings/errors also.

| 
| >
| >Also, we could drop the access() call and report the error when open()
| >fails below?
| 
| I think we can drop this access. But /proc/kcore also require the
| process with CAP_SYS_RAWIO
| capability. Even if chown this file, access report right result, but
| open still fails.

Maybe the error message could hint that CAP_SYS_RAWIO would be needed.
| 
| >
| >|  	fd = open(kcore_filename, O_RDONLY);
| >|  	if (fd < 0)
| >|  		return -EINVAL;
| >
| >Further, if user specifies the file with --kallsyms and we are not
| >able to read it, we should treat it as a fatal error and exit - this
| >would be easer when parsing command line args.
| I have another patch which checks this files. I will merge it to this patch.
| 
| >
| >If user did not specify the option and we are proactively trying to
| >use /proc/kcore, we should not treat errors as fatal? i.e report
| >a warning message and continue without symbols?
| 
| In the current program, even if open fails, the program still
| continue to run.
| Is it helpful for users to get the address without symbols?

Well, if profiling applications, user may not care about kernel symbols,
so being unable to open /proc/kcore would be ok? If OTOH, user specifies
--kallsyms, then they care about the kenrel symbols so we should treat
the open() error () as fatal.


  reply	other threads:[~2015-06-18  5:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1434350500-32342-1-git-send-email-zhlcindy@linux.vnet.ibm.com>
2015-06-17  6:09 ` [PATCH v2 1/1] perf tools: Check access permission when reading /proc/kcore file Sukadev Bhattiprolu
2015-06-18  3:31   ` Li Zhang
2015-06-18  5:56     ` Sukadev Bhattiprolu [this message]
2015-06-18  8:24       ` Li Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150618055608.GA2193@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=zhlcindy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox