[Crash-utility] Re: [PATCH] Fix irq_stack_size on ARM64

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

 



Hi Yeping,

On Fri, Jul 19, 2024 at 2:02 PM <wonderzyp@xxxxxxxxx> wrote:
>
> Hi Tao,
> I'm sorry I forget my vmlinux is with IKCONFIG enabled, so yesterday's test did not cover the branch where tbnz is located.
>
> > Thank you for the improvements to the patch.
> > I have verified this patch and found no problems. After applying this patch, command bt -a
> > will not cause segfault issue, and the irq_stack_size in crash tools has correct value.
>
> I found that that patch not work well due to this lines:
> > +                                     thread_shift = stol(pos2 + 1,
> > +                                                     RETURN_ON_ERROR|QUIET,
> > +                                                     &errflag);
> By disable the `QUIET` flag, the crash tool output error:
>   crash: not a valid number: 15, 0xffffffc00801081c <vectors+28>
>
Yeah, thanks for the testing, it is indeed a failure.

> I think stol() function cannot extract a single digit from char* with non-numeric characters, so I use sscanf() in following patch which can work well.

Understood. The reason I didn't use sscanf, is that currently the
disassembly gives us a decimal value as #15, so we can sscanf it by
"%ld". What about somehow the disassembly gives us hex values like:
#0xe? It won't work by then. Any ideas for this?

In addition, let's just wait a while to see Lianbo's idea about the
tbnz approach. If he doesn't accept this approach then we don't need
to improve on this.

Thanks,
Tao Liu
>
> ---
>  arm64.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/arm64.c b/arm64.c
> index 81c4eeb..26af590 100644
> --- a/arm64.c
> +++ b/arm64.c
> @@ -5031,16 +5031,12 @@ static ulong arm64_set_irq_stack_size(void)
>                 while (fgets(buf1, BUFSIZE, pc->tmpfile)) {
>                         if ((pos1 = strstr(buf1, "tbnz"))) {
>                                 if ((pos2 = strchr(pos1, '#'))) {
> -                                       thread_shift = stol(pos2 + 1,
> -                                                       RETURN_ON_ERROR|QUIET,
> -                                                       &errflag);
> -                                       if (errflag) {
> -                                               thread_shift = 0;
> -                                       } else if (CRASHDEBUG(1)) {
> -                                               error(INFO, "Detect thread shift"
> -                                               " via tbnz %ld\n", thread_shift);
> +                                       if (sscanf(pos2 + 1, "%ld", &thread_shift) == 1) {
> +                                               if (CRASHDEBUG(1)){
> +                                                       error(INFO, "Detect thread shift via tbnz %ld\n", thread_shift);
> +                                               }
> +                                               break;
>                                         }
> -                                       break;
>                                 }
>                         }
>                 }
> --
> 2.25.1
>
> Thanks,
> Yeping.ZHENG
> --
> Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines: https://github.com/crash-utility/crash/wiki
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
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