[Crash-utility] Re: arm64: Fix bt command show wrong stacktrace on ramdump source

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

 



On Tue, Jul 23, 2024 at 5:18 PM cb126yx <cb126yx@xxxxxxx> wrote:

Signed-off-by: bevis_chen <bevis_chen@xxxxxxxx>

---

 arm64.c | 27 +++++++++++++++++++++++++++

 1 file changed, 27 insertions(+)


diff --git a/arm64.c b/arm64.c

index b3040d7..50dd458 100644

--- a/arm64.c

+++ b/arm64.c

@@ -92,6 +92,7 @@ static void arm64_get_crash_notes(void);

 static void arm64_calc_VA_BITS(void);

 static int arm64_is_uvaddr(ulong, struct task_context *);

 static void arm64_calc_KERNELPACMASK(void);

+static void arm64_recalc_KERNELPACMASK(void);

 static int arm64_get_vmcoreinfo(unsigned long *vaddr, const char *label, int base);


 struct kernel_range {

@@ -581,6 +582,17 @@ arm64_init(int when)

                if (!machdep->hz)

                        machdep->hz = 100;


+               /*

+               * In the case of using ramdump rather than vmcore,

+               * will fail to parse out KERNELPAC.

+               * So we check if the "sturct ptrauth_keys_kernel" exits

+               * as a basis for whether PAC feature is enabled or not.

+               * If yes, then we use vabits to figure out pac bitmask.

+               */

+               if(!machdep->machspec->CONFIG_ARM64_KERNELPACMASK)

+                       arm64_recalc_KERNELPACMASK();

+

+

                arm64_irq_stack_init();

                arm64_overflow_stack_init();

                arm64_stackframe_init();

@@ -4921,6 +4933,21 @@ static void arm64_calc_KERNELPACMASK(void)

        }

 }


+

+#define GENMASK_UL(h, l) \

+    (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))

+

+static void arm64_recalc_KERNELPACMASK(void){

+       /* arm64: check if pac already enabled yet from related structure.*/

+       if (STRUCT_EXISTS("ptrauth_keys_kernel") && machdep->machspec->VA_BITS_ACTUAL){

+               machdep->machspec->CONFIG_ARM64_KERNELPACMASK =

+                       GENMASK_UL(63, machdep->machspec->VA_BITS_ACTUAL);

+               if (CRASHDEBUG(1))

+                       fprintf(fp, "CONFIG_ARM64_KERNELPACMASK: %lx\n",

+                               machdep->machspec->CONFIG_ARM64_KERNELPACMASK);

+       }

+}

+

 
Thank you for the update, and the above changes are fine to me.

Let's see if Tao has any comments.

Thanks
Lianbo 

 #endif  /* ARM64 */

--
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