[Crash-utility] [PATCH] Fix the failure of resolving ".rodata" on s390x

lijiang lijiang at redhat.com
Tue Mar 29 06:10:49 UTC 2022


On Tue, Mar 29, 2022 at 2:05 PM lijiang <lijiang at redhat.com> wrote:

> On Tue, Mar 29, 2022 at 1:22 PM Alexander Egorenkov <
> egorenar at linux.ibm.com> wrote:
>
>> Hi,
>>
>> Lianbo Jiang <lijiang at redhat.com> writes:
>>
>> > The commit <cd8954023bd4> broke crash-utility on s390x and got the
>> > following error:
>> >
>> >   crash: cannot resolve ".rodata"
>> >
>> > The reason is that all symbols containing a "." may be filtered out
>> > on s390x. To prevent the current failure, a simple way is to check
>> > whether the symbol ".rodata" exists before calculating the value of
>> > a symbol.
>> >
>> > Fixes: cd8954023bd4 ("kernel: fix start-up time degradation caused by
>> strings command")
>> > Reported-by: Alexander Egorenkov <egorenar at linux.ibm.com>
>> > Signed-off-by: Lianbo Jiang <lijiang at redhat.com>
>> > ---
>> >  kernel.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> >
>> > diff --git a/kernel.c b/kernel.c
>> > index 92434a3ffe2d..b504564846c7 100644
>> > --- a/kernel.c
>> > +++ b/kernel.c
>> > @@ -11790,6 +11790,9 @@ int get_linux_banner_from_vmlinux(char *buf,
>> size_t size)
>> >       struct bfd_section *sect;
>> >       long offset;
>> >
>> > +     if (!symbol_exists(".rodata"))
>> > +             return FALSE;
>> > +
>> >       sect = bfd_get_section_by_name(st->bfd, ".rodata");
>> >       if (!sect)
>> >               return FALSE;
>> > --
>> > 2.20.1
>>
>> thanks! This works on s390x.
>>
>

Sorry, my reply was truncated. How about the following changes?


>
>
diff --git a/kernel.c b/kernel.c
> index 92434a3ffe2d..b504564846c7 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -11790,6 +11790,9 @@ int get_linux_banner_from_vmlinux(char *buf,
> size_t size)
>   struct bfd_section *sect;
>   long offset;
>
> + if (!symbol_exists(".rodata"))
> + return FALSE;
> +
>   sect = bfd_get_section_by_name(st->bfd, ".rodata");
>   if (!sect)
>   return FALSE;
> diff --git a/s390.c b/s390.c
> index 078b1a25724e..42f5cc63ae52 100644
> --- a/s390.c
> +++ b/s390.c
> @@ -442,6 +442,9 @@ s390_verify_symbol(const char *name, ulong value, char
> type)
>   if (strstr(name, "L2\002") == name)
>       return FALSE;
>
> + if (STREQ(name, ".rodata"))
> + return TRUE;
> +
>   /* throw away all symbols containing a '.' */
>   for(i = 0; i < strlen(name);i++){
>   if(name[i] == '.')
> diff --git a/s390x.c b/s390x.c
> index c07d283d7f52..d7ee3755fc0b 100644
> --- a/s390x.c
> +++ b/s390x.c
> @@ -1087,6 +1087,9 @@ s390x_verify_symbol(const char *name, ulong value,
> char type)
>   if (strstr(name, "L2\002") == name)
>       return FALSE;
>
> + if (STREQ(name, ".rodata"))
> + return TRUE;
> +
>   /* throw away all symbols containing a '.' */
>   for(i = 0; i < strlen(name);i++){
>   if(name[i] == '.')
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20220329/c89e8726/attachment.htm>


More information about the Crash-utility mailing list