From: Jeff D. <jd...@ka...> - 2000-04-07 15:43:43
|
I've got ptrace implemented enough that strace now works. gdb doesn't yet because I haven't put in code to deal with hitting breakpoints. Having strace working gave me the ability to figure out why it was impossible to telnet into a uml. It turned out that in this code, where the lock was being turned off, and *arg == 0, get_user was setting val so something very non-zero, so the pty stayed locked, and the open of the slave side failed: /* Set the lock flag on a pty */ static int pty_set_lock(struct tty_struct *tty, int * arg) { int val; if (get_user(val,arg)) return -EFAULT; if (val) set_bit(TTY_PTY_LOCK, &tty->flags); else clear_bit(TTY_PTY_LOCK, &tty->flags); return 0; } get_user looked like this: #define get_user(x, ptr) \ ({ __typeof__(*(ptr)) val; \ memcpy(&val, (ptr), sizeof(*(ptr))); \ (x) = (__typeof__(*(ptr))) val; \ 0; \ }) Spotted the bug? I stared at it for a while before figuring out that the get_user val was hiding the pty_set_lock val. Ironically, the compiler had been trying to tell me for ages about this. It had always complained about val maybe not being used and I had looked at it and decided that it didn't know what it was talking about. I think one a Henry Spencer's 10 Commandments is "Study the pronouncements of the compiler with care". I should have. I fixed another bug in the network driver which fixed the problem with outgoing tcp connections freezing. Now you can telnet out for as long as you want. X also works. Displaying remotely to your native X server probably has worked for a long time. You can also run X locally. Use Xnest displaying to your native server as the local X server and have your X apps display to :0. Jeff |