# LC_ALL=en_US.ISO8859-1 bash
[root@fbsd12 ~]#^D
# LC_ALL=en_AU.UTF-8 bash
[root@fbsd12 ~]#
# LC_ALL=en_AU bash
bash: warning: setlocale: LC_ALL: cannot change locale (en_AU): No such file or directory
Segmentation fault (core dumped)
#
# cksum /usr/local/bin/bash
194901059 1249368 /usr/local/bin/bash
#
# gdb -q `which bash` ./bash.core
Reading symbols from /usr/local/bin/bash...
(No debugging symbols found in /usr/local/bin/bash)
[New LWP 100123]
Core was generated by `bash'.
Program terminated with signal SIGSEGV, Segmentation fault.
Sent by kill() from pid 987 and user 0.
#0 kill () at kill.S:3
3 kill.S: No such file or directory.
(gdb) bt
#0 kill () at kill.S:3
#1 0x00000000002bae0d in termsig_handler ()
#2 0x00000000002ba8d3 in termsig_sighandler ()
#3 <signal handler called>
#4 strlen (str=0x0) at /usr/src/lib/libc/string/strlen.c:101
#5 0x0000000000320b09 in _rl_init_locale ()
#6 0x0000000000320b46 in _rl_init_eightbit ()
#7 0x00000000002fedf0 in rl_initialize ()
#8 0x00000000002c5d77 in initialize_readline ()
#9 0x000000000026a415 in ?? ()
#10 0x0000000000270a76 in ?? ()
#11 0x000000000026e0f4 in ?? ()
#12 0x00000000002687be in yyparse ()
#13 0x00000000002684ac in parse_command ()
#14 0x00000000002681c7 in read_command ()
#15 0x000000000026800e in reader_loop ()
#16 0x00000000002674ae in main ()
(gdb) f 5
#5 0x0000000000320b09 in _rl_init_locale ()
(gdb) disass $pc-0x10, $pc+0x10
Dump of assembler code from 0x320af9 to 0x320b19:
0x0000000000320af9 <_rl_init_locale+169>: mov dh,0xc6
0x0000000000320afb <_rl_init_locale+171>: mov DWORD PTR [rip+0x16853],eax # 0x337354 <_rl_utf8locale>
0x0000000000320b01 <_rl_init_locale+177>: mov rdi,rbx
0x0000000000320b04 <_rl_init_locale+180>: call 0x3289d0 <strlen@plt>
=> 0x0000000000320b09 <_rl_init_locale+185>: lea rdi,[rax+0x1]
0x0000000000320b0d <_rl_init_locale+189>: call 0x2d4120 <xmalloc>
0x0000000000320b12 <_rl_init_locale+194>: mov rdi,rax
0x0000000000320b15 <_rl_init_locale+197>: mov rsi,rbx
0x0000000000320b18 <_rl_init_locale+200>: call 0x3289e0 <strcpy@plt>
End of assembler dump.
(gdb) i r $rdi
rdi 0x0 0
(gdb) disass _rl_init_locale
..
...
0x0000000000320ab0 <+96>: call 0x329180 <setlocale@plt>
0x0000000000320ab5 <+101>: mov rbx,rax
0x0000000000320ab8 <+104>: test rax,rax
0x0000000000320abb <+107>: je 0x320adf <_rl_init_locale+143>
0x0000000000320adf <+143>: xor r14d,r14d
0x0000000000320ae2 <+146>: jmp 0x320af7 <_rl_init_locale+167>
..
0x0000000000320af7 <+167>: movzx eax,r14b
0x0000000000320afb <+171>: mov DWORD PTR [rip+0x16853],eax # 0x337354 <_rl_utf8locale>
0x0000000000320b01 <+177>: mov rdi,rbx
0x0000000000320b04 <+180>: call 0x3289d0 <strlen@plt>