tsutsui / netbsd-src

Automatic conversion of the NetBSD src CVS module, use with care. Please submit bugs/changes via https://gnats.netbsd.org
https://www.NetBSD.org
2 stars 0 forks source link

luna88k: /usr/bin/login silently exits and cannot multi user login #4

Closed tsutsui closed 2 years ago

tsutsui commented 2 years ago

see what's going on: https://www.youtube.com/watch?v=xtp4LDtDgxc

tsutsui commented 2 years ago

ktrace login: login.ktrace.log

It looks silently exit after writing /var/log/wtmp via login(3) in libutil? https://github.com/tsutsui/netbsd-src/blob/e68096389f0dc5327ebdd92871273b86a7a75b38/usr.bin/login/login.c#L1020-L1031 https://github.com/tsutsui/netbsd-src/blob/e68096389f0dc5327ebdd92871273b86a7a75b38/lib/libutil/login.c#L66-L69 because the following geteuid(2) is not recoreded: https://github.com/tsutsui/netbsd-src/blob/e68096389f0dc5327ebdd92871273b86a7a75b38/usr.bin/login/login.c#L545-L564

tsutsui commented 2 years ago

After dumb printf debugging, it turns out login(1) properly invokes a shell but /bin/csh silently exits. Probably this is due to signal issue mentioned in #15.

In NetBSD 3.x days root login shell was /bin/csh so changing it to /bin/sh (as these days) works around.

tsutsui commented 2 years ago

I'm not sure why ktrace(1) doesn't log all syscalls on invoking a user shell, but maybe the ktrace logging is terminated around setusercontext(3) etc.

tsutsui commented 2 years ago

The default shell for root has been changed to /bin/sh as trunk in https://github.com/tsutsui/netbsd-src/commit/be7b63daeeb9407e42b3db950085ba6bd6ee319a