cryptdisks_start modifies echo setting of invoking stty

Bug #1301086 reported by dc
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
cryptsetup (Debian)
Fix Released
Unknown
cryptsetup (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Calling cryptdisks_start manually will modify the "echo" setting of the calling stty.

root@darkcharl:~# cryptdisks_start terra
 * Starting crypto disk... * terra (starting)..
Unlocking the disk /dev/disk/by-uuid/8eefaccb-7488-4cb2-89e0-a67d2106bf17 (terra)
Enter passphrase: * terra (started)... [ OK ]
root@darkcharl:~# speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
root@darkcharl:~# root@darkcharl:~#
root@darkcharl:~#
root@darkcharl:~# stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
root@darkcharl:~#

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: cryptsetup 2:1.6.1-1ubuntu1
ProcVersionSignature: Ubuntu 3.13.0-20.42-generic 3.13.7
Uname: Linux 3.13.0-20-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.14-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Apr 1 20:27:48 2014
InstallationDate: Installed on 2012-04-27 (704 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120423)
SourcePackage: cryptsetup
UpgradeStatus: Upgraded to trusty on 2014-03-28 (4 days ago)
crypttab:
 # <target name> <source device> <key file> <options>
 terra UUID=8eefaccb-7488-4cb2-89e0-a67d2106bf17 none luks,noauto
 #storage UUID=4ad0c783-0825-4d8e-9a1d-2706dce111a9 none luks,noauto

Related branches

Revision history for this message
dc (darkcharl) wrote :
Revision history for this message
dc (darkcharl) wrote :

This is the output of cryptdisks_start with tracing (option -x) enabled in shell.

Revision history for this message
dc (darkcharl) wrote :

The culprit appears to be /lib/cryptsetup/askpass:

root@darkcharl:~# stty -a
speed 38400 baud; rows 55; columns 186; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
root@darkcharl:~#
root@darkcharl:~# /lib/cryptsetup/askpass Passphrase:
Passphrase:testmeroot@darkcharl:~# speed 38400 baud; rows 55; columns 186; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

 2078 /lib/cryptsetup/askpass Passphrase:
 2079 stty -a
 2080 stty echo
 2081 stty -a
 2082 /lib/cryptsetup/askpass Passphrase:
 2083 stty -a
 2084 stty echo

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cryptsetup (Ubuntu):
status: New → Confirmed
Revision history for this message
gweg (gweg) wrote :

I see this exact problem with /lib/cryptsetup/askpass in Debian jessie

Revision history for this message
dc (darkcharl) wrote :

The problem appears to stem from disable_method(NULL) not getting called, thus, console_finish not being called, either. Askpass seems to be a script external to cryptsetup (debian/ubuntu specific). Have a fix. I'll submit a patch.

dc (darkcharl)
Changed in cryptsetup (Ubuntu):
status: Confirmed → Fix Released
status: Fix Released → Fix Committed
Steve Langasek (vorlon)
Changed in cryptsetup (Ubuntu):
status: Fix Committed → Triaged
Revision history for this message
dc (darkcharl) wrote :

Attaching the debdiff for those who need the fix before my merge request gets accepted.

Revision history for this message
dc (darkcharl) wrote :

Attaching debdiff for those who need the fix before merge request gets accepted.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "package patch" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Revision history for this message
Brian Murray (brian-murray) wrote :

It'd probably be a good idea to forward patch and debugging information to debian also.

Changed in cryptsetup (Ubuntu):
importance: Undecided → Medium
Changed in cryptsetup (Debian):
status: Unknown → New
Revision history for this message
dc (darkcharl) wrote :

I sent an email to the referred bug report and subscribed to the bug.

Revision history for this message
dc (darkcharl) wrote :

Have not received any response from upstream yet.

Revision history for this message
dc (darkcharl) wrote :

Instead of updating the code, should we create a separate patch in the interim that can be released and easily discarded?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cryptsetup - 2:1.6.1-1ubuntu2

---------------
cryptsetup (2:1.6.1-1ubuntu2) utopic; urgency=medium

  * debian/askpass.c:
    - Fix bug (LP: #1301086) where askpass fails to restore terminal
      settings.
 -- Robert Barabas <dc@0xdc.org> Fri, 18 Apr 2014 14:08:51 -0400

Changed in cryptsetup (Ubuntu):
status: Triaged → Fix Released
Changed in cryptsetup (Debian):
status: New → Fix Committed
Changed in cryptsetup (Debian):
status: Fix Committed → Fix Released
Revision history for this message
Mike Doherty (doherty) wrote :

When will the fix be released for trusty?

Revision history for this message
Sezer Yalcin (sy-y) wrote :

This needs to be fixed in Trusty as well.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.