Commit b0de59b5733d18b0d1974a060860a8b5c1b36a2e
Committed by
Greg Kroah-Hartman
1 parent
cb8081cb6b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
TTY: do not update atime/mtime on read/write
On http://vladz.devzero.fr/013_ptmx-timing.php, we can see how to find out length of a password using timestamps of /dev/ptmx. It is documented in "Timing Analysis of Keystrokes and Timing Attacks on SSH". To avoid that problem, do not update time when reading from/writing to a TTY. I am afraid of regressions as this is a behavior we have since 0.97 and apps may expect the time to be current, e.g. for monitoring whether there was a change on the TTY. Now, there is no change. So this would better have a lot of testing before it goes upstream. References: CVE-2013-0160 Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: stable <stable@vger.kernel.org> # after 3.9 is out Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 2 additions and 6 deletions Side-by-side Diff
drivers/tty/tty_io.c
... | ... | @@ -977,8 +977,7 @@ |
977 | 977 | else |
978 | 978 | i = -EIO; |
979 | 979 | tty_ldisc_deref(ld); |
980 | - if (i > 0) | |
981 | - inode->i_atime = current_fs_time(inode->i_sb); | |
980 | + | |
982 | 981 | return i; |
983 | 982 | } |
984 | 983 | |
985 | 984 | |
... | ... | @@ -1079,11 +1078,8 @@ |
1079 | 1078 | break; |
1080 | 1079 | cond_resched(); |
1081 | 1080 | } |
1082 | - if (written) { | |
1083 | - struct inode *inode = file->f_path.dentry->d_inode; | |
1084 | - inode->i_mtime = current_fs_time(inode->i_sb); | |
1081 | + if (written) | |
1085 | 1082 | ret = written; |
1086 | - } | |
1087 | 1083 | out: |
1088 | 1084 | tty_write_unlock(tty); |
1089 | 1085 | return ret; |