Package: user-mode-linux
Version: 4.19-1um-1+deb10u1+b1
Severity: normal
File: /usr/bin/linux.uml
Tags: upstream


CCing putty@p.d.o because this makes the user-mode-linux example in
the psusan manpage not work.


Steps to reproduce:

Put the attached scripts "psusan-uml" and "psusan-uml-inside" in
a directory and make them executable.

Run ./psusan-uml in a terminal.

Wait for the inital "read(0, " (from strace cat) to appear.
Type something.


Observed behaviour:

Nothing happens.  The input is not read.  Pressing ^D will terminate
the session, but the inner cat never sees the input.


Expected behaviour:

cat reads what you type and you see it appear in strace, and be
echoed.


Workaround:

Arrange not to write anything into linux.uml until some output has
appeared.  That seems to work OK for me, leading me to think it's not
a general lossage bug, but only happens if there is input to be read
when linux.uml starts up its consoles.


Notes:

Commenting out "echo initial" makes it work, showing that this is a
race.

The |cat at the end is because linux.uml sets the fds it is using for
a console to nonblocking.  cat objects to that.  So we pipe the stdout
too, so that linux.uml does not set the actual tty to nonblocking.



-- System Information:
Debian Release: 10.10
  APT prefers stable-debug
  APT policy: (500, 'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 5.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages user-mode-linux depends on:
ii  libc6  2.28-10

Versions of packages user-mode-linux recommends:
ii  uml-utilities  20070815.2-1

Versions of packages user-mode-linux suggests:
ii  pterm [x-terminal-emulator]           0.75-3
pn  rootstrap                             <none>
pn  slirp                                 <none>
pn  user-mode-linux-doc                   <none>
pn  vde2                                  <none>
ii  xfce4-terminal [x-terminal-emulator]  0.8.7.4-2
ii  xterm [x-terminal-emulator]           344-1+deb10u1

-- no debconf information
#!/bin/bash

stty=`stty -g`
trap 'stty "$stty"' 0

(
 echo initial
 cat
) | \
 bwrap --dev-bind / / --tmpfs /dev/shm \
 linux.uml rootfstype=hostfs rootflags=/ rw \
 con=fd:0,fd:1 \
 init=$PWD/psusan-uml-inside 2>&1 \
| cat
#!/bin/bash
# Set up vital pseudo-filesystems
set -x
mount -t proc none /proc
exec 3<>/dev/tty1
stty raw -echo <&3
echo $PATH
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export PATH
stty -a >&2
strace cat

Reply via email to