lwp_exit() used to work for curlwp and !curlwp. There is a regression that there was introduced code called from lwp_exit() calling lwp_thread_cleanup(l) that asserts curlwp, effectively enforcing lwp_exit() to be operational for curlwp only. This was introduced by: commit 2de05dfb9c516db5509614b7be366e31205ceeaa Author: thorpej <thorpej%NetBSD.org@localhost> Date: Sat Apr 4 20:20:12 2020 +0000 Add support for lazily generating a "global thread ID" for a LWP. This identifier uniquely identifies an LWP across the entire system, and will be used in future improvements in user-space synchronization primitives. (Test disabled and libc stub not included intentionally so as to avoid multiple libc version bumps.) On 01.06.2020 14:45, Jared McNeill wrote: > Looks like lwp_exit is called with something other than curlwp in the > sys__lwp_create error path: > > https://nxr.netbsd.org/xref/src/sys/kern/sys_lwp.c#156 > > > On Mon, 1 Jun 2020, Jared McNeill wrote: > >> Just hit this panic on 9.99.64: >> >> [ 6717.5700161] panic: kernel diagnostic assertion "l == curlwp" >> failed: file "/home/source/ab/HEAD/src/sys/kern/kern_lwp.c", line 2063 >> [ 6717.5800161] cpu18: Begin traceback... >> [ 6717.5900170] trace fp ffffc0088f5d3c50 >> [ 6717.5900170] fp ffffc0088f5d3c70 vpanic() at ffffc000004b0334 >> netbsd:vpanic+0x15c >> [ 6717.6000167] fp ffffc0088f5d3ce0 kern_assert() at ffffc000007ce26c >> netbsd:kern_assert+0x5c >> [ 6717.6100211] fp ffffc0088f5d3d70 lwp_thread_cleanup() at >> ffffc0000045f368 netbsd:lwp_thread_cleanup+0x80 >> [ 6717.6200270] fp ffffc0088f5d3d90 lwp_exit() at ffffc0000045f4ac >> netbsd:lwp_exit+0xcc >> [ 6717.6200270] fp ffffc0088f5d3dd0 sys__lwp_create() at >> ffffc000004c2f00 netbsd:sys__lwp_create+0xe8 >> [ 6717.6300215] fp ffffc0088f5d3e20 syscall() at ffffc0000008a63c >> netbsd:syscall+0x18c >> [ 6717.6400221] tf ffffc0088f5d3ed0 el0_trap() at ffffc00000088c74 >> netbsd:el0_trap >> [ 6717.6500214] ---- trapframe 0xffffc0088f5d3ed0 (304 bytes) ---- >> [ 6717.6500214] pc=0000f8abc4638958, spsr=0000000020000000 >> [ 6717.6600309] esr=0000000056000135, far=0000f8abc465b030 >> [ 6717.6600309] x0=0000ffffffe68500, x1=0000f8abc4a1a260 >> [ 6717.6700228] x2=0000f8abc49fe200, x3=0000000000000000 >> [ 6717.6800338] x4=0000ffffffe684d0, x5=0000000000000030 >> [ 6717.6800338] x6=0000ffffffe68500, x7=0000f8abc4760208 >> [ 6717.6900234] x8=0000000000000001, x9=0000000000001003 >> [ 6717.6900234] x10=000000000000000c, x11=0000000000000001 >> [ 6717.7000252] x12=0000f8abc49e91d8, x13=0000000000000000 >> [ 6717.7000252] x14=0000000000000000, x15=0000f8abc4000980 >> [ 6717.7100242] x16=0000f8abc4a122e0, x17=0000f8abc4638954 >> [ 6717.7200306] x18=0000000000000001, x19=0000ffffffe68500 >> [ 6717.7200306] x20=0000fffff9a72e60, x21=0000000000000002 >> [ 6717.7300283] x22=0000f8abc4a1a260, x23=0000f8abc49fe200 >> [ 6717.7300283] x24=0000fffff9a72000, x25=0000ffffffe684d0 >> [ 6717.7400357] x26=0000fffff9a732a8, x27=0000fffff9a73070 >> [ 6717.7400357] x28=0000f8abc4a1b400, fp=x29=0000ffffffe68510 >> [ 6717.7500291] lr=x30=0000f8abc49fe224, sp=0000ffffffe68420 >> [ 6717.7600300] ------------------------------------------------ >> [ 6717.7600300] cpu18: End traceback... >> Stopped in pid 152.152 (conftest) at >> netbsd:cpu_Debugger+0x4: ret >> db{18}> >> >> >>
Attachment:
signature.asc
Description: OpenPGP digital signature