Re: [PATCH] Fix the failure of resolving ".rodata" on s390x

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

 



Hi,

lijiang <lijiang@xxxxxxxxxx> writes:

> On Tue, Mar 29, 2022 at 2:05 PM lijiang <lijiang@xxxxxxxxxx> wrote:
>
>> On Tue, Mar 29, 2022 at 1:22 PM Alexander Egorenkov <
>> egorenar@xxxxxxxxxxxxx> wrote:
>>
>>> Hi,
>>>
>>> Lianbo Jiang <lijiang@xxxxxxxxxx> 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@xxxxxxxxxxxxx>
>>> > Signed-off-by: Lianbo Jiang <lijiang@xxxxxxxxxx>
>>> > ---
>>> >  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] == '.')
>>
> This Message Is From an External Sender 
> This message came from outside your organization. 
> On Tue, Mar 29, 2022 at 2:05 PM lijiang <lijiang@xxxxxxxxxx> wrote:
>
>  On Tue, Mar 29, 2022 at 1:22 PM Alexander Egorenkov <egorenar@xxxxxxxxxxxxx> wrote:
>
>  Hi,
>
>  Lianbo Jiang <lijiang@xxxxxxxxxx> 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@xxxxxxxxxxxxx>
>  > Signed-off-by: Lianbo Jiang <lijiang@xxxxxxxxxx>
>  > ---
>  >  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] == '.') 

Looks good to me.
Tested on s390x, works with get_linux_banner_from_vmlinux().

Thanks!
Regards
Alex

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux