Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

uml: work around host tcsetattr bug

Under the conditions that UML uses it, tcgetattr is guaranteed to return
-EINTR when the console is attached to /dev/ptmx, making generic_console_write
hang because it loops, calling tcgetattr until it succeeds. This is a host
bug - see http://marc.info/?l=linux-kernel&m=119618990807182&w=2 for the
details.

This patch works around it by blocking SIGIO while the terminal attributes are
being fiddled.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jeff Dike and committed by
Linus Torvalds
ce3b642d 0a765329

+10 -1
+10 -1
arch/um/drivers/chan_user.c
··· 74 74 75 75 int generic_console_write(int fd, const char *buf, int n) 76 76 { 77 + sigset_t old, no_sigio; 77 78 struct termios save, new; 78 79 int err; 79 80 80 81 if (isatty(fd)) { 82 + sigemptyset(&no_sigio); 83 + sigaddset(&no_sigio, SIGIO); 84 + if (sigprocmask(SIG_BLOCK, &no_sigio, &old)) 85 + goto error; 86 + 81 87 CATCH_EINTR(err = tcgetattr(fd, &save)); 82 88 if (err) 83 89 goto error; ··· 103 97 * Restore raw mode, in any case; we *must* ignore any error apart 104 98 * EINTR, except for debug. 105 99 */ 106 - if (isatty(fd)) 100 + if (isatty(fd)) { 107 101 CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save)); 102 + sigprocmask(SIG_SETMASK, &old, NULL); 103 + } 104 + 108 105 return err; 109 106 error: 110 107 return -errno;