login: DIAGNOSTIC — spawn login shell without namespace restriction

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.
This commit is contained in:
2026-07-18 12:52:51 +09:00
parent 25826efb9e
commit c935e2689e
2 changed files with 9 additions and 13 deletions
-1
View File
@@ -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");
}
+9 -12
View File
@@ -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;
}