在 2021年03月23日 14:11, HAGIO KAZUHITO(萩尾 一仁) 写道:
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(a)redhat.com>
ok, thanks.
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Thank you for the comment, Kazu.
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.
Agree with you. It can not cover all cases that users intentionally input
the 'wrong' commands, but it could be necessary to prevent the critical
error by the accidental input.
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..)
The command name abbreviations are useful in the GDB, but for the crash-utility,
need to carefully cope with this feature.
It could not be worth covering all cases about this issue as we mentioned above.
So far, I haven't found a good way to fix these problems. Maybe we could provide
a document to clarify such issues?
Thanks.
Lianbo
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