[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v3 1/7] plugins: fix mem callback array size
From: |
Xingtao Yao (Fujitsu) |
Subject: |
RE: [PATCH v3 1/7] plugins: fix mem callback array size |
Date: |
Tue, 2 Jul 2024 01:52:00 +0000 |
> -----Original Message-----
> From: qemu-devel-bounces+yaoxt.fnst=fujitsu.com@nongnu.org
> <qemu-devel-bounces+yaoxt.fnst=fujitsu.com@nongnu.org> On Behalf Of
> Pierrick Bouvier
> Sent: Tuesday, July 2, 2024 9:10 AM
> To: qemu-devel@nongnu.org
> Cc: Eduardo Habkost <eduardo@habkost.net>; Alex Bennée
> <alex.bennee@linaro.org>; Pierrick Bouvier <pierrick.bouvier@linaro.org>;
> Paolo
> Bonzini <pbonzini@redhat.com>; Philippe Mathieu-Daudé <philmd@linaro.org>;
> Alexandre Iooss <erdnaxe@crans.org>; Richard Henderson
> <richard.henderson@linaro.org>; Mahmoud Mandour <ma.mandourr@gmail.com>
> Subject: [PATCH v3 1/7] plugins: fix mem callback array size
>
> data was correctly copied, but size of array was not set
> (g_array_sized_new only reserves memory, but does not set size).
>
> As a result, callbacks were not called for code path relying on
> plugin_register_vcpu_mem_cb().
>
> Found when trying to trigger mem access callbacks for atomic
> instructions.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> accel/tcg/plugin-gen.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
> index b6bae32b997..ec89a085b43 100644
> --- a/accel/tcg/plugin-gen.c
> +++ b/accel/tcg/plugin-gen.c
> @@ -85,8 +85,7 @@ static void gen_enable_mem_helper(struct qemu_plugin_tb
> *ptb,
> len = insn->mem_cbs->len;
> arr = g_array_sized_new(false, false,
> sizeof(struct qemu_plugin_dyn_cb), len);
> - memcpy(arr->data, insn->mem_cbs->data,
> - len * sizeof(struct qemu_plugin_dyn_cb));
> + g_array_append_vals(arr, insn->mem_cbs->data, len);
> qemu_plugin_add_dyn_cb_arr(arr);
>
> tcg_gen_st_ptr(tcg_constant_ptr((intptr_t)arr), tcg_env,
> --
> 2.39.2
>
Reviewed-by: Xingtao Yao <yaoxt.fnst@fujitsu.com>
- [PATCH v3 0/7] plugins: access values during a memory read/write, Pierrick Bouvier, 2024/07/01
- [PATCH v3 1/7] plugins: fix mem callback array size, Pierrick Bouvier, 2024/07/01
- RE: [PATCH v3 1/7] plugins: fix mem callback array size,
Xingtao Yao (Fujitsu) <=
- [PATCH v3 2/7] plugins: save value during memory accesses, Pierrick Bouvier, 2024/07/01
- [PATCH v3 5/7] tests/tcg: allow to check output of plugins, Pierrick Bouvier, 2024/07/01
- [PATCH v3 6/7] tests/plugin/mem: add option to print memory accesses, Pierrick Bouvier, 2024/07/01
- [PATCH v3 7/7] tests/tcg/x86_64: add test for plugin memory access, Pierrick Bouvier, 2024/07/01
- [PATCH v3 3/7] plugins: extend API to get latest memory value accessed, Pierrick Bouvier, 2024/07/01
- [PATCH v3 4/7] tests/tcg: add mechanism to run specific tests with plugins, Pierrick Bouvier, 2024/07/01
- Re: [PATCH v3 0/7] plugins: access values during a memory read/write, Pierrick Bouvier, 2024/07/02