* riscv: g_assert for NULL predicate?
@ 2023-04-03 13:42 Wu, Fei
2023-04-05 6:06 ` Alistair Francis
0 siblings, 1 reply; 3+ messages in thread
From: Wu, Fei @ 2023-04-03 13:42 UTC (permalink / raw)
To: open list:RISC-V TCG CPUs, qemu-devel, bmeng, fei2.wu
Recent commit 0ee342256af92 switches to g_assert() for the predicate()
NULL check from returning RISCV_EXCP_ILLEGAL_INST. Qemu doesn't have
predicate() for un-allocated CSRs, then a buggy userspace application
reads CSR such as 0x4 causes qemu to exit, I don't think it's expected.
.global _start
.text
_start:
csrr t3, 0x4
Thanks,
Fei.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: riscv: g_assert for NULL predicate?
2023-04-03 13:42 riscv: g_assert for NULL predicate? Wu, Fei
@ 2023-04-05 6:06 ` Alistair Francis
2023-04-11 3:44 ` Bin Meng
0 siblings, 1 reply; 3+ messages in thread
From: Alistair Francis @ 2023-04-05 6:06 UTC (permalink / raw)
To: Wu, Fei; +Cc: open list:RISC-V TCG CPUs, qemu-devel, bmeng
On Mon, Apr 3, 2023 at 11:43 PM Wu, Fei <fei2.wu@intel.com> wrote:
>
> Recent commit 0ee342256af92 switches to g_assert() for the predicate()
> NULL check from returning RISCV_EXCP_ILLEGAL_INST. Qemu doesn't have
> predicate() for un-allocated CSRs, then a buggy userspace application
> reads CSR such as 0x4 causes qemu to exit, I don't think it's expected.
Hm.... That's not good. Userspace shouldn't be able to crash QEMU. I
think we want to revert that patch then.
@Bin Meng any thoughts?
Alistair
>
> .global _start
>
> .text
> _start:
> csrr t3, 0x4
>
> Thanks,
> Fei.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: riscv: g_assert for NULL predicate?
2023-04-05 6:06 ` Alistair Francis
@ 2023-04-11 3:44 ` Bin Meng
0 siblings, 0 replies; 3+ messages in thread
From: Bin Meng @ 2023-04-11 3:44 UTC (permalink / raw)
To: Alistair Francis; +Cc: Wu, Fei, open list:RISC-V TCG CPUs, qemu-devel, bmeng
On Wed, Apr 5, 2023 at 2:07 PM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Mon, Apr 3, 2023 at 11:43 PM Wu, Fei <fei2.wu@intel.com> wrote:
> >
> > Recent commit 0ee342256af92 switches to g_assert() for the predicate()
> > NULL check from returning RISCV_EXCP_ILLEGAL_INST. Qemu doesn't have
> > predicate() for un-allocated CSRs, then a buggy userspace application
> > reads CSR such as 0x4 causes qemu to exit, I don't think it's expected.
>
> Hm.... That's not good. Userspace shouldn't be able to crash QEMU. I
> think we want to revert that patch then.
>
> @Bin Meng any thoughts?
>
Agree, I will send a patch for this.
Regards,
Bin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-11 3:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 13:42 riscv: g_assert for NULL predicate? Wu, Fei
2023-04-05 6:06 ` Alistair Francis
2023-04-11 3:44 ` Bin Meng
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).