[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/93] tcg: Manage splitwx in tc_ptr_to_region_tree by han
From: |
Richard Henderson |
Subject: |
Re: [PATCH v2 04/93] tcg: Manage splitwx in tc_ptr_to_region_tree by hand |
Date: |
Thu, 4 Feb 2021 09:17:33 -1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 2/4/21 8:45 AM, Alex Bennée wrote:
>
> Richard Henderson <richard.henderson@linaro.org> writes:
>
>> On 2/4/21 5:01 AM, Alex Bennée wrote:
>>>
>>> Richard Henderson <richard.henderson@linaro.org> writes:
>>>
>>>> The use in tcg_tb_lookup is given a random pc that comes from the pc
>>>> of a signal handler. Do not assert that the pointer is already within
>>>> the code gen buffer at all, much less the writable mirror of it.
>>>
>>> Surely we are asserting that - or at least you can find a rt entry for
>>> the pointer passed (which we always expect to work)?
>>
>> What? No. The pointer could be anything at all, depending on any other bug
>> within qemu.
>
> But you do assert it:
>
> struct tcg_region_tree *rt = tc_ptr_to_region_tree(tb->tc.ptr);
>
> g_assert(rt != NULL);
>
> and rt is only NULL when it's !in_code_gen_buffer(p).
>
> In tcg_tb_lookup you haven't removed an assert - you just ensure you
> don't fail if it's not.
I see your confusion. The arbitrary pointer is the one that is presented to
tcg_tb_lookup, and passed on to tc_ptr_to_region_tree.
The (dynamic) assert has been removed by not calling tcg_splitwx_to_rw in
tc_ptr_to_region_tree, as called from tcg_tb_lookup.
But tcg_tb_insert and tcg_tb_remove do not receive arbitrary pointers -- they
always get a TranslationBlock. So I retain an assert along those paths. (As
opposed to SEGV on the next lines, I suppose.)
Suggestions on how to reword the commit? Just include most of the above?
r~
[PATCH v2 08/93] tcg/tci: Inline tci_write_reg32s into the only caller, Richard Henderson, 2021/02/03
[PATCH v2 09/93] tcg/tci: Inline tci_write_reg8 into its callers, Richard Henderson, 2021/02/03
[PATCH v2 05/93] tcg/tci: Make tci_tb_ptr thread-local, Richard Henderson, 2021/02/03
[PATCH v2 10/93] tcg/tci: Inline tci_write_reg16 into the only caller, Richard Henderson, 2021/02/03
[PATCH v2 06/93] tcg/tci: Implement INDEX_op_ld16s_i32, Richard Henderson, 2021/02/03
[PATCH v2 07/93] tcg/tci: Implement INDEX_op_ld8s_i64, Richard Henderson, 2021/02/03
[PATCH v2 11/93] tcg/tci: Inline tci_write_reg32 into all callers, Richard Henderson, 2021/02/03
[PATCH v2 13/93] tcg/tci: Merge INDEX_op_ld8u_{i32,i64}, Richard Henderson, 2021/02/03
[PATCH v2 17/93] tcg/tci: Merge INDEX_op_{ld_i32,ld32u_i64}, Richard Henderson, 2021/02/03