Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash fails to load on ARM64 live kernel #54

Open
vijaybalakrishna opened this issue Jun 23, 2020 · 14 comments
Open

crash fails to load on ARM64 live kernel #54

vijaybalakrishna opened this issue Jun 23, 2020 · 14 comments

Comments

@vijaybalakrishna
Copy link

vijaybalakrishna commented Jun 23, 2020

crash 7.2.8 fails to load on ARM64 live kernel on 5.4.

# uname -a
Linux com7 5.4.42-xxxxxxxx-standard #1 SMP Wed Jun 3 05:17:19 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
# crash -s /proc/kcore vmlinux-stable-master-dev54
crash: /proc/kcore: cannot read vabits_actual

Is this a known issue? Currently when reading of vabits_actual symbol value from /proc/kallsyms isn't successful crash returns error (FATAL), instead should it continue to read tcr_el1_t1sz from VMCOREINFO to determine vabits_actual? Please share your thoughts.

Made a small source change to calculate the vabits_actual from vmcoreinfo's tcr_el1_t1sz, with the change I can load crash on live kernel. Tried few sample crash commands, they all seem to work.

# git diff arm64.c
diff --git a/arm64.c b/arm64.c
index 7662d71..d8515b2 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3869,10 +3869,11 @@ arm64_calc_VA_BITS(void)
                                machdep->machspec->VA_BITS = value;
                                machdep->machspec->VA_START = _VA_START(machdep->machspec->VA_BITS_ACTUAL);
                        } else
-                               error(FATAL, "/proc/kcore: cannot read vabits_actual\n");
+                               error(WARNING, "/proc/kcore: cannot read vabits_actual\n");
                } else if (ACTIVE())
                        error(FATAL, "cannot determine VA_BITS_ACTUAL: please use /proc/kcore\n");
-               else {
+
+               if (!machdep->machspec->VA_BITS_ACTUAL) {
                        if ((string = pc->read_vmcoreinfo("NUMBER(tcr_el1_t1sz)"))) {
                                /* See ARMv8 ARM for the description of
                                 * TCR_EL1.T1SZ and how it can be used

com5:/tmp# /tmp/crash -s /proc/kcore /tmp/vmlinux
WARNING: /proc/kcore: cannot read vabits_actual
crash> sys
      KERNEL: /tmp/vmlinux
    DUMPFILE: /proc/kcore
        CPUS: 8
        DATE: Mon Jun 22 23:24:53 2020
      UPTIME: 00:28:21
LOAD AVERAGE: 0.14, 0.05, 0.01
       TASKS: 138
    NODENAME: com5
     RELEASE: 5.4.44-xxxxxxxx-standard
     VERSION: #1 SMP Sat Jun 20 00:55:50 UTC 2020
     MACHINE: aarch64  (unknown Mhz)
      MEMORY: 7.8 GB
crash>
@vijaybalakrishna vijaybalakrishna changed the title crash fails to load live kernel on ARM64 crash fails to load on live kernel on ARM64 Jun 24, 2020
@vijaybalakrishna vijaybalakrishna changed the title crash fails to load on live kernel on ARM64 crash fails to load on ARM64 live kernel Jun 24, 2020
@bhupesh-sharma
Copy link

bhupesh-sharma commented Jun 26, 2020 via email

@vijaybalakrishna
Copy link
Author

Hi Bhupesh,

Thanks for taking a look. We already have your kernel patch
https://lkml.org/lkml/2020/5/13/1348

Definition of vabits_actual

u64 __section(".mmuoff.data.write") vabits_actual;
EXPORT_SYMBOL(vabits_actual);

I wonder if type of symbols defined above are in /proc/kallsyms. From my testing on ARM64 5.4 live kernel, symbol_value_from_proc_kallsyms("vabits_actual") call fails (returns BADVAL), hence crash (live) fails with FATAL error. With your patch we can determine vabits_actual from VMCOREINFO's tcr_el1_t1sz, crash (live kernel) shouldn't error (FATAL), IIUC.

Thanks,
VIjay

@vijaybalakrishna
Copy link
Author

Did some more digging. I rebuild kernel with KALLSYMS_ALL config, which lets symbols from data section in /proc/kallsyms, now I can load crash on ARM64 live kernel.

Before moving to 5.4 kernel we ran with 4.19 and crash loaded fine on live kernel. We didn't have KALLSYMS_ALL config enabled in 4.19.

# zcat /proc/config.gz | egrep -e CONFIG_KALLSYMS_ALL -e CONFIG_DEBUG_KERNEL
CONFIG_KALLSYMS_ALL=y
CONFIG_DEBUG_KERNEL=y
# grep vabits_actual /proc/kallsyms
ffff800010ca3a08 r __ksymtab_vabits_actual
ffff800010cb9ce7 r __kstrtab_vabits_actual
ffff8000110ee010 D vabits_actual
overlakedevcom6:~# crash -s /proc/kcore /tmp/vmlinux
strings: standard output: Broken pipe
crash> sys
      KERNEL: /tmp/vmlinux
    DUMPFILE: /proc/kcore
        CPUS: 8
        DATE: Sat Jun 27 05:56:56 2020
      UPTIME: 00:12:46
LOAD AVERAGE: 0.13, 0.04, 0.01
       TASKS: 155
    NODENAME: com6
     RELEASE: 5.4.44-xxxxxxxx-standard
     VERSION: #1 SMP Sat Jun 27 05:05:09 UTC 2020
     MACHINE: aarch64  (unknown Mhz)
      MEMORY: 7.8 GB
crash>

@bhupesh-sharma
Copy link

bhupesh-sharma commented Jun 29, 2020 via email

@vijaybalakrishna
Copy link
Author

First phase of support of the upcoming ARM64 kernel memory map patch introduced KALLSYMS_ALL dependency for running crash on ARM64 live kernel.

@tiger20081015
Copy link

@vijaybalakrishna , could you pls tell me how to build crash binary running on arm64 host? I used make target=ARM64 but it still can only run in x86. Thanks.

@bhupesh-sharma
Copy link

bhupesh-sharma commented Jul 14, 2020 via email

@tiger20081015
Copy link

@bhupesh-sharma ,thanks for your reply!
Actually I'm trying to compile the crash binary on the x86 host, while the binary aims to run on arm64 host. Is there any method to do this?

@santoshx
Copy link

@bhupesh-sharma ,thanks for your reply!
Actually I'm trying to compile the crash binary on the x86 host, while the binary aims to run on arm64 host. Is there any method to do this?

For that you need a cross compiler.

@vijaybalakrishna
Copy link
Author

vijaybalakrishna commented Jul 15, 2020 via email

@vijaybalakrishna
Copy link
Author

vijaybalakrishna commented Jul 15, 2020 via email

@bhupesh-sharma
Copy link

bhupesh-sharma commented Jul 15, 2020 via email

@bhupesh-sharma
Copy link

bhupesh-sharma commented Jul 15, 2020 via email

@tiger20081015
Copy link

@bhupesh-sharma
I‘ve already set up crash for case 1. What I’m trying to do is live-analysis on arm64 host. I have some knowledge of cross compilation and already got arm64 cross compile tool chain. But I don't know how to add cross compile build for crash tool. Could you please give more detailed steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants