qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 26/29] contrib/plugins: extend execlog to track register chang


From: Peter Maydell
Subject: Re: [PULL 26/29] contrib/plugins: extend execlog to track register changes
Date: Fri, 8 Mar 2024 13:21:56 +0000

On Wed, 28 Feb 2024 at 12:00, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> With the new plugin register API we can now track changes to register
> values. Currently the implementation is fairly dumb which will slow
> down if a large number of register values are being tracked. This
> could be improved by only instrumenting instructions which mention
> registers we are interested in tracking.
>

Hi; Coverity complains about a possible NULL dereference
in this code (CID 1534929):

> @@ -153,8 +224,39 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct 
> qemu_plugin_tb *tb)
>              }
>          }
>
> +        /*
> +         * Check the disassembly to see if a register we care about
> +         * will be affected by this instruction. This relies on the
> +         * dissembler doing something sensible for the registers we
> +         * care about.
> +         */
> +        if (disas_assist && rmatches) {
> +            check_regs_next = false;
> +            gchar *args = g_strstr_len(insn_disas, -1, " ");

g_strstr_len() can return NULL if it doesn't find the
string being searched for...

> +            for (int n = 0; n < all_reg_names->len; n++) {
> +                gchar *reg = g_ptr_array_index(all_reg_names, n);
> +                if (g_strrstr(args, reg)) {

...but it's not valid to pass NULL as the argument to
g_strrstr().

> +                    check_regs_next = true;
> +                    skip = false;
> +                }
> +            }
> +        }

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]