Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1167597

Re: [PATCH v2 1/1] perf tools: Check access permission when reading /proc/kcore file.

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/1] perf tools: Check access permission when reading /proc/kcore file.
Date Thu, 18 Jun 2015 08:00:02 +0200
Message-ID <pCB1M-7VD-7@gated-at.bofh.it> (permalink)
References <pCeRz-1oA-5@gated-at.bofh.it> <pCeRz-1oA-3@gated-at.bofh.it> <pCyQj-4Wq-25@gated-at.bofh.it>
X-Original-To Li Zhang <zhlcindy@linux.vnet.ibm.com>
X-Helo d01dlp01.pok.ibm.com
X-Mailfrom sukadev@linux.vnet.ibm.com
X-Rcptto linux-kernel@vger.kernel.org
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
X-Operating-System Linux 2.0.32 on an i486
User-Agent Mutt/1.5.21 (2010-09-15)
X-Tm-As-Mml disable
X-Content-Scanned Fidelis XPS MAILER
X-Cbid 15061805-0045-0000-0000-0000007B63FE
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 54
Organization linux.* mail to news gateway
X-Original-Cc acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org
X-Original-Date Wed, 17 Jun 2015 22:56:08 -0700
X-Original-Message-ID <20150618055608.GA2193@us.ibm.com>
X-Original-References <1434350500-32342-1-git-send-email-zhlcindy@linux.vnet.ibm.com> <20150617060946.GA18162@us.ibm.com> <55823B78.3050403@linux.vnet.ibm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1167597

Show key headers only | View raw


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.

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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2 1/1] perf tools: Check access permission when reading  /proc/kcore file. Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-06-18 08:00 +0200

csiph-web