cpio crashes when LANG is empty.

Bug #909361 reported by rpisarev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cpio (Ubuntu)
New
Undecided
Unassigned

Bug Description

Howto reproduce bug:
Ubuntu 10.04 LTS run in CT on OpenVZ (ubuntu-10.04-minimal_10.04_amd64.tar.gz).
1 ) If run perl-script

"
$backup_tmp="/tmp/backup.cpio";
print 1;
open (CPIO,"|cpio -ocBv > $backup_tmp");
print CPIO "/etc/apache2/httpd.conf";
close (CPIO);
print 2;
sub backup(@_){
    open (CPIO,"|cpio -ocBvA -O $backup_tmp 2> /dev/null");
    foreach (@_) {
        print CPIO $_."\n";
    }
    close (CPIO);
}
print 3;
backup("/etc/apache2/ports.conf");
print 4;
"

then output:

1/etc/apache2/httpd.conf
1 block
23*** glibc detected *** cpio: malloc(): memory corruption: 0x0000000001d68300 ***
======= Backtrace: =========
/lib/libc.so.6(+0x775b6)[0x7fbda05845b6]
/lib/libc.so.6(+0x7b6d8)[0x7fbda05886d8]
/lib/libc.so.6(__libc_malloc+0x6e)[0x7fbda058958e]
cpio[0x415df9]
cpio[0x403b48]
cpio[0x404043]
cpio[0x4043f6]
cpio[0x406dc2]
cpio[0x408e74]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7fbda052bc4d]
cpio[0x402b19]
======= Memory map: ========
00400000-0041e000 r-xp 00000000 fd:02 10093364 /bin/cpio
0061d000-0061e000 r--p 0001d000 fd:02 10093364 /bin/cpio
0061e000-00620000 rw-p 0001e000 fd:02 10093364 /bin/cpio
01d68000-01d89000 rw-p 00000000 00:00 0 [heap]
7fbd9c000000-7fbd9c021000 rw-p 00000000 00:00 0
7fbd9c021000-7fbda0000000 ---p 00000000 00:00 0
7fbda02f6000-7fbda030c000 r-xp 00000000 fd:02 11404518 /lib/libgcc_s.so.1
7fbda030c000-7fbda050b000 ---p 00016000 fd:02 11404518 /lib/libgcc_s.so.1
7fbda050b000-7fbda050c000 r--p 00015000 fd:02 11404518 /lib/libgcc_s.so.1
7fbda050c000-7fbda050d000 rw-p 00016000 fd:02 11404518 /lib/libgcc_s.so.1
7fbda050d000-7fbda0685000 r-xp 00000000 fd:02 11404596 /lib/libc-2.11.1.so
7fbda0685000-7fbda0885000 ---p 00178000 fd:02 11404596 /lib/libc-2.11.1.so
7fbda0885000-7fbda0889000 r--p 00178000 fd:02 11404596 /lib/libc-2.11.1.so
7fbda0889000-7fbda088a000 rw-p 0017c000 fd:02 11404596 /lib/libc-2.11.1.so
7fbda088a000-7fbda088f000 rw-p 00000000 00:00 0
7fbda088f000-7fbda08af000 r-xp 00000000 fd:02 11404656 /lib/ld-2.11.1.so
7fbda0aa6000-7fbda0aa9000 rw-p 00000000 00:00 0
7fbda0aac000-7fbda0aae000 rw-p 00000000 00:00 0
7fbda0aae000-7fbda0aaf000 r--p 0001f000 fd:02 11404656 /lib/ld-2.11.1.so
7fbda0aaf000-7fbda0ab0000 rw-p 00020000 fd:02 11404656 /lib/ld-2.11.1.so
7fbda0ab0000-7fbda0ab1000 rw-p 00000000 00:00 0
7fff9d484000-7fff9d499000 rw-p 00000000 00:00 0 [stack]
7fff9d5fe000-7fff9d600000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
4

and any files not append to cpio.

2 ) # locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

The utility crash if LANG is empty.

3 ) If set locale: export LANG="ru_RU.UTF-8" then script done perfect:

1/etc/apache2/httpd.conf
1 блок
234

4 ) # locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

 5 ) uname -r
2.6.32-042stab044.11 (kernel on host-system)

rpisarev (ruslanpisarev)
description: updated
Revision history for this message
rpisarev (ruslanpisarev) wrote :

The script in Perl can be replaced by a simple example to bash:
"
#!/bin/bash
backup_tmp="/tmp/backup.cpio"
find /etc/apache2/ -name "httpd.conf" -print | cpio -ocBv > $backup_tmp
find /etc/apache2/ -name "ports.conf" -print | cpio -ocBvA -O $backup_tmp
"

Now checked cpio-2.10-orig, cpio-2.10-1ubuntu2 and cpio-2.11-orig from src. cpio-2.10-orig, cpio-2.10-1ubuntu2 in bash-test and perl-test crash.

cpio-2.11-orig work fine.
Started debugging...

Revision history for this message
rpisarev (ruslanpisarev) wrote :

If possible, pack cpio version 2.11. Memory corraption missing.
And more precisely, the utility crash if LANG is empty.

rpisarev (ruslanpisarev)
description: updated
summary: - cpio crashes when locale="POSIX"
+ cpio crashes when LANG is empty.
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.