read() from pty doesn't finish.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Medium
|
Joseph Salisbury | ||
Trusty |
Fix Released
|
Medium
|
Joseph Salisbury | ||
Vivid |
Fix Released
|
Medium
|
Joseph Salisbury | ||
Wily |
Fix Released
|
Medium
|
Joseph Salisbury |
Bug Description
It has been brought to my attention
By the attached test program pty, a pair of process repeats writing and reading only '\n' to a master pseudoterminal device (/dev/ptmx) and a slave pseudoterminal device (/dev/pts/N) each. When we carry out the following 30 pairs 10,000 times, in a pair each process doesn't finish reading.
$ pty 30
The following message will be usually indicated immediately.
#name copy num/sec usec/num
pty_switch 30 1541842 0.648575
When a message wasn't indicated any more, we got the attached dump file.
A kernel was 3.13.0-45.74.
A system was Ubuntu 14.04 LTS.
The same problem occurred in case of 3.13.0-55.92 kernel and the following kernel have been tested as well:
2.6.32, 3.10: not reproduces.
3.19, 4.0.0, 4.1.3: reproduces.
CVE References
summary: |
- 14.04: read() from pty doesn't finish. + read() from pty doesn't finish. |
Changed in linux (Ubuntu): | |
importance: | Undecided → Medium |
tags: | added: kernel-da-key needs-bisect trusty vivid wily |
Changed in linux (Ubuntu): | |
status: | Incomplete → In Progress |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
Changed in linux (Ubuntu Trusty): | |
status: | New → In Progress |
Changed in linux (Ubuntu Vivid): | |
status: | New → In Progress |
Changed in linux (Ubuntu Wily): | |
status: | New → In Progress |
Changed in linux (Ubuntu Trusty): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Vivid): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Wily): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Trusty): | |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
Changed in linux (Ubuntu Vivid): | |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
Changed in linux (Ubuntu Wily): | |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
tags: | removed: needs-bisect |
Changed in linux (Ubuntu Vivid): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Wily): | |
status: | In Progress → Fix Committed |
tags: |
added: verification-done-vivid removed: verification-needed-vivid |
Changed in linux (Ubuntu Trusty): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Wily): | |
status: | Fix Committed → Fix Released |
Changed in linux (Ubuntu): | |
status: | In Progress → Fix Released |
tags: | added: cscc |
According to the dump a pair of process PID 7347 and 7348 were still waiting for read() from /dev/ptmx (struct file ffff880c65357c00) and /dev/pts/18 (struct file ffff880c65357500) respectively .
Normal behavior is as follows;
PID 7347: read(/dev/ptmx) -> write(/dev/ptmx),
PID 7348: write(/dev/pts/18) -> read(/dev/pts/18).
In the dump, PID 7348 finished writing to /dev/pts/18, and was waiting for completion of reading, while PID 7347 continued waiting for reading /dev/ptmx.
Though data has already arrived at /dev/ptmx, PID 7347 doesn't seem to have been woken up while being linked to the queue of the data to be read at tty_struct 0xffff88085438ac00.
- PID: 7347 TASK: ffff880853111800 CPU: 15 COMMAND: "pty" call_fastpath at ffffffff8173196d
#0 [ffff88084477dc90] __schedule at ffffffff81724e19
#1 [ffff88084477dcf8] schedule at ffffffff817252d9
#2 [ffff88084477dd08] schedule_timeout at ffffffff81724529
#3 [ffff88084477ddb8] n_tty_read at ffffffff8144f6a4
#4 [ffff88084477dec0] tty_read at ffffffff8144a94d
#5 [ffff88084477df08] vfs_read at ffffffff811bda65
#6 [ffff88084477df40] sys_read at ffffffff811be579
#7 [ffff88084477df80] system_
RIP: 00007fb735a52290 RSP: 00007fff290b4ee8 RFLAGS: 00010212
RAX: 0000000000000000 RBX: ffffffff8173196d RCX: 0000000010a8b550
RDX: 0000000000000001 RSI: 00007fff290b51af RDI: 0000000000000023
RBP: 00007fff290b51b0 R8: 00007fff290b51c0 R9: 00007fff290b5128
R10: 00007fff290b4f60 R11: 0000000000000246 R12: 00007fff290b53d0
R13: 000000000000003b R14: 0000000000000020 R15: 0000000000000010
ORIG_RAX: 0000000000000000 CS: 0033 SS: 002b
#5 [ffff88084477df08] vfs_read at ffffffff811bda65
ffff88084477df10: ffff880c65357c00 00007fff290b51af
ffff88084477df20: 0000000000000001 0000000000000000
ffff88084477df30: 000000000000001e ffff88084477df78
ffff88084477df40: ffffffff811be579
- PID: 7348 TASK: ffff88084354c800 CPU: 4 COMMAND: "pty" call_fastpath at ffffffff8173196d
#0 [ffff880844631c90] __schedule at ffffffff81724e19
#1 [ffff880844631cf8] schedule at ffffffff817252d9
#2 [ffff880844631d08] schedule_timeout at ffffffff81724529
#3 [ffff880844631db8] n_tty_read at ffffffff8144f6a4
#4 [ffff880844631ec0] tty_read at ffffffff8144a94d
#5 [ffff880844631f08] vfs_read at ffffffff811bda65
#6 [ffff880844631f40] sys_read at ffffffff811be579
#7 [ffff880844631f80] system_
RIP: 00007fb735a52290 RSP: 00007fff290b4ee8 RFLAGS: 00010206
RAX: 0000000000000000 RBX: ffffffff8173196d RCX: 000000007c9d4d40
RDX: 0000000000000001 RSI: 00007fff290b51af RDI: 0000000000000024
RBP: 00007fff290b51b0 R8: 00007fff290b51c0 R9: 00007fff290b5128
R10: 00007fff290b4f60 R11: 0000000000000246 R12: 00007fff290b53d0
R13: 000000000000003b R14: 0000000000000021 R15: 0000000000000010
ORIG_RAX: 0000000000000000 CS: 0033 SS: 002b
#5 [ffff880844631f08] vfs_read at ffffffff811bda65
ffff880844631f10: ffff880c65357500 00007fff290b51af
ffff880844631f20: 0000000000000001 0000000000000000
ffff880844631f30: 000000000000001e ffff880844631f78
ffff880844631f40: ffffffff811be579
- Files opened by PID 7347 and 7348:
FD FILE DENTRY INODE TYPE PATH tty_struct n_tty_data
....
35 ffff880c65357c00 ffff88085f5dbc80 ffff880c674e5fd8 CHR /dev/ptmx 0xffff88085438ac00 0xffffc9001edfb000
...