From: Matthew Wilcox <willy@infradead.org>
To: Changbin Du <changbin.du@gmail.com>
Cc: linux-doc@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, rostedt@goodmis.org,
linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] fgraph: record function return value
Date: Sat, 12 Jan 2019 04:21:13 -0800 [thread overview]
Message-ID: <20190112122113.GR6310@bombadil.infradead.org> (raw)
In-Reply-To: <20190112065701.30841-1-changbin.du@gmail.com>
On Sat, Jan 12, 2019 at 02:57:01PM +0800, Changbin Du wrote:
> This patch adds a new trace option 'funcgraph-retval' and is disabled by
> default. When this option is enabled, fgraph tracer will show the return
> value of each function. This is useful to find/analyze a original error
> source in a call graph.
>
> One limitation is that kernel doesn't know the prototype of functions. So
> fgraph assumes all functions have a retvalue of type int. You must ignore
> the value of *void* function. And if the retvalue looks like an error code
> then both hexadecimal and decimal number are displayed.
I don't think we can do this. You're leaking a _lot_ of kernel addresses
this way, and we've been trying very hard to avoid doing that because
it gives a lot of information to attackers.
Something more clever that prints out only errors (ie IS_ERR_VALUE())
might be acceptable. I would think printing return values that are
between 0 and 4095 should also be OK since they can't be real pointers.
We'd leak whether a function called kmalloc(0, x) since that returns
16, but that seems like a not-very-useful information leak.
> 3) 0.247 us | mutex_unlock(); /* ret=0xffff8880738ed040 */
> 3) | kvm_arch_vcpu_create() {
> 3) | vmx_create_vcpu() {
> 3) + 17.969 us | kmem_cache_alloc(); /* ret=0xffff88813a980040 */
> 3) + 15.948 us | kmem_cache_alloc(); /* ret=0xffff88813aa99200 */
> 3) 0.653 us | allocate_vpid.part.88(); /* ret=0x1 */
> 3) 6.964 us | kvm_vcpu_init(); /* ret=0xfffffffb */
> 3) 0.323 us | free_vpid.part.89(); /* ret=0x1 */
> 3) 9.985 us | kmem_cache_free(); /* ret=0x80000000 */
> 3) 9.491 us | kmem_cache_free(); /* ret=0x80000000 */
> 3) + 69.858 us | } /* ret=0xfffffffffffffffb/-5 */
> 3) + 70.631 us | } /* ret=0xfffffffffffffffb/-5 */
> 3) | mutex_lock() {
> 3) | _cond_resched() {
> 3) 0.199 us | rcu_all_qs(); /* ret=0x80000000 */
> 3) 0.594 us | } /* ret=0x0 */
> 3) 1.067 us | } /* ret=0x0 */
> 3) 0.337 us | mutex_unlock(); /* ret=0xffff8880738ed040 */
> 3) + 92.730 us | } /* ret=0xfffffffffffffffb/-5 */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-01-12 12:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-12 6:57 [PATCH] fgraph: record function return value Changbin Du
2019-01-12 12:21 ` Matthew Wilcox [this message]
2019-01-12 14:20 ` Changbin Du
2019-01-14 12:11 ` Mark Rutland
2019-01-14 16:07 ` Changbin Du
2019-01-14 16:21 ` Steven Rostedt
2019-01-15 0:40 ` Changbin Du
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=20190112122113.GR6310@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=changbin.du@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=rostedt@goodmis.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).