netutils/dropbear: retain child exit status for NSH PTY session#3648
netutils/dropbear: retain child exit status for NSH PTY session#3648FelipeMdeO wants to merge 1 commit into
Conversation
The per-session NSH task is reaped with waitpid() in
dropbear_nshsession.c. Without CONFIG_SCHED_CHILD_STATUS the kernel does
not retain the child exit status, so waitpid() returns ECHILD right after
authentication and the interactive SSH session never starts
("NSH session wait failed: Unknown error 10").
Depend on SCHED_HAVE_PARENT (required by SCHED_CHILD_STATUS) and select
SCHED_CHILD_STATUS so any Dropbear build gets a working interactive
session, independent of the chacha20-poly1305 / PBKDF2 work.
Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
|
Hello @acassis , @xiaoxiang781216 , @linguini1 , can you take a look, please? |
| depends on LIBC_GAISTRERROR | ||
| select CRYPTO | ||
| select CRYPTO_RANDOM_POOL | ||
| select SCHED_CHILD_STATUS |
There was a problem hiding this comment.
let's change to depends on
There was a problem hiding this comment.
Hello @xiaoxiang781216, I'd prefer to keep this as select. With depends on, whoever writes a defconfig for a new board could forget to enable SCHED_CHILD_STATUS, and Dropbear would silently be dropped from the build, no error, it just wouldn't come up. Keeping it as select makes bringing up Dropbear on a new board simpler and avoids that pitfall.
There was a problem hiding this comment.
We did decide a while ago that we would use depends on going forward since select has a tendency to cause mysterious issues (not selecting recursive dependencies). The advised approach here is for the user to determine via Kconfig what dependencies need to be enabled and do that themselves.
Dropbear's NSH PTY session reaps the child task with waitpid() and needs CONFIG_SCHED_CHILD_STATUS, which depends on SCHED_HAVE_PARENT. The netutils/dropbear Kconfig now depends on SCHED_HAVE_PARENT and selects SCHED_CHILD_STATUS (apache/nuttx-apps#3648); set SCHED_HAVE_PARENT here so the dropbear defconfig stays consistent and the session no longer fails with ECHILD after authentication. Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
Summary
Dropbear reaps the per-session NSH task with
waitpid()indropbear_nshsession.c. WithoutCONFIG_SCHED_CHILD_STATUSthe kernel doesnot retain the child exit status, so
waitpid()returnsECHILDright afterauthentication and the interactive session never starts
(
NSH session wait failed: Unknown error 10).The issue was reported here: apache/nuttx#19209
Depend on
SCHED_HAVE_PARENT(required bySCHED_CHILD_STATUS) and selectSCHED_CHILD_STATUSso any Dropbear build gets a working interactive session.Impact
Kconfig-only, 2 lines. Fixes interactive SSH sessions for
NETUTILS_DROPBEAR.No dependency on other in-flight work.
Testing
Built
sim:dropbear(nuttx master + this change) and connected over SSH:on device side:
On host side: