bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Race condition in read -t


From: Oleg Popov
Subject: Race condition in read -t
Date: Sat, 29 Aug 2015 02:52:49 +0300

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I. -I./include -I. -I./include -I./lib  
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
 -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' 
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' 
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -O2 -pipe -march=native 
-mtune=native
uname output: Linux thinkpad 4.1.6-hardened-r1 #1 SMP Wed Aug 26 04:44:35 MSK 
2015 x86_64 AMD A6-3400M APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.3
Patch Level: 42
Release Status: release

Description:
        Function reset_alarm() in read.def first resets SIGALRM handler and
        then cancels alarm. Sometimes, SIGALRM comes between those 2 calls and
        crashes (sub)shell.

Repeat-By:
        while sleep 0.00$RANDOM; do echo test; done | while true; do read -t 
0.00$RANDOM; echo $REPLY; done
        (usually takes a few seconds to crash, sometimes minutes)

Fix:
        Swap the lines in reset_alarm().




reply via email to

[Prev in Thread] Current Thread [Next in Thread]