[Crash-utility] [PATCH] Do not pass through the 'sy' command to GDB

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Tue Mar 23 06:11:06 UTC 2021


Hi Lianbo,

-----Original Message-----
> The 'sy' command may be misused, which is mistakenly considered as
> the 'symbol-file' command in the crash utility, this will discard
> symbol table from the current symbol file, and eventually caused the
> failure of crash utility after executing the 'sys' command as below:
> 
> crash> sy
> GNU_GET_DATATYPE[sy]: returned via gdb_error_hook
> Discard symbol table from `/usr/lib/debug/usr/lib/modules/5.11.0-2.el9.x86_64/vmlinux'? (y or n) Please
> answer y or n.
> Discard symbol table from `/usr/lib/debug/usr/lib/modules/5.11.0-2.el9.x86_64/vmlinux'? (y or n) No symbol
> file now.
> crash> sys
> GNU_GET_SYMBOL_TYPE: returned via gdb_error_hook
> double free or corruption (!prev)
> Aborted (core dumped)
> 
> Actually, the 'symbol-file' command has been added to the gdb-prohibited
> list. To prevent current error, let's add the 'sy' command to the list
> so that the crash utility does not pass the 'sy' command directly to GDB.
> 
> Signed-off-by: Lianbo Jiang <lijiang at redhat.com>

ok, thanks.

Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>

I'm afraid that this kind of patch work can be endless, as gdb accepts
abbreviations of its commands.  but this is the first one I see and
likely to hit it accidentally, I ack this patch.

However, if similar issues are reported, it would be good to think about
a better way. (e.g. prefix matching?  I'm not sure if it's feasible and
they're worth taking efforts to fix..)

Thanks,
Kazu

> ---
>  gdb_interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb_interface.c b/gdb_interface.c
> index f4f4dd3993db..1f10006a2d63 100644
> --- a/gdb_interface.c
> +++ b/gdb_interface.c
> @@ -702,7 +702,7 @@ static char *prohibited_list[] = {
>  	"clear", "disable", "enable", "condition", "ignore", "frame",
>  	"select-frame", "f", "up", "down", "catch", "tcatch", "return",
>  	"file", "exec-file", "core-file", "symbol-file", "load", "si", "ni",
> -	"shell",
> +	"shell", "sy",
>  	NULL  /* must be last */
>  };
> 
> --
> 2.29.2





More information about the Crash-utility mailing list