sel_call refuses direct recursion because the prologue saves ra in a single slot at sp+0 and a self-call would clobber it. That check only compares the callee against the current function, so a two-function cycle passes straight through and miscompiles rather than refusing.
Detecting cycles properly is the minimum fix and should probably land regardless. Actually supporting recursion needs a deeper save area and a real frame layout, which is a bigger piece and arguably not worth it for baby-core kernels.
sel_call refuses direct recursion because the prologue saves ra in a single slot at sp+0 and a self-call would clobber it. That check only compares the callee against the current function, so a two-function cycle passes straight through and miscompiles rather than refusing.
Detecting cycles properly is the minimum fix and should probably land regardless. Actually supporting recursion needs a deeper save area and a real frame layout, which is a bigger piece and arguably not worth it for baby-core kernels.