Skip to contentSkip to conversation

Register corruption in syscalls on Dovetail > 6.10

PATCH Florian Bezdeka 3 participants 3 messages Jan 8, 2025

lore
Share & tools
lore
#0 lore raw

Hi all,

while doing the dovetail forward porting to 6.13 we detected an issue within the cobalt core.

CI jobs fail/crash while trying to execute the smokey testsuite. Philippe and I were able to reproduce locally. Here is a summary what we found out so far. The issue is not completely understood yet.

The smokey test suite - especially the y2038 tests - are triggering several (page) faults. One of them triggers the following kernel splat. The complete test log can be found at [1].

[  265.656410] Unable to handle kernel paging request at virtual address ffff0000404666c8
[  265.656463] Mem abort info:
[  265.656475]   ESR = 0x0000000096000005
[  265.656529]   EC = 0x25: DABT (current EL), IL = 32 bits
[  265.656554]   SET = 0, FnV = 0
[  265.656571]   EA = 0, S1PTW = 0
[  265.656591]   FSC = 0x05: level 1 translation fault
[  265.656619] Data abort info:
[  265.656635]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[  265.656652]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[  265.656669]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[  265.656735] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004196d000
[  265.656764] [ffff0000404666c8] pgd=180000007ffff003, p4d=180000007ffff003, pud=0000000000000000
[  265.657948] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[  265.658304] Modules linked in: crct10dif_ce cfg80211 rfkill fuse drm drm_panel_orientation_quirks ip_tables x_tables ipv6 [last unloaded: xeno_rtdmtest]
[  265.658970] CPU: 0 UID: 0 PID: 1610 Comm: smokey Not tainted 6.12.0 #1
[  265.659072] Hardware name: linux,dummy-virt (DT)
[  265.659213] IRQ stage: Linux
[  265.659437] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  265.659529] pc : __pipeline_syscall+0xf0/0x23c
[  265.659574] lr : __pipeline_syscall+0xc8/0x23c
[  265.659608] sp : ffff800082e93d90
[  265.659629] x29: ffff800082e93d90 x28: 0000000000000000 x27: ffff800081fedf08
[  265.659715] x26: ffff800081574598 x25: ffff8000820066b8 x24: 0000000000000001
[  265.659741] x23: ffff800081fedf08 x22: 0000000000000018 x21: ffff800082e93eb0
[  265.659767] x20: ffff8000819364d0 x19: ffff00003fd964d0 x18: 0000000000000000
[  265.659791] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[  265.659823] x14: ffff000004942e00 x13: 0000000000000000 x12: 0000000000000001
[  265.659846] x11: ffff800082d13c08 x10: 0000000000000a70 x9 : ffff800082e93be0
[  265.659870] x8 : ffff00000766f0d0 x7 : ffff800082006000 x6 : 0000000000000000
[  265.659912] x5 : 0000000000000000 x4 : ffff800082e93d90 x3 : 0000000000000000
[  265.659944] x2 : ffff0000404666b8 x1 : ffff00000766e600 x0 : ffff7fffbe460000
[  265.660114] Call trace:
[  265.660289]  __pipeline_syscall+0xf0/0x23c
[  265.660485]  pipeline_syscall+0x60/0xcc
[  265.660566]  el0_svc_common.constprop.0+0x44/0x118
[  265.660598]  do_el0_svc+0x1c/0x28
[  265.660615]  el0_svc+0x34/0xfc
[  265.660632]  el0t_64_sync_handler+0x100/0x12c
[  265.660646]  el0t_64_sync+0x190/0x194
[  265.660879] Code: d3596442 8b020442 8b020f22 8b000042 (f9400841) 
[  265.688100] ---[ end trace 0000000000000000 ]---
[  265.688359] note: smokey[1610] exited with irqs disabled

Findings:

[ @Philippe, please correct/add if I missed something ]

- The first version with that problem is Dovetail 6.11, 6.10 is fine
- There seems to be a register corruption in syscalls
- Disabling CONFIG_XENO_OPT_DEBUG_LOCKING seems to help
- Philippe figured out that disabling XENO_ARCH_OUTOFLINE_XNLOCK allows us to enable CONFIG_XENO_OPT_DEBUG_LOCKING again, at least when his toolchain was updated from 13.2.rel1 to 14.2.rel1 at the same time.

I can confirm the same for the Debian toolchain (on Debian bookworm). Setting XENO_ARCH_OUTOFLINE_XNLOCK to n makes a difference.

- The following fixes the CI pipeline, but we're sure this is just papering over the real bug

(quoted diff) +0 -0

b/kernel/cobalt/posix/monitor.c
index fb7fb27e9..874acd910 100644

kernel/cobalt/posix/monitor.c +0 -0
@@ -289,7 +289,8 @@ int __cobalt_monitor_wait(struct

cobalt_monitor_shadow __user *u_mon,
out:

        xnlock_put_irqrestore(&nklock, s);

- __xn_put_user(opret, u_ret);
+ if (u_ret)
+ __xn_put_user(opret, u_ret);

        return ret;

}

Best regards,
Florian

[1] https://lava.xenomai.org/scheduler/job/17450

#1 lore raw
Quoted 81 lines · Florian Bezdeka

Hi all,

while doing the dovetail forward porting to 6.13 we detected an issue within the cobalt core.

CI jobs fail/crash while trying to execute the smokey testsuite. Philippe and I were able to reproduce locally. Here is a summary what we found out so far. The issue is not completely understood yet.

The smokey test suite - especially the y2038 tests - are triggering several (page) faults. One of them triggers the following kernel splat. The complete test log can be found at [1].

[  265.656410] Unable to handle kernel paging request at virtual address ffff0000404666c8
[  265.656463] Mem abort info:
[  265.656475]   ESR = 0x0000000096000005
[  265.656529]   EC = 0x25: DABT (current EL), IL = 32 bits
[  265.656554]   SET = 0, FnV = 0
[  265.656571]   EA = 0, S1PTW = 0
[  265.656591]   FSC = 0x05: level 1 translation fault
[  265.656619] Data abort info:
[  265.656635]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[  265.656652]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[  265.656669]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[  265.656735] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004196d000
[  265.656764] [ffff0000404666c8] pgd=180000007ffff003, p4d=180000007ffff003, pud=0000000000000000
[  265.657948] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[  265.658304] Modules linked in: crct10dif_ce cfg80211 rfkill fuse drm drm_panel_orientation_quirks ip_tables x_tables ipv6 [last unloaded: xeno_rtdmtest]
[  265.658970] CPU: 0 UID: 0 PID: 1610 Comm: smokey Not tainted 6.12.0 #1
[  265.659072] Hardware name: linux,dummy-virt (DT)
[  265.659213] IRQ stage: Linux
[  265.659437] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  265.659529] pc : __pipeline_syscall+0xf0/0x23c
[  265.659574] lr : __pipeline_syscall+0xc8/0x23c
[  265.659608] sp : ffff800082e93d90
[  265.659629] x29: ffff800082e93d90 x28: 0000000000000000 x27: ffff800081fedf08
[  265.659715] x26: ffff800081574598 x25: ffff8000820066b8 x24: 0000000000000001
[  265.659741] x23: ffff800081fedf08 x22: 0000000000000018 x21: ffff800082e93eb0
[  265.659767] x20: ffff8000819364d0 x19: ffff00003fd964d0 x18: 0000000000000000
[  265.659791] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[  265.659823] x14: ffff000004942e00 x13: 0000000000000000 x12: 0000000000000001
[  265.659846] x11: ffff800082d13c08 x10: 0000000000000a70 x9 : ffff800082e93be0
[  265.659870] x8 : ffff00000766f0d0 x7 : ffff800082006000 x6 : 0000000000000000
[  265.659912] x5 : 0000000000000000 x4 : ffff800082e93d90 x3 : 0000000000000000
[  265.659944] x2 : ffff0000404666b8 x1 : ffff00000766e600 x0 : ffff7fffbe460000
[  265.660114] Call trace:
[  265.660289]  __pipeline_syscall+0xf0/0x23c
[  265.660485]  pipeline_syscall+0x60/0xcc
[  265.660566]  el0_svc_common.constprop.0+0x44/0x118
[  265.660598]  do_el0_svc+0x1c/0x28
[  265.660615]  el0_svc+0x34/0xfc
[  265.660632]  el0t_64_sync_handler+0x100/0x12c
[  265.660646]  el0t_64_sync+0x190/0x194
[  265.660879] Code: d3596442 8b020442 8b020f22 8b000042 (f9400841) 
[  265.688100] ---[ end trace 0000000000000000 ]---
[  265.688359] note: smokey[1610] exited with irqs disabled

Findings:

[ @Philippe, please correct/add if I missed something ]

- The first version with that problem is Dovetail 6.11, 6.10 is fine
- There seems to be a register corruption in syscalls
- Disabling CONFIG_XENO_OPT_DEBUG_LOCKING seems to help
- Philippe figured out that disabling XENO_ARCH_OUTOFLINE_XNLOCK allows us to enable CONFIG_XENO_OPT_DEBUG_LOCKING again, at least when his toolchain was updated from 13.2.rel1 to 14.2.rel1 at the same time.

I can confirm the same for the Debian toolchain (on Debian bookworm). Setting XENO_ARCH_OUTOFLINE_XNLOCK to n makes a difference.

- The following fixes the CI pipeline, but we're sure this is just papering over the real bug

kernel/cobalt/posix/monitor.c +0 -0
index fb7fb27e9..874acd910 100644

kernel/cobalt/posix/monitor.c int __cobalt_monitor_wait(struct · line 294

Quoted 7 lines
kernel/cobalt/posix/monitor.c +2 -1
@@ -289,7 +289,8 @@ int __cobalt_monitor_wait(struct
 cobalt_monitor_shadow __user *u_mon,
 out:
        xnlock_put_irqrestore(&nklock, s);
 
-       __xn_put_user(opret, u_ret);
+       if (u_ret)
+               __xn_put_user(opret, u_ret);

Is there a test case that triggers this user-fault intentionally?

Sound like we get the corruption also or only when taking an exception. Did you analyze the page-fault path already, maybe even debugged that particular call path?

Jan

Quoted 8 lines
kernel/cobalt/posix/monitor.c +0 -0
        return ret;
 }

Best regards,
Florian

[1] https://lava.xenomai.org/scheduler/job/17450

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#2 lore raw
In reply to Florian Bezdeka
Quoted 57 lines · Florian Bezdeka

Hi all,

while doing the dovetail forward porting to 6.13 we detected an issue within the cobalt core.

CI jobs fail/crash while trying to execute the smokey testsuite. Philippe and I were able to reproduce locally. Here is a summary what we found out so far. The issue is not completely understood yet.

The smokey test suite - especially the y2038 tests - are triggering several (page) faults. One of them triggers the following kernel splat. The complete test log can be found at [1].

[  265.656410] Unable to handle kernel paging request at virtual address ffff0000404666c8
[  265.656463] Mem abort info:
[  265.656475]   ESR = 0x0000000096000005
[  265.656529]   EC = 0x25: DABT (current EL), IL = 32 bits
[  265.656554]   SET = 0, FnV = 0
[  265.656571]   EA = 0, S1PTW = 0
[  265.656591]   FSC = 0x05: level 1 translation fault
[  265.656619] Data abort info:
[  265.656635]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[  265.656652]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[  265.656669]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[  265.656735] swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004196d000
[  265.656764] [ffff0000404666c8] pgd=180000007ffff003, p4d=180000007ffff003, pud=0000000000000000
[  265.657948] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
[  265.658304] Modules linked in: crct10dif_ce cfg80211 rfkill fuse drm drm_panel_orientation_quirks ip_tables x_tables ipv6 [last unloaded: xeno_rtdmtest]
[  265.658970] CPU: 0 UID: 0 PID: 1610 Comm: smokey Not tainted 6.12.0 #1
[  265.659072] Hardware name: linux,dummy-virt (DT)
[  265.659213] IRQ stage: Linux
[  265.659437] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  265.659529] pc : __pipeline_syscall+0xf0/0x23c
[  265.659574] lr : __pipeline_syscall+0xc8/0x23c
[  265.659608] sp : ffff800082e93d90
[  265.659629] x29: ffff800082e93d90 x28: 0000000000000000 x27: ffff800081fedf08
[  265.659715] x26: ffff800081574598 x25: ffff8000820066b8 x24: 0000000000000001
[  265.659741] x23: ffff800081fedf08 x22: 0000000000000018 x21: ffff800082e93eb0
[  265.659767] x20: ffff8000819364d0 x19: ffff00003fd964d0 x18: 0000000000000000
[  265.659791] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[  265.659823] x14: ffff000004942e00 x13: 0000000000000000 x12: 0000000000000001
[  265.659846] x11: ffff800082d13c08 x10: 0000000000000a70 x9 : ffff800082e93be0
[  265.659870] x8 : ffff00000766f0d0 x7 : ffff800082006000 x6 : 0000000000000000
[  265.659912] x5 : 0000000000000000 x4 : ffff800082e93d90 x3 : 0000000000000000
[  265.659944] x2 : ffff0000404666b8 x1 : ffff00000766e600 x0 : ffff7fffbe460000
[  265.660114] Call trace:
[  265.660289]  __pipeline_syscall+0xf0/0x23c
[  265.660485]  pipeline_syscall+0x60/0xcc
[  265.660566]  el0_svc_common.constprop.0+0x44/0x118
[  265.660598]  do_el0_svc+0x1c/0x28
[  265.660615]  el0_svc+0x34/0xfc
[  265.660632]  el0t_64_sync_handler+0x100/0x12c
[  265.660646]  el0t_64_sync+0x190/0x194
[  265.660879] Code: d3596442 8b020442 8b020f22 8b000042 (f9400841) 
[  265.688100] ---[ end trace 0000000000000000 ]---
[  265.688359] note: smokey[1610] exited with irqs disabled
Quoted 6 lines

Findings:

[ @Philippe, please correct/add if I missed something ]

- The first version with that problem is Dovetail 6.11, 6.10 is fine
- There seems to be a register corruption in syscalls

This is even worse: the stack context which underlies current_thread_info() looks like very much broken in the syscall path, at some point.

Signature · 1 line
Philippe.