From: Julien Grall <julien.grall@linaro.org>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
ian.campbell@citrix.com, ian.jackson@eu.citrix.com,
jbeulich@suse.com, keir@xen.org, tim@xen.org
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH v3] vsprintf: Make sure argument to %pX specifier is valid
Date: Wed, 18 Feb 2015 15:52:53 +0000 [thread overview]
Message-ID: <54E4B555.7030700@linaro.org> (raw)
In-Reply-To: <1424273966-3566-1-git-send-email-boris.ostrovsky@oracle.com>
Hi Boris,
On 18/02/2015 15:39, Boris Ostrovsky wrote:
> If invalid pointer (i.e. something smaller than HYPERVISOR_VIRT_START)
> is passed for %*ph/%pv/%ps/%pS format specifiers then print value of the
> pointer in parentheses.
>
> For example:
>
> struct vcpu *v0 = NULL;
> struct vcpu *v1 = (void *)0xffUL;
> unsigned val = 0xab;
> unsigned *ptr = &val;
> unsigned *badptr = (void *)0xab;
> printk("v0 = %pv, v1 = %pv, curr = %pv\n", v0, v1, current);
> printk("badptr = %*ph, ptr = %*ph\n", 1, badptr, 1, ptr);
>
> will produce
> v0 = (0), v1 = (ff), curr = d0v3
> badptr = (ab), ptr = ab
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
> xen/common/vsprintf.c | 23 ++++++++++++++++++++++-
> 1 files changed, 22 insertions(+), 1 deletions(-)
>
> v3:
> * Print value of the bad pointer in parentheses.
> (I understand Andrew's dislike of additional switch but I
> think this is the cleanest way)
>
> v2:
> * Print "(NULL)" instead of specifier-specific string
> * Consider all addresses under HYPERVISOR_VIRT_START as invalid. (I think
> this is true for both x86 and ARM but I don't have ARM platform to test).
This assumption is valid on ARM too. Although, we may have some mappings
after HYPERVISOR_VIRT_START why are not valid.
On ARM, HYPERVISOR_VIRT_END marks the end of mapping which is not always
mapped (such as the domheap). Would it make sense to test it? Although
it seems that x86 doesn't have the same meaning for this macro.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2015-02-18 15:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 15:39 [PATCH v3] vsprintf: Make sure argument to %pX specifier is valid Boris Ostrovsky
2015-02-18 15:38 ` Andrew Cooper
2015-02-18 15:52 ` Julien Grall [this message]
2015-02-18 16:10 ` Boris Ostrovsky
2015-02-18 16:19 ` Jan Beulich
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=54E4B555.7030700@linaro.org \
--to=julien.grall@linaro.org \
--cc=boris.ostrovsky@oracle.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.