[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash bug with ints beyond 2147483646
From: |
Marc Herbert |
Subject: |
Re: Bash bug with ints beyond 2147483646 |
Date: |
Thu, 04 Nov 2010 12:07:56 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc13 Thunderbird/3.1.6 |
Le 02/11/2010 19:48, Pete Gregory a écrit :
> Easy duplication method:
> echo {2147483640..2147483646}
> reports
> 2147483640 2147483641 2147483642 2147483643 2147483644 2147483645 2147483646
> echo {2147483640..2147483647}
> dies with a malloc error
- At other times I get this error:
*** glibc detected *** bash: corrupted double-linked list:
0x000000000232c8e0 ***
- And at yet other times bash gets stuck, see stack trace at the
bottom of this message.
-------------
Now sneaking another off-topic OOM comment (sorry!!)
I just tried to run a simple memory allocation bomb on my workstation
in these two configurations:
1. OOM killer + almost no swap (my usual config)
2. OOM killer disabled + big swap
In configuration 1. random processes are killed (bad), but quickly
(good). In configuration 2. my system becomes so sluggish I cannot
type: after some wasted time I have to pull out the power
plug. Configuration 1. might corrupt the data of some random
processes. Configuration 2. might corrupt whole file systems.
So in *my* (workstation) case, I really prefer to use the OOM killer.
Depending on what your goals are you might prefer to turn it off. It
is unfortunately not simple. See also: http://lwn.net/Articles/317814/
---------------
bash --version
GNU bash, version 4.1.7(1)-release (x86_64-redhat-linux-gnu)
#0 __lll_lock_wait_private () at
../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:97
#1 0x000000323007c138 in _L_lock_9162 () at malloc.c:3503
#2 0x0000003230079a32 in __libc_malloc (bytes=215557320320) at malloc.c:3657
#3 0x00000000004664c3 in xmalloc (bytes=35) at xmalloc.c:112
#4 0x000000000049f54e in history_filename (filename=0x16bc750
"/raid0/home/mherbert/.bash_history") at histfile.c:120
#5 0x000000000049f62b in history_do_write (filename=<value optimized out>,
nelements=1, overwrite=<value optimized out>) at histfile.c:438
#6 0x000000000045a579 in maybe_save_shell_history () at bashhist.c:425
#7 0x000000000045277b in termsig_handler (sig=11) at sig.c:525
#8 <signal handler called>
#9 malloc_consolidate (av=0x323037ae80) at malloc.c:5155
#10 0x0000003230078a56 in _int_malloc (av=0x323037ae80, bytes=<value optimized
out>) at malloc.c:4722
#11 0x0000003230079a3d in __libc_malloc (bytes=12) at malloc.c:3660
#12 0x00000000004664c3 in xmalloc (bytes=12) at xmalloc.c:112
#13 0x000000000047ea8e in itos (i=<value optimized out>) at itos.c:50
#14 0x00000000004595ce in mkseq (text=0x177d2e0 "{2147483640..2147483647}") at
braces.c:335
#15 expand_seqterm (text=0x177d2e0 "{2147483640..2147483647}") at braces.c:461
#16 brace_expand (text=0x177d2e0 "{2147483640..2147483647}") at braces.c:218
#17 0x000000000044a45c in brace_expand_word_list (list=<value optimized out>,
eflags=31) at subst.c:8790
#18 expand_word_list_internal (list=<value optimized out>, eflags=31) at
subst.c:9004
#19 0x000000000042ebef in execute_simple_command (simple_command=0x17840b0,
pipe_in=-1, pipe_out=-1, async=<value optimized out>,
fds_to_close=<value optimized out>) at execute_cmd.c:3657
#20 0x00000000004300fc in execute_command_internal (command=0x1784080,
asynchronous=<value optimized out>, pipe_in=-1, pipe_out=-1,
fds_to_close=0x17840d0)
at execute_cmd.c:742
#21 0x0000000000430e0e in execute_command (command=0x1784080) at
execute_cmd.c:379
#22 0x000000000041d526 in reader_loop () at eval.c:153
#23 0x000000000041ccde in main (argc=<value optimized out>,
argv=0x7fffc265b028, env=0x7fffc265b038) at shell.c:759