From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: andrew.cooper3@citrix.com, andre.przywara@linaro.org,
xen-devel@lists.xen.org
Subject: Re: [PATCH 3/3] xen/arm: Don't crash the domain on invalid HVC immediate
Date: Tue, 30 Jan 2018 18:26:15 +0000 [thread overview]
Message-ID: <a8c3b9fd-667e-dedd-200b-9e94d8f5ad08@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1801301019190.11958@sstabellini-ThinkPad-X260>
On 30/01/18 18:24, Stefano Stabellini wrote:
> On Tue, 30 Jan 2018, Julien Grall wrote:
>> domain_crash_synchronous() should only be used when something went wrong
>> in Xen. It is better to inject to the guest as it will be in better
> ^ a better
>
>
>> position to provide helpful information (stack trace...).
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>>
>> ---
>>
>> We potentially want to return -1 instead. This would make Xen more
>> future-proof if we decide to implement the other HVC immediate.
>> ---
>> xen/arch/arm/traps.c | 13 ++++++++-----
>> 1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 843adf4959..18da45dff3 100644
>> --- a/xen/arch/arm/traps.c
>> +++ b/xen/arch/arm/traps.c
>> @@ -1473,14 +1473,17 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
>> #endif
>>
>> static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
>> - unsigned long iss)
>> + const union hsr hsr)
>> {
>> arm_hypercall_fn_t call = NULL;
>>
>> BUILD_BUG_ON(NR_hypercalls < ARRAY_SIZE(arm_hypercall_table) );
>>
>> - if ( iss != XEN_HYPERCALL_TAG )
>> - domain_crash_synchronous();
>> + if ( hsr.iss != XEN_HYPERCALL_TAG )
>> + {
>> + gprintk(XENLOG_WARNING, "Invalid HVC imm 0x%x\n", hsr.iss);
>> + return inject_undef_exception(regs, hsr);
>
> It looks a bit weird, given that inject_undef_exception doesn't return
> anything. This is just code style so anyway:
I followed coding style in other part of the emulation (see do_sysreg
for instance). I am happy to change that though.
Cheers,
>
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>
>
>> + }
>>
>> if ( *nr >= ARRAY_SIZE(arm_hypercall_table) )
>> {
>> @@ -2150,7 +2153,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
>> if ( hsr.iss == 0 )
>> return do_trap_hvc_smccc(regs);
>> nr = regs->r12;
>> - do_trap_hypercall(regs, &nr, hsr.iss);
>> + do_trap_hypercall(regs, &nr, hsr);
>> regs->r12 = (uint32_t)nr;
>> break;
>> }
>> @@ -2164,7 +2167,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
>> #endif
>> if ( hsr.iss == 0 )
>> return do_trap_hvc_smccc(regs);
>> - do_trap_hypercall(regs, ®s->x16, hsr.iss);
>> + do_trap_hypercall(regs, ®s->x16, hsr);
>> break;
>> case HSR_EC_SMC64:
>> /*
>> --
>> 2.11.0
>>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-01-30 18:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 16:14 [PATCH 0/3] xen/arm: Inject an exception to the guest rather than crashing it Julien Grall
2018-01-30 16:14 ` [PATCH 1/3] xen/arm: io: Distinguish unhandled IO from aborted one Julien Grall
2018-01-30 18:14 ` Stefano Stabellini
2018-01-30 18:31 ` Julien Grall
2018-01-30 19:09 ` Stefano Stabellini
2018-01-31 12:17 ` Julien Grall
2018-02-01 0:39 ` Stefano Stabellini
2018-01-30 16:14 ` [PATCH 2/3] xen/arm: Don't crash domain on bad MMIO emulation Julien Grall
2018-01-30 18:18 ` Stefano Stabellini
2018-01-30 16:14 ` [PATCH 3/3] xen/arm: Don't crash the domain on invalid HVC immediate Julien Grall
2018-01-30 18:24 ` Stefano Stabellini
2018-01-30 18:26 ` Julien Grall [this message]
2018-01-30 16:38 ` [PATCH 0/3] xen/arm: Inject an exception to the guest rather than crashing it Andrew Cooper
2018-01-30 17:00 ` Julien Grall
2018-01-30 18:29 ` Andrew Cooper
2018-01-30 18:46 ` Julien Grall
2018-01-30 19:09 ` Andrew Cooper
2018-01-30 19:21 ` Stefano Stabellini
2018-01-30 19:23 ` Andrew Cooper
2018-01-31 11:53 ` Julien Grall
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=a8c3b9fd-667e-dedd-200b-9e94d8f5ad08@arm.com \
--to=julien.grall@arm.com \
--cc=andre.przywara@linaro.org \
--cc=andrew.cooper3@citrix.com \
--cc=sstabellini@kernel.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 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).