From c935e2689edf771ff3056cf24338264a04660e5a Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 18 Jul 2026 12:52:51 +0900 Subject: [PATCH] =?UTF-8?q?login:=20DIAGNOSTIC=20=E2=80=94=20spawn=20login?= =?UTF-8?q?=20shell=20without=20namespace=20restriction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Getty forwards console input to the pty master correctly (verified), and login reads the username fine, but after apply_login_schemes() restricts the namespace the interactive shell's pty-slave read never returns the forwarded input. Temporarily skip the restriction to confirm it is the cause. Also removes the getty forward diagnostic. --- src/bin/getty.rs | 1 - src/bin/login.rs | 21 +++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/bin/getty.rs b/src/bin/getty.rs index f3dc787273..6afb645771 100644 --- a/src/bin/getty.rs +++ b/src/bin/getty.rs @@ -67,7 +67,6 @@ pub fn handle( Err(ref err) if err.errno() == EAGAIN => break, Err(_) => panic!("getty: failed to read from TTY"), }; - eprintln!("getty-diag: fwd {count} bytes tty->pty {:?}", &packet[..count.min(24)]); redox::write(master_fd as usize, &packet[..count]) .expect("getty: failed to write master PTY"); } diff --git a/src/bin/login.rs b/src/bin/login.rs index 5e28e50733..17ee844c41 100644 --- a/src/bin/login.rs +++ b/src/bin/login.rs @@ -176,19 +176,16 @@ pub fn main() { stdout.flush().r#try(&mut stderr); } - let before_ns_fd = - apply_login_schemes(user, &DEFAULT_SCHEMES).unwrap_or_exit(1); - - let _ = syscall::fcntl( - before_ns_fd.raw(), - syscall::F_SETFD, - syscall::O_CLOEXEC, - ); + // DIAGNOSTIC: temporarily skip the login namespace + // restriction (apply_login_schemes). After its setns(), + // the interactive shell's pty-slave stdin stops + // receiving input forwarded to the pty master (getty + // forwards it, but the slave read never returns it), so + // the shell can never read a command. Spawn the shell in + // the inherited namespace to test whether the + // restriction is the cause. + let _ = apply_login_schemes; // keep import used spawn_shell(user).unwrap_or_exit(1); - let _ = syscall::fcntl(before_ns_fd.raw(), syscall::F_SETFD, 0); - let _ = libredox::call::close( - libredox::call::setns(before_ns_fd.into_raw()).unwrap_or_exit(1), - ); break; }