From: Alexander Graf <agraf@suse.de>
To: "Bharat.Bhushan@freescale.com" <Bharat.Bhushan@freescale.com>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 3/3 v2] ppc debug: Add debug stub support
Date: Tue, 17 Jun 2014 13:03:00 +0200 [thread overview]
Message-ID: <53A02064.8040804@suse.de> (raw)
In-Reply-To: <a147a33aa3e24ca597bc526c95190464@DM2PR03MB574.namprd03.prod.outlook.com>
On 17.06.14 13:01, Bharat.Bhushan@freescale.com wrote:
>>>>>>> +static void kvm_arch_e500_update_guest_debug(CPUState *cs,
>>>>>>> + struct
>>>>>>> +kvm_guest_debug
>>>>>>> +*dbg) {
>>>>>>> + int n;
>>>>>>> +
>>>>>>> + if (nb_hw_breakpoint + nb_hw_watchpoint > 0) {
>>>>>>> + dbg->control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_HW_BP;
>>>>>>> + memset(dbg->arch.bp, 0, sizeof(dbg->arch.bp));
>>>>>>> + for (n = 0; n < nb_hw_breakpoint + nb_hw_watchpoint; n++)
>>>>>>> + {
>>>>>> Boundary check against dbg->arch.bp missing.
>>>>> Did not get, what you mean by " dbg->arch.bp missing" ?
>>>> dbg->arch.bp is an array of a certain size. If nb_hw_breakpoint +
>>>> nb_hw_watchpoint > ARRAY_SIZE(dbg->arch.bp) we might overwrite memory
>>>> we don't want to overwrite.
>>> Actually this will never overflow here because nb_hw_breakpoint and
>> nb_hw_watchpoint overflow in taken care in in hw_insert_breakpoint().
>>> Do you thing that to be double safe we can add a check?
>> We only check against an overflow of hw_breakpoint[], not dbg->arch.bp.
>> What if nb_hw_breakpoint becomes 17?
> nb_hw_breakpoint can never be more than max_hw_breakpoint, how nb_hw_breakpoint can be 17 ?
Someone comes along and bumps up max_hw_breakpoint to 17? Just add an
assert() somewhere that makes sure we can't run over bp :).
Alex
next prev parent reply other threads:[~2014-06-17 11:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1402988887-30418-1-git-send-email-Bharat.Bhushan@freescale.com>
[not found] ` <1402988887-30418-4-git-send-email-Bharat.Bhushan@freescale.com>
2014-06-17 8:15 ` [Qemu-devel] [PATCH 3/3 v2] ppc debug: Add debug stub support Alexander Graf
2014-06-17 9:14 ` Bharat.Bhushan
2014-06-17 9:49 ` Alexander Graf
2014-06-17 10:40 ` Bharat.Bhushan
2014-06-17 10:43 ` Alexander Graf
2014-06-17 11:01 ` Bharat.Bhushan
2014-06-17 11:03 ` Alexander Graf [this message]
2014-06-17 11:05 ` Bharat.Bhushan
2014-06-17 11:07 ` Alexander Graf
2014-06-18 4:39 ` Bharat.Bhushan
2014-06-24 11:31 ` Alexander Graf
2014-06-24 11:32 ` Bharat.Bhushan
2014-06-24 11:34 ` Alexander Graf
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=53A02064.8040804@suse.de \
--to=agraf@suse.de \
--cc=Bharat.Bhushan@freescale.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).