Skip to content

Kernel panic #20

Closed
Closed
@kloenk

Description

@kloenk
Member

When including the rust_example driver (not as module) I get a kernel panic:

[    0.487414][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc2+ #3
[    0.487414][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-48-gd9c812d4
[    0.487414][    T1] RIP: 0010:__memcpy+0x12/0x20
[    0.487414][    T1] Code: 8c 94 00 00 74 0a c7 05 a8 8c 94 00 0f 00 00 00 c3 31 c0 c3 cc cc cc cc 0f 14
[    0.487414][    T1] RSP: 0000:ffffbcf0400133b8 EFLAGS: 00010202
[    0.487414][    T1] RAX: ffffbcf040013496 RBX: 00000000000003d2 RCX: 000000000000007a
[    0.487414][    T1] RDX: 0000000000000002 RSI: 3674fd8948f23948 RDI: ffffbcf040013496
[    0.487414][    T1] RBP: ffffbcf0400133d0 R08: 0000000000000000 R09: ffffbcf040013480
[    0.487414][    T1] R10: 0000000000000123 R11: ffffffff89997710 R12: ffffffff8a812258
[    0.487414][    T1] R13: ffffffff8a5eadd0 R14: ffffbcf040013480 R15: ffffbcf040013898
[    0.487414][    T1] FS:  0000000000000000(0000) GS:ffffa04c87a00000(0000) knlGS:0000000000000000
[    0.487414][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.487414][    T1] CR2: 0000000000000000 CR3: 0000000005c0a000 CR4: 00000000000006f0
[    0.487414][    T1] Call Trace:
[    0.487414][    T1]  ? do_one_initcall+0xb8/0x250
[    0.487414][    T1]  ? alloc_pages_current+0x10a/0x1b0
[    0.487414][    T1]  ? allocate_slab+0xf7/0x4c0
[    0.487414][    T1]  ? ida_alloc_range+0x391/0x3d0
[    0.487414][    T1]  ? parse_one+0x53/0x270
[    0.487414][    T1]  ? do_initcall_level+0x88/0x88
[    0.487414][    T1]  ? parse_args+0x118/0x220
[    0.487414][    T1]  ? do_initcall_level+0x88/0x88
[    0.487414][    T1]  ? do_initcall_level+0x7e/0x88
[    0.487414][    T1]  ? do_initcalls+0x44/0x6d
[    0.487414][    T1]  ? kernel_init_freeable+0xd6/0x11d
[    0.487414][    T1]  ? rest_init+0xa0/0xa0
[    0.487414][    T1]  ? kernel_init+0x5/0x180
[    0.487414][    T1]  ? ret_from_fork+0x22/0x30
[    0.487414][    T1] Modules linked in:
[    0.515297][    T1] ---[ end trace 13ad6358da39c417 ]---
[    0.516114][    T1] RIP: 0010:__memcpy+0x12/0x20
[    0.516796][    T1] Code: 8c 94 00 00 74 0a c7 05 a8 8c 94 00 0f 00 00 00 c3 31 c0 c3 cc cc cc cc 0f 1f 44 00 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 84
[    0.519649][    T1] RSP: 0000:ffffbcf0400133b8 EFLAGS: 00010202
[    0.520539][    T1] RAX: ffffbcf040013496 RBX: 00000000000003d2 RCX: 000000000000007a
[    0.521701][    T1] RDX: 0000000000000002 RSI: 3674fd8948f23948 RDI: ffffbcf040013496
[    0.522875][    T1] RBP: ffffbcf0400133d0 R08: 0000000000000000 R09: ffffbcf040013480
[    0.524036][    T1] R10: 0000000000000123 R11: ffffffff89997710 R12: ffffffff8a812258
[    0.525198][    T1] R13: ffffffff8a5eadd0 R14: ffffbcf040013480 R15: ffffbcf040013898
[    0.526361][    T1] FS:  0000000000000000(0000) GS:ffffa04c87a00000(0000) knlGS:0000000000000000
[    0.527666][    T1] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.528626][    T1] CR2: 0000000000000000 CR3: 0000000005c0a000 CR4: 00000000000006f0
[    0.529790][    T1] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    0.530780][    T1] Kernel Offset: 0x8400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[    0.530780][    T1] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Config and kernel console here: https://gist.github.com/Kloenk/aad17db1adc313ec49a51712c03060b0

Activity

ojeda

ojeda commented on Oct 5, 2020

@ojeda
Member

Edit: never mind, I didn't read the trace. There is this in the log above the panic:

[    0.486964][    T1] general protection fault: 0000 [#1] SMP PTI

and it comes while running the initialization for the example module (do_one_initcall). We get as far as printing:

[    0.484220][    T1] Rust Example (init)
[    0.484794][    T1] Am I built-in? true
[    0.485380][    T1] Parameters:
[    0.485876][    T1]   my_bool:  true
[    0.486425][    T1]   my_i32:   42

and then it crashes while copying some memory. Let me try to reproduce it.

kloenk

kloenk commented on Oct 5, 2020

@kloenk
MemberAuthor

Here is my initrd, if you want to use it.
initrd.cpio.gz

ojeda

ojeda commented on Oct 5, 2020

@ojeda
Member

Reproduced with LLVM 10 on my side.

kloenk

kloenk commented on Oct 5, 2020

@kloenk
MemberAuthor

Mine was llvm11, as packages in my nix flake

added a commit that references this issue on Nov 26, 2020
096dd7c
ojeda

ojeda commented on Nov 26, 2020

@ojeda
Member

@kloenk Can you please confirm #28 fixes this for you?

added a commit that references this issue on Nov 27, 2020
13f2876
added 2 commits that reference this issue on Nov 28, 2020

Merge pull request #28 from Rust-for-Linux/rust-fix-panic

7a8a400
437822b

15 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ojeda@kloenk

        Issue actions

          Kernel panic · Issue #20 · Rust-for-Linux/linux