-----Original Message-----
在 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?
Yes, it look like crash doesn't have a description of the prohibited gdb
commands, that would be kind to users.
Anyway, I've merged this first. (with editing the commit message a bit)
https://github.com/crash-utility/crash/commit/f30c5075de1b2600240d3613f78...
Thanks,
Kazu