RISC-V: Fix a race condition during kernel stack overflow