Skip to contentSkip to conversation

NX-protected page

DISCUSSION JerryJun 5 participants 12 messages Jan 22, 2024 – May 20, 2024

lore
Share & tools
lore

JerryJun

author
#0 lore raw

hi, xenomai:

we use a small xenomai application reproduct NX-protected page question , it will appear within 12 hours. please give me a hint;

the application is implemented to create multiple RT task which set affinity of the 2 cpu, prio 90 and manual bootstrap , perform FFT only occuiped CPU with rt_sleep, which be killed a few seconds later.

the kernel oops appear when kill the application.

kernel version: linux: 5.10.199 xenomai:3.2.4

hardware: Supermicro Super Server/C422-SF

(the litte project and kernel-config by attached this email)

backtrace as follow , producted it by decode_stacktrace tool :

[41358.701739] kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
[41358.701740] BUG: unable to handle page fault for address: ffff88810cec6000
[41358.701740] #PF: supervisor instruction fetch in kernel mode
[41358.701740] #PF: error_code(0x0011) - permissions violation
[41358.701741] PGD 2801067 P4D 2801067 PUD 100f6a063 PMD 10dd59063 PTE 800000010cec6063
[41358.701742] Oops: 0011 [#1] PREEMPT SMP NOPTI IRQ_PIPELINE
[41358.701742] CPU: 0 PID: 13323 Comm: oop-test Kdump: loaded Not tainted 5.10.199-dovetail-xenomai-3.2.4-20231214 #1
[41358.701743] Hardware name: Supermicro Super Server/C422-SF, BIOS E906.1 04/27/2021
[41358.701743] IRQ stage: Linux
[41358.701743] RIP: 0010:0xffff88810cec6000
[41358.701744] RSP: 0018:ffffc90000003eb8 EFLAGS: 00010202
[41358.701745] RAX: 0000000000000023 RBX: ffffc90007bbfe20 RCX: 00000000410f42d9
[41358.701745] RDX: ffffc90007bbfe28 RSI: ffffffff81e956a5 RDI: ffffc90007bbfe20
[41358.701745] RBP: 0000000000000022 R08: ffffc90000003f64 R09: 0000000000000038
[41358.701745] R10: 0000259d90f3f400 R11: 00000000000020fd R12: 0000000000000020
[41358.701746] R13: 0000000000000038 R14: ffffffff810cb2e0 R15: 0000000000000000
[41358.701746] FS:  00007f30b1ced780(0000) GS:ffff888860000000(0000) knlGS:0000000000000000
[41358.701746] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[41358.701747] CR2: ffff88810cec6000 CR3: 0000000102f64002 CR4: 00000000001706f0
[41358.701747] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[41358.701747] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[41358.701747] Call Trace:
[41358.701748]  <IRQ>
[41358.701748] ? __die_body.cold (arch/x86/kernel/dumpstack.c:482 arch/x86/kernel/dumpstack.c:469 arch/x86/kernel/dumpstack.c:424) 
[41358.701748] ? no_context (arch/x86/mm/fault.c:761) 
[41358.701748] ? exc_page_fault (arch/x86/mm/fault.c:1512 arch/x86/mm/fault.c:1570) 
[41358.701749] ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:626) 
[41358.701749] ? handle_oob_irq (kernel/irq/pipeline.c:204) 
[41358.701749] ? irq_work_single (./arch/x86/include/asm/atomic.h:196 ./include/asm-generic/atomic-instrumented.h:655 kernel/irq_work.c:160) 
[41358.701749] ? irq_work_run_list (kernel/irq_work.c:174 (discriminator 6)) 
[41358.701750] ? irq_work_run (kernel/irq_work.c:185) 
[41358.701750] ? inband_work_interrupt (kernel/irq/pipeline.c:1680) 
[41358.701750] ? handle_synthetic_irq (./arch/x86/include/asm/atomic.h:29 ./include/linux/jump_label.h:254 ./include/linux/jump_label.h:264 ./include/trace/events/irq.h:83 kernel/irq/pipeline.c:234) 
[41358.701750] ? arch_do_IRQ_pipelined (arch/x86/kernel/irq_pipeline.c:187) 
[41358.701750] ? handle_oob_irq (kernel/irq/pipeline.c:204) 
[41358.701751] ? sync_current_irq_stage (./arch/x86/include/asm/irqflags.h:54 kernel/irq/pipeline.c:1360) 
[41358.701751] ? inband_irq_enable (./arch/x86/include/asm/irqflags.h:46 ./arch/x86/include/asm/irqflags.h:80 kernel/irq/pipeline.c:309 kernel/irq/pipeline.c:338) 
[41358.701751] ? __do_softirq (./arch/x86/include/asm/bitops.h:297 kernel/softirq.c:286) 
[41358.701751] ? handle_oob_irq (kernel/irq/pipeline.c:204) 
[41358.701752] ? asm_call_irq_on_stack (arch/x86/entry/entry_64.S:811) 
[41358.701752]  </IRQ>
[41358.701752] ? do_softirq_own_stack (./arch/x86/include/asm/irq_stack.h:34 ./arch/x86/include/asm/irq_stack.h:84 arch/x86/kernel/irq_64.c:77) 
[41358.701752] ? irq_exit_rcu (kernel/softirq.c:393 kernel/softirq.c:423 kernel/softirq.c:435) 
[41358.701752] ? arch_do_IRQ_pipelined (arch/x86/kernel/irq_pipeline.c:168 arch/x86/kernel/irq_pipeline.c:188) 
[41358.701753] ? sync_current_irq_stage (./arch/x86/include/asm/irqflags.h:54 kernel/irq/pipeline.c:1360) 
[41358.701753] ? inband_irq_restore (./arch/x86/include/asm/irqflags.h:46 ./arch/x86/include/asm/irqflags.h:80 kernel/irq/pipeline.c:309 kernel/irq/pipeline.c:400) 
[41358.701753] ? _raw_spin_unlock_irqrestore (./include/linux/spinlock_api_smp.h:161 kernel/locking/spinlock.c:191) 
[41358.701753] ? __set_cpus_allowed_ptr (kernel/sched/core.c:1961) 
[41358.701754] ? sched_setaffinity (kernel/sched/core.c:6047) 
[41358.701754] ? __x64_sys_sched_setaffinity (kernel/sched/core.c:6098 kernel/sched/core.c:6087 kernel/sched/core.c:6087) 
[41358.701754] ? do_syscall_64 (arch/x86/entry/common.c:55) 
[41358.701754] ? entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:132) 
[41358.701755] Modules linked in: fuse md4 sha512_ssse3 sha512_generic cmac nls_utf8 cifs libarc4 dns_resolver fscache libdes intel_rapl_msr intel_rapl_common skx_edac x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper rapl intel_cstate snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio ast drm_vram_helper drm_ttm_helper ttm snd_hda_intel snd_intel_dspcfg snd_hda_codec drm_kms_helper snd_hda_core snd_pcsp drm snd_hwdep snd_pcm fb_sys_fops intel_uncore syscopyarea sysfillrect snd_timer ipmi_si snd sysimgblt soundcore mei_me iTCO_wdt joydev iTCO_vendor_support sg ipmi_devintf ioatdma mei ipmi_msghandler evdev button parport_pc ppdev lp parport ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 hid_generic usbhid hid sd_mod t10_pi crc32c_intel i40e ahci xhci_pci libahci xhci_hcd libata atlantic igb i2c_i801 i2c_algo_bit i2c_smbus macsec dca usbcore scsi_mod
[41358.701771]  usb_common wmi
[41358.701771] CR2: ffff88810cec6000

​

#1 lore raw
Quoted 8 lines · JerryJun

hi, xenomai:

we use a small xenomai application reproduct NX-protected page question , it will appear within 12 hours. please give me a hint;

the application is implemented to create multiple RT task which set affinity of the 2 cpu, prio 90 and manual bootstrap , perform FFT only occuiped CPU with rt_sleep, which be killed a few seconds later.

the kernel oops appear when kill the application.

What exactly needs to be done to reproduce the issue with your code?

Also, does the hardware play a role, or can you reproduce it in a qemu-amd64 instance as well?

Already checked if there are differences when using [1] from xenomai-images?

Thanks,
Jan

[1]
https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads

author
#2 lore raw

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 22 lines · Jan Kiszka
Quoted 8 lines · JerryJun

hi, xenomai:

we use a small xenomai application reproduct NX-protected page question , it will appear within 12 hours. please give me a hint;

the application is implemented to create multiple RT task which set affinity of the 2 cpu, prio 90 and manual bootstrap , perform FFT only occuiped CPU with rt_sleep, which be killed a few seconds later.

the kernel oops appear when kill the application.

What exactly needs to be done to reproduce the issue with your code?

Also, does the hardware play a role, or can you reproduce it in a qemu-amd64 instance as well?

Already checked if there are differences when using [1] from xenomai-images?

Thanks,
Jan

[1]
https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads

#3 lore raw
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

Jan

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#4 lore raw
Quoted 59 lines · Jan Kiszka
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 3 lines

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2
#
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
author
#5 lore raw

how long did you run it?it will take a while for this crash but not more than 12 hours at mostly. ok,i will try to run it without get /proc……
thank you very much.

Quoted 114 lines · Jan Kiszka
Quoted 59 lines · Jan Kiszka
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 3 lines

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2
#
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#6 lore raw
Quoted 5 lines · JerryJun

how long did you run it?it will take a while for this crash but not more than 12 hours at mostly. ok,i will try to run it without get /proc……
thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 116 lines
Quoted 114 lines · Jan Kiszka
Quoted 59 lines · Jan Kiszka
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 3 lines

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2
#
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
author
#7 lore raw

yet, I've tried to run it without get /proc/xenomai/sched/stat , but it still trigger the same kernel panic. seemly , get proc is not main reason causing the crash. definitely, you probably need run it for hours to trigger panic, and the crash will not occur immediately within 30 minutes.

Quoted 131 lines · At 2024-02-02 16:37:59,"Jan Kiszka" <[email protected]>, said:
Quoted 5 lines · JerryJun

how long did you run it?it will take a while for this crash but not more than 12 hours at mostly. ok,i will try to run it without get /proc……
thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 116 lines
Quoted 114 lines · Jan Kiszka
Quoted 59 lines · Jan Kiszka
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 3 lines

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2
#
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
author
#8 lore raw
In reply to Jan Kiszka

hi, Jan, if you have reproducted it after trying to run the case for hours in qemu? or is there any doubt?

2024-02-02 16:37:59, "Jan Kiszka" <[email protected]> wrote:
Quoted 131 lines · JerryJun
Quoted 5 lines

how long did you run it?it will take a while for this crash but not more than 12 hours at mostly. ok,i will try to run it without get /proc……
thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 116 lines
Quoted 114 lines · Jan Kiszka
Quoted 59 lines · Jan Kiszka
Quoted 48 lines · JerryJun

yet, you just do make in the project to product the binary of oop-test, run kill_test.sh , and finally wait kernel oop .
we get the same results of kernel oop in the qemu-amd64, which use the config from xenomai-images ,"https://source.denx.de/Xenomai/xenomai-images/-/blob/master/recipes-kernel/linux/files/amd64_defconfig?ref_type=heads", as follow.

[ 6191.671953] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 6191.671955] #PF: supervisor instruction fetch in kernel mode
[ 6191.671956] #PF: error_code(0x0010) - not-present page
[ 6191.671956] PGD 0 P4D 0
[ 6191.671958] Oops: 0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE
[ 6191.671959] CPU: 3 PID: 7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1
[ 6191.671960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[ 6191.671961] IRQ stage: Linux
[ 6191.671961] RIP: 0010:0x0
[ 6191.671962] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246
[ 6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX: 0000000000000000
[ 6191.671964] RDX: ffff888108d3d738 RSI: ffffffff82516284 RDI: ffff888108d3d730
[ 6191.671965] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
[ 6191.671965] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 6191.671966] R13: 0000000000000018 R14: ffffffff811d37e0 R15: 0000000000000000
[ 6191.671967] FS:  00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000
[ 6191.671967] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6191.671968] CR2: ffffffffffffffd6 CR3: 0000000106750005 CR4: 0000000000170ee0
[ 6191.671968] Call Trace:
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9
[ 6191.671969]  ? irq_work_single+0x42/0x80
[ 6191.671969]  ? __die_body.cold+0x8/0xd
[ 6191.671970]  ? no_context+0x13a/0x270
[ 6191.671970]  ? exc_page_fault+0x6f/0x200
[ 6191.671970]  ? asm_exc_page_fault+0x1e/0x30
[ 6191.671970]  ? handle_oob_irq+0x90/0x90
[ 6191.671971]  irq_work_single+0x42/0x80
[ 6191.671971]  irq_work_run_list+0x2d/0x40
[ 6191.671971]  irq_work_run+0x26/0x40
[ 6191.671972]  inband_work_interrupt+0xa/0x20
[ 6191.671972]  handle_synthetic_irq+0xb1/0x210
[ 6191.671972]  asm_call_irq_on_stack+0x12/0x20
[ 6191.671973]  </IRQ>
[ 6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0
[ 6191.671973]  sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70
[ 6191.671974]  _raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230
[ 6191.671975]  sched_setaffinity+0x383/0x6b0
[ 6191.671975]  __x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50
[ 6191.671978]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617
[ 6191.671979] Code: 1f 40 00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00
Quoted 9 lines
[ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[ 6191.671981] RAX: ffffffffffffffda RBX: 00007fc6e7b985c8 RCX: 00007fc6e84d6617
[ 6191.671982] RDX: 00007fc6e7b985f0 RSI: 0000000000000080 RDI: 0000000000001b8d
[ 6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09: 00000000ffffffff
[ 6191.671983] R10: fffffffffffffdca R11: 0000000000000206 R12: 000055a818eb61c0
[ 6191.671983] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 6191.671984] Modules linked in:
[ 6191.671985] CR2: 0000000000000000
Quoted 3 lines

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2
#
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
Signature · 2 lines
Siemens AG, Technology
Linux Expert Center
#9 lore raw

Hi,

just so you know, we're looking at this issue.
Which cmdline did you use? Was xenomai.supported_cpus set?
In the meantime, if you have more information or if you have been able to create a simplified application where the bug still occurs, please let us know.

Best
Clara

Quoted 166 lines

-----Original Message-----
From: JerryJun <[email protected]>
Sent: Montag, 26. Februar 2024 15:34
To: Kiszka, Jan (T CED) <[email protected]>
Cc: xenomai <[email protected]>
Subject: Re:Re: NX-protected page

hi, Jan, if you have reproducted it after trying to run the case for hours in qemu? or is there any doubt?

2024-02-02 16:37:59, "Jan Kiszka" <[email protected]> wrote:
Quoted 3 lines · JerryJun
Quoted 2 lines

how long did you run it?it will take a while for this crash but not more than

12 hours at mostly.

Quoted 12 lines
Quoted 2 lines

ok,i will try to run it without get /proc…… thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 5 lines
Quoted 3 lines · Jan Kiszka
Quoted 2 lines · Jan Kiszka
Quoted 1 line · JerryJun

yet, you just do make in the project to product the binary of oop-test,

run kill_test.sh , and finally wait kernel oop .

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

we get the same results of kernel oop in the qemu-amd64, which use

the config from xenomai-images ,"https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou rce.denx.de%2FXenomai%2Fxenomai-images%2F- %2Fblob%2Fmaster%2Frecipes- kernel%2Flinux%2Ffiles%2Famd64_defconfig%3Fref_type%3Dheads&data=0 5%7C02%7Cclara.kowalsky%40siemens.com%7C494bca636f6c48566cc208d c36d843eb%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C6384 45549672638180%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&s data=xOckYYYOkjKZ3yKchy4B7kkX2eth%2Bqe88Mrd7XjldFw%3D&reserved= 0", as follow.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[ 6191.671953] BUG: kernel NULL pointer dereference, address:

0000000000000000 [ 6191.671955] #PF: supervisor instruction fetch in kernel mode [ 6191.671956] #PF: error_code(0x0010) - not-present page [ 6191.671956] PGD 0 P4D 0 [ 6191.671958] Oops:
0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE [ 6191.671959] CPU: 3 PID:
7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1 [ 6191.671960] Hardware name:

QEMU

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 [ 6191.671961] IRQ stage: Linux [ 6191.671961] RIP: 0010:0x0 [ 6191.671962] Code: Unable to access opcode bytes at RIP

0xffffffffffffffd6.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246 [

6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX:
0000000000000000 [ 6191.671964] RDX: ffff888108d3d738 RSI:
ffffffff82516284 RDI: ffff888108d3d730 [ 6191.671965] RBP:
0000000000000000 R08: 0000000000000000 R09:

0000000000000001 [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671965] R10: 0000000000000000 R11: 0000000000000001

R12:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

0000000000000000 [ 6191.671966] R13: 0000000000000018 R14:
ffffffff811d37e0 R15: 0000000000000000 [ 6191.671967] FS:
00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000 [ 6191.671967] CS: 0010 DS: 0000 ES:

0000 CR0: 0000000080050033 [ 6191.671968] CR2: ffffffffffffffd6 CR3:
0000000106750005 CR4: 0000000000170ee0 [ 6191.671968] Call Trace:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9 [ 6191.671969]  ?
irq_work_single+0x42/0x80 [ 6191.671969]  ?
__die_body.cold+0x8/0xd [ 6191.671970]  ? no_context+0x13a/0x270

[

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

6191.671970] ? exc_page_fault+0x6f/0x200 [ 6191.671970] ?

asm_exc_page_fault+0x1e/0x30 [ 6191.671970]  ?
handle_oob_irq+0x90/0x90 [

6191.671971] irq_work_single+0x42/0x80

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
[ 6191.671971]  irq_work_run_list+0x2d/0x40 [ 6191.671971]
irq_work_run+0x26/0x40 [ 6191.671972]
inband_work_interrupt+0xa/0x20 [ 6191.671972]
handle_synthetic_irq+0xb1/0x210 [ 6191.671972]
asm_call_irq_on_stack+0x12/0x20 [ 6191.671973]  </IRQ> [
6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0 [ 6191.671973]
sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70 [ 6191.671974]
_raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230 [

6191.671975]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
sched_setaffinity+0x383/0x6b0 [ 6191.671975]
__x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50 [ 6191.671978]
entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617 [ 6191.671979] Code: 1f

40

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00 [ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206

ORIG_RAX:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

00000000000000cb [ 6191.671981] RAX: ffffffffffffffda RBX:
00007fc6e7b985c8 RCX: 00007fc6e84d6617 [ 6191.671982] RDX:
00007fc6e7b985f0 RSI: 0000000000000080 RDI:

0000000000001b8d [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09:

00000000ffffffff [ 6191.671983] R10: fffffffffffffdca R11:
0000000000000206 R12: 000055a818eb61c0 [ 6191.671983] R13:
0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 6191.671984] Modules linked in:

Quoted 60 lines
Quoted 53 lines
Quoted 53 lines
Quoted 6 lines
Quoted 2 lines
[ 6191.671985] CR2: 0000000000000000

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2 #
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Quoted 3 lines
Quoted 3 lines

--
Siemens AG, Technology
Linux Expert Center

--
Siemens AG, Technology
Linux Expert Center

author
#10 lore raw

Thank you so much for keeping an eye on this.
Yes, we do use xenomai.supported_cpus = 0xf but we bind the real-time thread to cpu2
You can repeat this problem in the attachment. As can be seen from backtrace, this problem is related to the rt_set_affinity API. After we removed this rt_set_affinity API, it returned to normal, but we do not know the reason We ran this test on other kernels and got some results from Crash analysis by kdump. We don't know if this will help us solve the problem

      KERNEL: vmlinux-4.19.89-ipipe-9-xenomai-3.1-20201027
    DUMPFILE: V10-5T/202403231347/dump.202403231347  [PARTIAL DUMP]
        CPUS: 4
        DATE: Sat Mar 23 13:47:22 2024
      UPTIME: 05:29:52
LOAD AVERAGE: 0.86, 0.67, 0.68
       TASKS: 436
    NODENAME: debian
     RELEASE: 4.19.89-ipipe-9-xenomai-3.1-20201027
     VERSION: #1 SMP PREEMPT Tue Oct 27 19:51:52 CST 2020
     MACHINE: x86_64  (3600 Mhz)
      MEMORY: 31.7 GB
       PANIC: "BUG: unable to handle kernel paging request at 00000000000a22e8"
         PID: 26821
     COMMAND: "rtThread"
        TASK: ffff888791bc0040  [THREAD_INFO: ffff888791bc0040]

         CPU: 2

       STATE: TASK_RUNNING (PANIC)
crash_pageoffset> bt -s
PID: 26821  TASK: ffff888791bc0040  CPU: 2   COMMAND: "rtThread"
 #0 [ffff88885fe03d10] machine_kexec+337 at ffffffff81041051
 #1 [ffff88885fe03d58] __crash_kexec+104 at ffffffff810f2818
 #2 [ffff88885fe03e20] crash_kexec+56 at ffffffff810f39d8
 #3 [ffff88885fe03e38] oops_end+186 at ffffffff8101795a
 #4 [ffff88885fe03e58] no_context+439 at ffffffff8104b2a7
 #5 [ffff88885fe03eb0] __do_page_fault+162 at ffffffff8104b8b2
 #6 [ffff88885fe03f28] ___xnsched_run+507 at ffffffff811838cb
 #7 [ffff88885fe03f60] xnintr_core_clock_handler+540 at ffffffff8117cddc
 #8 [ffff88885fe03fa0] dispatch_irq_head+126 at ffffffff8111953e
 #9 [ffff88885fe03fc8] __ipipe_handle_irq+103 at ffffffff81037f07
#10 [ffff88885fe03ff0] apic_timer_interrupt+18 at ffffffff81801d22
--- <IRQ stack> ---
bt: cannot transition from IRQ stack to current process stack:
        IRQ stack pointer: ffff88885fe03d10
    process stack pointer: ffff88885fe03c10
       current stack base: ffffc90005a30000

 crash> dis -l ___xnsched_run
linux-4.19.89-ipipe-9-xenomai-3.1/kernel/xenomai/sched.c: 1042                                                if (shadow && ipipe_root_p) 0xffffffff81183887 <___xnsched_run+439>:        test   %r15d,%r15d
0xffffffff8118388a <___xnsched_run+442>:        je     0xffffffff811838b7 <___xnsched_run+487> linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 331                                      ipipe_get_current_domain
0xffffffff8118388c <___xnsched_run+444>:        pushfq
0xffffffff8118388d <___xnsched_run+445>:        pop    %rdx
linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 261
0xffffffff8118388e <___xnsched_run+446>:        cli
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 331
0xffffffff8118388f <___xnsched_run+447>:        mov    $0xa2260,%rax
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 269
0xffffffff81183896 <___xnsched_run+454>:        mov    %gs:0x7ee8b93a(%rip),%rcx  # 0xf1d8                   return __ipipe_raw_cpu_read(ipipe_percpu.curr);
                      RCX: ffffffff828021c0       ffffffff828021c0:  0000000000042e80
0xffffffff8118389e <___xnsched_run+462>:        mov    (%rax,%rcx,1),%rax
0xffffffff811838a2 <___xnsched_run+466>:        mov    0x42e70(%rax),%rax                                    return __ipipe_get_current_context()->domain; linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 336
0xffffffff811838a9 <___xnsched_run+473>:        push   %rdx
0xffffffff811838aa <___xnsched_run+474>:        popfq
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 334
0xffffffff811838ab <___xnsched_run+475>:        cmp    $0xffffffff825f8940,%rax
0xffffffff811838b1 <___xnsched_run+481>:        je   0xffffffff81183b06 <___xnsched_run+1078>
                                                goto shadow_epilogue;
linux-4.19.89-ipipe-9-xenomai-3.1/include/xenomai/cobalt/kernel/sched.h: 372
0xffffffff811838b7 <___xnsched_run+487>:        mov    $0xa4540,%rdi                        0xffffffff811838be <___xnsched_run+494>:        add    %gs:0x7ee8b912(%rip),%rdi   # 0xf1d8 linux-4.19.89-ipipe-9-xenomai-3.1/kernel/xenomai/sched.c: 1052                                                            xnthread_switch_fpu(sched); 0xffffffff811838c6 <___xnsched_run+502>:        callq  0xffffffff81189eb0 <xnthread_switch_fpu> linux-4.19.89-ipipe-9-xenomai-3.1/include/xenomai/cobalt/kernel/trace.h: 84
0xffffffff811838cb <___xnsched_run+507>:        mov    $0x1,%r15d

[78270.764791] BUG: unable to handle kernel paging request at 00000000000a22e8
[78270.771791] PGD 0 P4D 0
[78270.774375] Oops: 0000 [#1] PREEMPT SMP NOPTI
[78270.778769] CPU: 2 PID: 26821 Comm: RunCommandActor Kdump: loaded Tainted: P           O      4.19.89-ipipe-9-xenomai-3.1-20201027 #1
[78270.790893] Hardware name: Supermicro Super Server/C422-SF, BIOS E906.1 04/27/2021
[78270.798536] I-pipe domain: Linux
[78270.801787] RIP: a2260:0xffff88885fe1c560
[78270.805834] Code: 00 00 00 00 00 00 00 00 00 00 c0 8f ea 5f 88 88 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <01> 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00
[78270.824763] RSP: 81037f07:00000000000a2260 EFLAGS: ffff88885fe1c560 ORIG_RAX: ffffffff8111953e
[78270.833421] RAX: 00000000000a2260 RBX: 0000000000000002 RCX: ffffffff828021c0
[78270.840596] RDX: ffff88885fe1c560 RSI: 0000000000000000 RDI: 0000000000000000
[78270.847790] RBP: ffff88885fea4540 R08: 000000000005f3e0 R09: 000000000000fe0c                          
[78270.854984] R10: ffffffff8117cddc R11: 0000000000000002 R12: ffff88885fea5d08                     
[78270.862185] R13: ffffe8ffffc079c8 R14: ffff88885fea4540 R15: ffffffff811838cb                      
[78270.869335] FS:  00007fe12237c700(0000) GS:ffff88885fe00000(0000) knlGS:0000000000000000       
[78270.877499] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[78270.883298] CR2: 00000000000a22e8 CR3: 0000000852a06006 CR4: 00000000001606e0
[78270.890465] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[78270.897658] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[78270.904843] Call Trace:
[78270.996185] CR2: 00000000000a22e8

From the backtrace above, based on the value stored in the CPU register at the time of the kernel crash, the location where the page fault was triggered appears to be at ___xnsched_run+507. Kernel crash occurs with RAX value 0xa2260 from <___xnsched_run+447>: mov $0xa2260,%rax. The value of the GS register is ffff88885fe00000, the address of the percpu variable in CPU2. crash> kmem -o
PER-CPU OFFSET VALUES:
CPU 0: ffff88885fc00000
CPU 1: ffff88885fd00000
CPU 2: ffff88885fe00000
CPU 3: ffff88885ff00000

The RDX register has the value ffff88885fe1c560, which is the address of the ipipe_percpu variable in CPU2 crash> p ipipe_percpu
PER-CPU DATA TYPE:
struct ipipe_percpu_data ipipe_percpu;
PER-CPU ADDRESSES:
[0]: ffff88885fc1c560
[1]: ffff88885fd1c560
[2]: ffff88885fe1c560
[3]: ffff88885ff1c560

<___xnsched_run+454>:  mov %gs:0x7ee8b93a(%rip),%rcx # 0xf1d8 namely __ipipe_raw_cpu_read(iPipe_percpu.curr) The member of curr is obtained through the ipipe_percpu variable crash> ipipe_percpu_data ffff88885fe1c560 -o
struct ipipe_percpu_data {
[ffff88885fe1c560] struct ipipe_percpu_domain_data root;
[ffff88885fe5f3e0] struct ipipe_percpu_domain_data head;
[ffff88885fea2260] struct ipipe_percpu_domain_data *curr;
[ffff88885fea2268] struct pt_regs tick_regs;
[ffff88885fea2310] int hrtimer_irq;
[ffff88885fea2318] struct task_struct *task_hijacked;
[ffff88885fea2320] struct task_struct *rqlock_owner;
[ffff88885fea2328] struct ipipe_vm_notifier *vm_notifier;
[ffff88885fea2330] unsigned long nmi_state;
[ffff88885fea2338] struct mm_struct *active_mm;
}
SIZE: 548320

RIP a2260:0xffff88885fe1c560 is the location of ipipe_percpu.curr,
CR2 00000000000a22e8 Stores the linear address of the page fault when it occurs, which points to the ip member of the struct pt_regs from below, and the value of the GS segment register + CR2 register is ffff88885fea22e8. crash_pageoffset> struct pt_regs ffff88885fea2268 -o
struct pt_regs {
[ffff88885fea2268] unsigned long r15;
[ffff88885fea2270] unsigned long r14;
[ffff88885fea2278] unsigned long r13;
[ffff88885fea2280] unsigned long r12;
[ffff88885fea2288] unsigned long bp;
[ffff88885fea2290] unsigned long bx;
[ffff88885fea2298] unsigned long r11;
[ffff88885fea22a0] unsigned long r10;
[ffff88885fea22a8] unsigned long r9;
[ffff88885fea22b0] unsigned long r8;
[ffff88885fea22b8] unsigned long ax;
[ffff88885fea22c0] unsigned long cx;
[ffff88885fea22c8] unsigned long dx;
[ffff88885fea22d0] unsigned long si;
[ffff88885fea22d8] unsigned long di;
[ffff88885fea22e0] unsigned long orig_ax;
[ffff88885fea22e8] unsigned long ip;
[ffff88885fea22f0] unsigned long cs;
[ffff88885fea22f8] unsigned long flags;
[ffff88885fea2300] unsigned long sp;
[ffff88885fea2308] unsigned long ss;
}
SIZE: 168

<___xnsched_run+475>:  cmp $0xffffffff825f8940,%rax Where $0xffffffff825f8940 is the address of the ipipe_percpu_domain_data root variable in root mode.
The contents of the register when the kernel crashes appear to be the root domain when executing __ipipe_current_domain == ipipe_root_domain to determine whether the domain is the root domain at this time. A crash occurs when obtaining the ip member of pt_regs on the percpu variable ipipe_percpu_data. At present, the rtThread real-time thread is bound to run in CPU2, and the switch from xenomai mode to linux mode occurs during the run time. From this log, is the kernel crash caused by a mode switch? Here are some of the meanings of CPU registers:
R08 5f3e0: Indicates the offset of ipipe_percpu.head
a2260: indicates the offset of ipipe_percpu.curr
RBP ffff88885fea4540: struct xnsched nksched
R12 ffff88885fea5d08: xnsched.current_account
0xffff88885fe1c560: struct ipipe_percpu_data
RCX FFFFFF828021C0: The value is 0000000000042e80

Quoted 175 lines · Clara

Hi,

just so you know, we're looking at this issue.
Which cmdline did you use? Was xenomai.supported_cpus set?
In the meantime, if you have more information or if you have been able to create a simplified application where the bug still occurs, please let us know.

Best
Clara

Quoted 166 lines

-----Original Message-----
From: JerryJun <[email protected]>
Sent: Montag, 26. Februar 2024 15:34
To: Kiszka, Jan (T CED) <[email protected]>
Cc: xenomai <[email protected]>
Subject: Re:Re: NX-protected page

hi, Jan, if you have reproducted it after trying to run the case for hours in qemu? or is there any doubt?

2024-02-02 16:37:59, "Jan Kiszka" <[email protected]> wrote:
Quoted 3 lines · JerryJun
Quoted 2 lines

how long did you run it?it will take a while for this crash but not more than

12 hours at mostly.

Quoted 12 lines
Quoted 2 lines

ok,i will try to run it without get /proc…… thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 5 lines
Quoted 3 lines · Jan Kiszka
Quoted 2 lines · Jan Kiszka
Quoted 1 line · JerryJun

yet, you just do make in the project to product the binary of oop-test,

run kill_test.sh , and finally wait kernel oop .

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

we get the same results of kernel oop in the qemu-amd64, which use

the config from xenomai-images ,"https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou rce.denx.de%2FXenomai%2Fxenomai-images%2F- %2Fblob%2Fmaster%2Frecipes- kernel%2Flinux%2Ffiles%2Famd64_defconfig%3Fref_type%3Dheads&data=0 5%7C02%7Cclara.kowalsky%40siemens.com%7C494bca636f6c48566cc208d c36d843eb%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C6384 45549672638180%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&s data=xOckYYYOkjKZ3yKchy4B7kkX2eth%2Bqe88Mrd7XjldFw%3D&reserved= 0", as follow.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[ 6191.671953] BUG: kernel NULL pointer dereference, address:

0000000000000000 [ 6191.671955] #PF: supervisor instruction fetch in kernel mode [ 6191.671956] #PF: error_code(0x0010) - not-present page [ 6191.671956] PGD 0 P4D 0 [ 6191.671958] Oops:
0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE [ 6191.671959] CPU: 3 PID:
7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1 [ 6191.671960] Hardware name:

QEMU

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 [ 6191.671961] IRQ stage: Linux [ 6191.671961] RIP: 0010:0x0 [ 6191.671962] Code: Unable to access opcode bytes at RIP

0xffffffffffffffd6.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246 [

6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX:
0000000000000000 [ 6191.671964] RDX: ffff888108d3d738 RSI:
ffffffff82516284 RDI: ffff888108d3d730 [ 6191.671965] RBP:
0000000000000000 R08: 0000000000000000 R09:

0000000000000001 [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671965] R10: 0000000000000000 R11: 0000000000000001

R12:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

0000000000000000 [ 6191.671966] R13: 0000000000000018 R14:
ffffffff811d37e0 R15: 0000000000000000 [ 6191.671967] FS:
00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000 [ 6191.671967] CS: 0010 DS: 0000 ES:

0000 CR0: 0000000080050033 [ 6191.671968] CR2: ffffffffffffffd6 CR3:
0000000106750005 CR4: 0000000000170ee0 [ 6191.671968] Call Trace:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9 [ 6191.671969]  ?
irq_work_single+0x42/0x80 [ 6191.671969]  ?
__die_body.cold+0x8/0xd [ 6191.671970]  ? no_context+0x13a/0x270

[

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

6191.671970] ? exc_page_fault+0x6f/0x200 [ 6191.671970] ?

asm_exc_page_fault+0x1e/0x30 [ 6191.671970]  ?
handle_oob_irq+0x90/0x90 [

6191.671971] irq_work_single+0x42/0x80

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
[ 6191.671971]  irq_work_run_list+0x2d/0x40 [ 6191.671971]
irq_work_run+0x26/0x40 [ 6191.671972]
inband_work_interrupt+0xa/0x20 [ 6191.671972]
handle_synthetic_irq+0xb1/0x210 [ 6191.671972]
asm_call_irq_on_stack+0x12/0x20 [ 6191.671973]  </IRQ> [
6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0 [ 6191.671973]
sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70 [ 6191.671974]
_raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230 [

6191.671975]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
sched_setaffinity+0x383/0x6b0 [ 6191.671975]
__x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50 [ 6191.671978]
entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617 [ 6191.671979] Code: 1f

40

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00 [ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206

ORIG_RAX:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

00000000000000cb [ 6191.671981] RAX: ffffffffffffffda RBX:
00007fc6e7b985c8 RCX: 00007fc6e84d6617 [ 6191.671982] RDX:
00007fc6e7b985f0 RSI: 0000000000000080 RDI:

0000000000001b8d [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09:

00000000ffffffff [ 6191.671983] R10: fffffffffffffdca R11:
0000000000000206 R12: 000055a818eb61c0 [ 6191.671983] R13:
0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 6191.671984] Modules linked in:

Quoted 60 lines
Quoted 53 lines
Quoted 53 lines
Quoted 6 lines
Quoted 2 lines
[ 6191.671985] CR2: 0000000000000000

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2 #
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Quoted 3 lines
Quoted 3 lines

--
Siemens AG, Technology
Linux Expert Center

--
Siemens AG, Technology
Linux Expert Center

#11 lore raw

Hi all,

I can reproduce this issue - with a slightly different kernel panic - on dovetail 6.9.

As promised in the last Xenomai community call I will share the simplified reproducer application and some logs.

The alchemy application in use is attached, the problematic rt_task_set_affinity() call is currently deactivated. If activated it crashes my qemu instance within 3 sec. You might have to adjust the Makefile a bit to find xeno-config on your system.

As rt_task_set_affinity() makes the difference I'm assuming that something around affine_move_task() is not properly synchronized.

@Philippe, any ideas?

Some more debug info will follow below the kernel crash dump.

xenomai.supported_cpus=3 is part of the kernel cmdline on boot, the test appication tries to set a valid cpu mask (0x1) for the spawned RT tasks.

[  439.848658] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI IRQ_PIPELINE
[  439.848666] CPU: 0 PID: 1364013 Comm: xeno-app Not tainted 6.9.0+ #15
[  439.848670] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[  439.848673] IRQ stage: Linux
[  439.848675] RIP: 0010:srso_return_thunk+0x5/0x5f
[  439.848687] Code: cc cc cc 48 b8 48 8d 64 24 08 c3 cc cc 0f ae e8 e8 f0 ff ff ff 0f 0b 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 e8 db ff ff ff <0f> 0b 66 66 2e 0f 1f 84 00 00
[  439.848689] RSP: 0018:ffffc90000003f88 EFLAGS: 00010286
[  439.848693] RAX: ffffffff81f48065 RBX: ffffc9000eacbdb0 RCX: ffff888005e92408
[  439.848696] RDX: 0000000000000000 RSI: ffff88803e800000 RDI: ffffc9000eacbdb0
[  439.848698] RBP: 0000000000000000 R08: ffff888005e92400 R09: 0000000000000000
[  439.848700] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[  439.848701] R13: 0000000000000000 R14: ffffc900006f3db0 R15: ffff888005cac86c
[  439.848732] FS:  00007f616f850580(0000) GS:ffff88803e800000(0000) knlGS:0000000000000000
[  439.848735] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  439.848737] CR2: 00007f616faa2080 CR3: 00000000049fe000 CR4: 00000000003506f0
[  439.848739] Call Trace:
[  439.848801]  <IRQ>
[  439.848804]  ? die+0x31/0x80
[  439.848813]  ? do_trap+0xd8/0x100
[  439.848817]  ? srso_return_thunk+0x5/0x5f
[  439.848822]  ? do_error_trap+0xf0/0x140
[  439.848825]  ? srso_return_thunk+0x5/0x5f
[  439.848828]  ? srso_return_thunk+0x5/0x5f
[  439.848833]  ? exc_invalid_op+0x90/0xd0
[  439.848837]  ? srso_return_thunk+0x5/0x5f
[  439.848841]  ? asm_exc_invalid_op+0x1a/0x20
[  439.848849]  ? srso_return_thunk+0x5/0x5f
[  439.848853]  ? srso_return_thunk+0x5/0x5f
[  439.848857]  ? srso_return_thunk+0x5/0x5f
[  439.848860]  irq_work_single+0x27/0x60
[  439.848867]  irq_work_run_list+0x2d/0x40
[  439.848870]  irq_work_run+0x18/0x30
[  439.848873]  inband_work_interrupt+0x9/0x20
[  439.848878]  handle_synthetic_irq+0x7a/0x160
[  439.848881]  arch_do_IRQ_pipelined+0x84/0x400
[  439.848887]  </IRQ>
[  439.848888]  <TASK>
[  439.848890]  sync_current_irq_stage+0x111/0x170
[  439.848894]  __inband_irq_enable+0x3e/0x60
[  439.848897]  _raw_spin_unlock_irqrestore+0x1d/0x40
[  439.848900]  affine_move_task+0x104/0x4e0
[  439.848906]  ? __pfx_lostage_task_wakeup+0x10/0x10
[  439.848917]  __set_cpus_allowed_ptr+0x4f/0x90
[  439.848920]  __sched_setaffinity+0x8d/0x100
[  439.848925]  sched_setaffinity+0x166/0x1c0
[  439.848929]  __x64_sys_sched_setaffinity+0x4d/0x80
[  439.848932]  do_syscall_64+0x8d/0x1a0
[  439.848936]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[  439.848940] RIP: 0033:0x7f616f93f037
[  439.848944] Code: 31 c0 48 83 c4 08 c3 0f 1f 40 00 48 8b 15 c1 3d 0e 00 f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48
[  439.848946] RSP: 002b:00007ffc06ff02b8 EFLAGS: 00000206 ORIG_RAX: 00000000000000cb
[  439.848949] RAX: ffffffffffffffda RBX: 00007f616ef892d8 RCX: 00007f616f93f037
[  439.848951] RDX: 00007f616ef892d8 RSI: 0000000000000080 RDI: 000000000014d8be
[  439.848952] RBP: 00007ffc06ff02f0 R08: 0000000000000000 R09: 00000000ffffffff
[  439.848954] R10: 00007ffc06ff00a0 R11: 0000000000000206 R12: 0000000000000000
[  439.848956] R13: 00007ffc06ff0878 R14: 0000563c66118d98 R15: 00007f616fada020
[  439.848962]  </TASK>
[  439.848963] Modules linked in:
[  439.848967] ---[ end trace 0000000000000000 ]---
[  439.848969] RIP: 0010:srso_return_thunk+0x5/0x5f
[  439.848973] Code: cc cc cc 48 b8 48 8d 64 24 08 c3 cc cc 0f ae e8 e8 f0 ff ff ff 0f 0b 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 e8 db ff ff ff <0f> 0b 66 66 2e 0f 1f 84 00 00
[  439.848975] RSP: 0018:ffffc90000003f88 EFLAGS: 00010286
[  439.848977] RAX: ffffffff81f48065 RBX: ffffc9000eacbdb0 RCX: ffff888005e92408
[  439.848979] RDX: 0000000000000000 RSI: ffff88803e800000 RDI: ffffc9000eacbdb0
[  439.848980] RBP: 0000000000000000 R08: ffff888005e92400 R09: 0000000000000000
[  439.848982] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[  439.848983] R13: 0000000000000000 R14: ffffc900006f3db0 R15: ffff888005cac86c
[  439.849010] FS:  00007f616f850580(0000) GS:ffff88803e800000(0000) knlGS:0000000000000000
[  439.849013] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  439.849015] CR2: 00007f616faa2080 CR3: 00000000049fe000 CR4: 00000000003506f0
[  439.849017] Kernel panic - not syncing: Fatal exception in interrupt
[  439.850172] Kernel Offset: disabled
[  439.992548] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

(gdb) list *(affine_move_task+0x104)
0xffffffff810d0244 is in affine_move_task (kernel/sched/core.c:3091).
3086 }
3087 }
3088 task_rq_unlock(rq, p, rf);
3089
3090 if (complete)
3091 complete_all(&pending->done);
3092 }
3093
3094 wait_for_completion(&pending->done);
3095
(gdb)

Best regards,
Florian

Quoted 344 lines · JerryJun

Thank you so much for keeping an eye on this.
Yes, we do use xenomai.supported_cpus = 0xf but we bind the real-time thread to cpu2
You can repeat this problem in the attachment. As can be seen from backtrace, this problem is related to the rt_set_affinity API. After we removed this rt_set_affinity API, it returned to normal, but we do not know the reason We ran this test on other kernels and got some results from Crash analysis by kdump. We don't know if this will help us solve the problem

      KERNEL: vmlinux-4.19.89-ipipe-9-xenomai-3.1-20201027
    DUMPFILE: V10-5T/202403231347/dump.202403231347  [PARTIAL DUMP]
        CPUS: 4
        DATE: Sat Mar 23 13:47:22 2024
      UPTIME: 05:29:52
LOAD AVERAGE: 0.86, 0.67, 0.68
       TASKS: 436
    NODENAME: debian
     RELEASE: 4.19.89-ipipe-9-xenomai-3.1-20201027
     VERSION: #1 SMP PREEMPT Tue Oct 27 19:51:52 CST 2020
     MACHINE: x86_64  (3600 Mhz)
      MEMORY: 31.7 GB
       PANIC: "BUG: unable to handle kernel paging request at 00000000000a22e8"
         PID: 26821
     COMMAND: "rtThread"
        TASK: ffff888791bc0040  [THREAD_INFO: ffff888791bc0040]

         CPU: 2

       STATE: TASK_RUNNING (PANIC)
crash_pageoffset> bt -s
PID: 26821  TASK: ffff888791bc0040  CPU: 2   COMMAND: "rtThread"
 #0 [ffff88885fe03d10] machine_kexec+337 at ffffffff81041051
 #1 [ffff88885fe03d58] __crash_kexec+104 at ffffffff810f2818
 #2 [ffff88885fe03e20] crash_kexec+56 at ffffffff810f39d8
 #3 [ffff88885fe03e38] oops_end+186 at ffffffff8101795a
 #4 [ffff88885fe03e58] no_context+439 at ffffffff8104b2a7
 #5 [ffff88885fe03eb0] __do_page_fault+162 at ffffffff8104b8b2
 #6 [ffff88885fe03f28] ___xnsched_run+507 at ffffffff811838cb
 #7 [ffff88885fe03f60] xnintr_core_clock_handler+540 at ffffffff8117cddc
 #8 [ffff88885fe03fa0] dispatch_irq_head+126 at ffffffff8111953e
 #9 [ffff88885fe03fc8] __ipipe_handle_irq+103 at ffffffff81037f07
#10 [ffff88885fe03ff0] apic_timer_interrupt+18 at ffffffff81801d22
--- <IRQ stack> ---
bt: cannot transition from IRQ stack to current process stack:
        IRQ stack pointer: ffff88885fe03d10
    process stack pointer: ffff88885fe03c10
       current stack base: ffffc90005a30000

 crash> dis -l ___xnsched_run
linux-4.19.89-ipipe-9-xenomai-3.1/kernel/xenomai/sched.c: 1042                                                if (shadow && ipipe_root_p) 0xffffffff81183887 <___xnsched_run+439>:        test   %r15d,%r15d
0xffffffff8118388a <___xnsched_run+442>:        je     0xffffffff811838b7 <___xnsched_run+487> linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 331                                      ipipe_get_current_domain
0xffffffff8118388c <___xnsched_run+444>:        pushfq
0xffffffff8118388d <___xnsched_run+445>:        pop    %rdx
linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 261
0xffffffff8118388e <___xnsched_run+446>:        cli
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 331
0xffffffff8118388f <___xnsched_run+447>:        mov    $0xa2260,%rax
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 269
0xffffffff81183896 <___xnsched_run+454>:        mov    %gs:0x7ee8b93a(%rip),%rcx  # 0xf1d8                   return __ipipe_raw_cpu_read(ipipe_percpu.curr);
                      RCX: ffffffff828021c0       ffffffff828021c0:  0000000000042e80
0xffffffff8118389e <___xnsched_run+462>:        mov    (%rax,%rcx,1),%rax
0xffffffff811838a2 <___xnsched_run+466>:        mov    0x42e70(%rax),%rax                                    return __ipipe_get_current_context()->domain; linux-4.19.89-ipipe-9-xenomai-3.1/./arch/x86/include/asm/irqflags.h: 336
0xffffffff811838a9 <___xnsched_run+473>:        push   %rdx
0xffffffff811838aa <___xnsched_run+474>:        popfq
linux-4.19.89-ipipe-9-xenomai-3.1/./include/linux/ipipe_domain.h: 334
0xffffffff811838ab <___xnsched_run+475>:        cmp    $0xffffffff825f8940,%rax
0xffffffff811838b1 <___xnsched_run+481>:        je   0xffffffff81183b06 <___xnsched_run+1078>
                                                goto shadow_epilogue;
linux-4.19.89-ipipe-9-xenomai-3.1/include/xenomai/cobalt/kernel/sched.h: 372
0xffffffff811838b7 <___xnsched_run+487>:        mov    $0xa4540,%rdi                        0xffffffff811838be <___xnsched_run+494>:        add    %gs:0x7ee8b912(%rip),%rdi   # 0xf1d8 linux-4.19.89-ipipe-9-xenomai-3.1/kernel/xenomai/sched.c: 1052                                                            xnthread_switch_fpu(sched); 0xffffffff811838c6 <___xnsched_run+502>:        callq  0xffffffff81189eb0 <xnthread_switch_fpu> linux-4.19.89-ipipe-9-xenomai-3.1/include/xenomai/cobalt/kernel/trace.h: 84
0xffffffff811838cb <___xnsched_run+507>:        mov    $0x1,%r15d

[78270.764791] BUG: unable to handle kernel paging request at 00000000000a22e8
[78270.771791] PGD 0 P4D 0
[78270.774375] Oops: 0000 [#1] PREEMPT SMP NOPTI
[78270.778769] CPU: 2 PID: 26821 Comm: RunCommandActor Kdump: loaded Tainted: P           O      4.19.89-ipipe-9-xenomai-3.1-20201027 #1
[78270.790893] Hardware name: Supermicro Super Server/C422-SF, BIOS E906.1 04/27/2021
[78270.798536] I-pipe domain: Linux
[78270.801787] RIP: a2260:0xffff88885fe1c560
[78270.805834] Code: 00 00 00 00 00 00 00 00 00 00 c0 8f ea 5f 88 88 ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <01> 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00
[78270.824763] RSP: 81037f07:00000000000a2260 EFLAGS: ffff88885fe1c560 ORIG_RAX: ffffffff8111953e
[78270.833421] RAX: 00000000000a2260 RBX: 0000000000000002 RCX: ffffffff828021c0
[78270.840596] RDX: ffff88885fe1c560 RSI: 0000000000000000 RDI: 0000000000000000
[78270.847790] RBP: ffff88885fea4540 R08: 000000000005f3e0 R09: 000000000000fe0c                          
[78270.854984] R10: ffffffff8117cddc R11: 0000000000000002 R12: ffff88885fea5d08                     
[78270.862185] R13: ffffe8ffffc079c8 R14: ffff88885fea4540 R15: ffffffff811838cb                      
[78270.869335] FS:  00007fe12237c700(0000) GS:ffff88885fe00000(0000) knlGS:0000000000000000       
[78270.877499] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[78270.883298] CR2: 00000000000a22e8 CR3: 0000000852a06006 CR4: 00000000001606e0
[78270.890465] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[78270.897658] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[78270.904843] Call Trace:
[78270.996185] CR2: 00000000000a22e8

From the backtrace above, based on the value stored in the CPU register at the time of the kernel crash, the location where the page fault was triggered appears to be at ___xnsched_run+507. Kernel crash occurs with RAX value 0xa2260 from <___xnsched_run+447>: mov $0xa2260,%rax. The value of the GS register is ffff88885fe00000, the address of the percpu variable in CPU2. crash> kmem -o
PER-CPU OFFSET VALUES:
CPU 0: ffff88885fc00000
CPU 1: ffff88885fd00000
CPU 2: ffff88885fe00000
CPU 3: ffff88885ff00000

The RDX register has the value ffff88885fe1c560, which is the address of the ipipe_percpu variable in CPU2 crash> p ipipe_percpu
PER-CPU DATA TYPE:
struct ipipe_percpu_data ipipe_percpu;
PER-CPU ADDRESSES:
[0]: ffff88885fc1c560
[1]: ffff88885fd1c560
[2]: ffff88885fe1c560
[3]: ffff88885ff1c560

<___xnsched_run+454>:  mov %gs:0x7ee8b93a(%rip),%rcx # 0xf1d8 namely __ipipe_raw_cpu_read(iPipe_percpu.curr) The member of curr is obtained through the ipipe_percpu variable crash> ipipe_percpu_data ffff88885fe1c560 -o
struct ipipe_percpu_data {
[ffff88885fe1c560] struct ipipe_percpu_domain_data root;
[ffff88885fe5f3e0] struct ipipe_percpu_domain_data head;
[ffff88885fea2260] struct ipipe_percpu_domain_data *curr;
[ffff88885fea2268] struct pt_regs tick_regs;
[ffff88885fea2310] int hrtimer_irq;
[ffff88885fea2318] struct task_struct *task_hijacked;
[ffff88885fea2320] struct task_struct *rqlock_owner;
[ffff88885fea2328] struct ipipe_vm_notifier *vm_notifier;
[ffff88885fea2330] unsigned long nmi_state;
[ffff88885fea2338] struct mm_struct *active_mm;
}
SIZE: 548320

RIP a2260:0xffff88885fe1c560 is the location of ipipe_percpu.curr,
CR2 00000000000a22e8 Stores the linear address of the page fault when it occurs, which points to the ip member of the struct pt_regs from below, and the value of the GS segment register + CR2 register is ffff88885fea22e8. crash_pageoffset> struct pt_regs ffff88885fea2268 -o
struct pt_regs {
[ffff88885fea2268] unsigned long r15;
[ffff88885fea2270] unsigned long r14;
[ffff88885fea2278] unsigned long r13;
[ffff88885fea2280] unsigned long r12;
[ffff88885fea2288] unsigned long bp;
[ffff88885fea2290] unsigned long bx;
[ffff88885fea2298] unsigned long r11;
[ffff88885fea22a0] unsigned long r10;
[ffff88885fea22a8] unsigned long r9;
[ffff88885fea22b0] unsigned long r8;
[ffff88885fea22b8] unsigned long ax;
[ffff88885fea22c0] unsigned long cx;
[ffff88885fea22c8] unsigned long dx;
[ffff88885fea22d0] unsigned long si;
[ffff88885fea22d8] unsigned long di;
[ffff88885fea22e0] unsigned long orig_ax;
[ffff88885fea22e8] unsigned long ip;
[ffff88885fea22f0] unsigned long cs;
[ffff88885fea22f8] unsigned long flags;
[ffff88885fea2300] unsigned long sp;
[ffff88885fea2308] unsigned long ss;
}
SIZE: 168

<___xnsched_run+475>:  cmp $0xffffffff825f8940,%rax Where $0xffffffff825f8940 is the address of the ipipe_percpu_domain_data root variable in root mode.
The contents of the register when the kernel crashes appear to be the root domain when executing __ipipe_current_domain == ipipe_root_domain to determine whether the domain is the root domain at this time. A crash occurs when obtaining the ip member of pt_regs on the percpu variable ipipe_percpu_data. At present, the rtThread real-time thread is bound to run in CPU2, and the switch from xenomai mode to linux mode occurs during the run time. From this log, is the kernel crash caused by a mode switch? Here are some of the meanings of CPU registers:
R08 5f3e0: Indicates the offset of ipipe_percpu.head
a2260: indicates the offset of ipipe_percpu.curr
RBP ffff88885fea4540: struct xnsched nksched
R12 ffff88885fea5d08: xnsched.current_account
0xffff88885fe1c560: struct ipipe_percpu_data
RCX FFFFFF828021C0: The value is 0000000000042e80

Quoted 175 lines · Clara

Hi,

just so you know, we're looking at this issue.
Which cmdline did you use? Was xenomai.supported_cpus set?
In the meantime, if you have more information or if you have been able to create a simplified application where the bug still occurs, please let us know.

Best
Clara

Quoted 166 lines

-----Original Message-----
From: JerryJun <[email protected]>
Sent: Montag, 26. Februar 2024 15:34
To: Kiszka, Jan (T CED) <[email protected]>
Cc: xenomai <[email protected]>
Subject: Re:Re: NX-protected page

hi, Jan, if you have reproducted it after trying to run the case for hours in qemu? or is there any doubt?

2024-02-02 16:37:59, "Jan Kiszka" <[email protected]> wrote:
Quoted 3 lines · JerryJun
Quoted 2 lines

how long did you run it?it will take a while for this crash but not more than

12 hours at mostly.

Quoted 12 lines
Quoted 2 lines

ok,i will try to run it without get /proc…… thank you very much.

Not for hours, but one setup was running for about 30 min. at least.

Jan

Quoted 5 lines
Quoted 3 lines · Jan Kiszka
Quoted 2 lines · Jan Kiszka
Quoted 1 line · JerryJun

yet, you just do make in the project to product the binary of oop-test,

run kill_test.sh , and finally wait kernel oop .

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

we get the same results of kernel oop in the qemu-amd64, which use

the config from xenomai-images ,"https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsou rce.denx.de%2FXenomai%2Fxenomai-images%2F- %2Fblob%2Fmaster%2Frecipes- kernel%2Flinux%2Ffiles%2Famd64_defconfig%3Fref_type%3Dheads&data=0 5%7C02%7Cclara.kowalsky%40siemens.com%7C494bca636f6c48566cc208d c36d843eb%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C6384 45549672638180%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&s data=xOckYYYOkjKZ3yKchy4B7kkX2eth%2Bqe88Mrd7XjldFw%3D&reserved= 0", as follow.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
[ 6191.671953] BUG: kernel NULL pointer dereference, address:

0000000000000000 [ 6191.671955] #PF: supervisor instruction fetch in kernel mode [ 6191.671956] #PF: error_code(0x0010) - not-present page [ 6191.671956] PGD 0 P4D 0 [ 6191.671958] Oops:
0010 [#1] PREEMPT SMP PTI IRQ_PIPELINE [ 6191.671959] CPU: 3 PID:
7047 Comm: oop-test Kdump: loaded Not tainted 5.10.199-devo-3.2.4-20240130 #1 [ 6191.671960] Hardware name:

QEMU

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 [ 6191.671961] IRQ stage: Linux [ 6191.671961] RIP: 0010:0x0 [ 6191.671962] Code: Unable to access opcode bytes at RIP

0xffffffffffffffd6.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
[ 6191.671962] RSP: 0018:ffffc90000118f80 EFLAGS: 00010246 [

6191.671963] RAX: 0000000000000000 RBX: ffff888108d3d730 RCX:
0000000000000000 [ 6191.671964] RDX: ffff888108d3d738 RSI:
ffffffff82516284 RDI: ffff888108d3d730 [ 6191.671965] RBP:
0000000000000000 R08: 0000000000000000 R09:

0000000000000001 [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671965] R10: 0000000000000000 R11: 0000000000000001

R12:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

0000000000000000 [ 6191.671966] R13: 0000000000000018 R14:
ffffffff811d37e0 R15: 0000000000000000 [ 6191.671967] FS:
00007fc6e83ea780(0000) GS:ffff88813bd80000(0000) knlGS:0000000000000000 [ 6191.671967] CS: 0010 DS: 0000 ES:

0000 CR0: 0000000080050033 [ 6191.671968] CR2: ffffffffffffffd6 CR3:
0000000106750005 CR4: 0000000000170ee0 [ 6191.671968] Call Trace:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[ 6191.671968]  <IRQ>
[ 6191.671969]  ? show_trace_log_lvl+0x1c2/0x2c9 [ 6191.671969]  ?
irq_work_single+0x42/0x80 [ 6191.671969]  ?
__die_body.cold+0x8/0xd [ 6191.671970]  ? no_context+0x13a/0x270

[

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

6191.671970] ? exc_page_fault+0x6f/0x200 [ 6191.671970] ?

asm_exc_page_fault+0x1e/0x30 [ 6191.671970]  ?
handle_oob_irq+0x90/0x90 [

6191.671971] irq_work_single+0x42/0x80

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
[ 6191.671971]  irq_work_run_list+0x2d/0x40 [ 6191.671971]
irq_work_run+0x26/0x40 [ 6191.671972]
inband_work_interrupt+0xa/0x20 [ 6191.671972]
handle_synthetic_irq+0xb1/0x210 [ 6191.671972]
asm_call_irq_on_stack+0x12/0x20 [ 6191.671973]  </IRQ> [
6191.671973]  arch_do_IRQ_pipelined+0x15d/0x2a0 [ 6191.671973]
sync_current_irq_stage+0x157/0x1f0
[ 6191.671974]  __inband_irq_enable+0x4b/0x70 [ 6191.671974]
_raw_spin_unlock_irqrestore+0x35/0x70
[ 6191.671974]  __set_cpus_allowed_ptr+0xbf/0x230 [

6191.671975]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
sched_setaffinity+0x383/0x6b0 [ 6191.671975]
__x64_sys_sched_setaffinity+0x45/0x80
[ 6191.671975]  do_syscall_64+0x39/0x50 [ 6191.671978]
entry_SYSCALL_64_after_hwframe+0x62/0xc7
[ 6191.671979] RIP: 0033:0x7fc6e84d6617 [ 6191.671979] Code: 1f

40

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

00 48 8b 15 79 c8 0e 00 f7 d8 41 b9 ff ff ff ff 64 89 02 44 89 c8 c3 66 2e 0f 1f 84 00 00 00 00 00 b8 cb 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 29 41 89 c0 83 f8 ff 74 18 64 c7 04 25 38 00 [ 6191.671980] RSP: 002b:00007ffd574dfde8 EFLAGS: 00000206

ORIG_RAX:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

00000000000000cb [ 6191.671981] RAX: ffffffffffffffda RBX:
00007fc6e7b985c8 RCX: 00007fc6e84d6617 [ 6191.671982] RDX:
00007fc6e7b985f0 RSI: 0000000000000080 RDI:

0000000000001b8d [

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

6191.671982] RBP: 00007ffd574dfe70 R08: 00007fc6e83ea780 R09:

00000000ffffffff [ 6191.671983] R10: fffffffffffffdca R11:
0000000000000206 R12: 000055a818eb61c0 [ 6191.671983] R13:
0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 6191.671984] Modules linked in:

Quoted 60 lines
Quoted 53 lines
Quoted 53 lines
Quoted 6 lines
Quoted 2 lines
[ 6191.671985] CR2: 0000000000000000

Okay... that is "good" news - looking for some time slot to reproduce and debug myself now.

I've tried to reproduce, using the .config.yaml below for xenomai-images, but it does not trigger here. Do I need to run this for hours? What exactly did you do to trigger it in the qemu image of xenomai-images?

BTW, I assume the access of /proc/xenomai/sched/stat plays an important role in causing the crash, right? You don't get it without them?

Jan

#
# Automatically generated by kas 4.2 #
_source_dir: /repo
build_system: isar
header:
includes:
- kas.yml
- board-qemu-amd64.yml
- opt-linux-latest-5.10.yml
version: 16
menu_configuration:
DEBUG: false
KERNEL_4_19: false
KERNEL_4_19_LATEST: false
KERNEL_5_10: false
KERNEL_5_10_LATEST: true
KERNEL_5_15: false
KERNEL_5_15_LATEST: false
KERNEL_5_4: false
KERNEL_5_4_LATEST: false
KERNEL_6_1: false
KERNEL_6_1_LATEST: false
TARGET_BBB: false
TARGET_HIKEY: false
TARGET_QEMU_AMD64: true
TARGET_QEMU_ARM: false
TARGET_QEMU_ARM64: false
TARGET_X86_64_EFI: false
XENOMAI3: true
XENOMAI4: false
XENOMAI_3_0_LATEST: false
XENOMAI_3_1_LATEST: false
XENOMAI_3_2: true
XENOMAI_3_2_LATEST: false
XENOMAI_LATEST: false

Quoted 3 lines
Quoted 3 lines

--
Siemens AG, Technology
Linux Expert Center

--
Siemens AG, Technology
Linux Expert Center