Comment 14 for bug 1011477

Revision history for this message
Philipp Kern (pkern) wrote :

Verifies just fine for me, given the instructions:

$ sudo sysctl -w kernel.pid_max=4194304
kernel.pid_max = 4194304

With the old build:

$ lock=/var/lock/lockfile-create-test
$ lockfile-remove $lock
$ while ([ $BASHPID -lt 1000000 ]); do continue; done
$ (echo $BASHPID; lockfile-create $lock --use-pid; cat ${lock}.lock)
1004029
*** buffer overflow detected ***: lockfile-create terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7fdecf313817]
/lib/x86_64-linux-gnu/libc.so.6(+0x109710)[0x7fdecf312710]
/lib/x86_64-linux-gnu/libc.so.6(+0x108b79)[0x7fdecf311b79]
/lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0xdd)[0x7fdecf28513d]
/lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x1ae7)[0x7fdecf2534a7]
/lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x94)[0x7fdecf311c14]
/lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7fdecf311b5d]
/usr/lib/x86_64-linux-gnu/liblockfile.so.1(+0x1b26)[0x7fdecf5c9b26]
/usr/lib/x86_64-linux-gnu/liblockfile.so.1(lockfile_create+0x61)[0x7fdecf5c9dd1]
lockfile-create[0x400f21]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fdecf22a76d]
lockfile-create[0x4012c5]
======= Memory map: ========
00400000-00402000 r-xp 00000000 fc:00 1575056 /usr/bin/lockfile-create
00602000-00603000 r--p 00002000 fc:00 1575056 /usr/bin/lockfile-create
00603000-00604000 rw-p 00003000 fc:00 1575056 /usr/bin/lockfile-create
01566000-01587000 rw-p 00000000 00:00 0 [heap]
7fdeceff3000-7fdecf008000 r-xp 00000000 fc:00 394091 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdecf008000-7fdecf207000 ---p 00015000 fc:00 394091 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdecf207000-7fdecf208000 r--p 00014000 fc:00 394091 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdecf208000-7fdecf209000 rw-p 00015000 fc:00 394091 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fdecf209000-7fdecf3be000 r-xp 00000000 fc:00 394167 /lib/x86_64-linux-gnu/libc-2.15.so
7fdecf3be000-7fdecf5bd000 ---p 001b5000 fc:00 394167 /lib/x86_64-linux-gnu/libc-2.15.so
7fdecf5bd000-7fdecf5c1000 r--p 001b4000 fc:00 394167 /lib/x86_64-linux-gnu/libc-2.15.so
7fdecf5c1000-7fdecf5c3000 rw-p 001b8000 fc:00 394167 /lib/x86_64-linux-gnu/libc-2.15.so
7fdecf5c3000-7fdecf5c8000 rw-p 00000000 00:00 0
7fdecf5c8000-7fdecf5cb000 r-xp 00000000 fc:00 271728 /usr/lib/x86_64-linux-gnu/liblockfile.so.1.0
7fdecf5cb000-7fdecf7ca000 ---p 00003000 fc:00 271728 /usr/lib/x86_64-linux-gnu/liblockfile.so.1.0
7fdecf7ca000-7fdecf7cb000 r--p 00002000 fc:00 271728 /usr/lib/x86_64-linux-gnu/liblockfile.so.1.0
7fdecf7cb000-7fdecf7cc000 rw-p 00003000 fc:00 271728 /usr/lib/x86_64-linux-gnu/liblockfile.so.1.0
7fdecf7cc000-7fdecf7ee000 r-xp 00000000 fc:00 394028 /lib/x86_64-linux-gnu/ld-2.15.so
7fdecf9c3000-7fdecf9c6000 rw-p 00000000 00:00 0
7fdecf9eb000-7fdecf9ee000 rw-p 00000000 00:00 0
7fdecf9ee000-7fdecf9ef000 r--p 00022000 fc:00 394028 /lib/x86_64-linux-gnu/ld-2.15.so
7fdecf9ef000-7fdecf9f1000 rw-p 00023000 fc:00 394028 /lib/x86_64-linux-gnu/ld-2.15.so
7ffffd352000-7ffffd373000 rw-p 00000000 00:00 0 [stack]
7ffffd3ff000-7ffffd400000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
cat: /var/lock/lockfile-create-test.lock: No such file or directory

Let's install the new one:

$ sudo apt-get install liblockfile1=1.09-3ubuntu0.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 liblockfile1 : Depends: liblockfile-bin (>= 1.09-3ubuntu0.1)
E: Unable to correct problems, you have held broken packages.
$ sudo apt-get install liblockfile1=1.09-3ubuntu0.1 liblockfile-bin=1.09-3ubuntu0.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  liblockfile-bin liblockfile1
2 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Need to get 21.5 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://mirror/ubuntu/ precise-proposed/main liblockfile-bin amd64 1.09-3ubuntu0.1 [12.3 kB]
Get:2 http://mirror/ubuntu/ precise-proposed/main liblockfile1 amd64 1.09-3ubuntu0.1 [9,232 B]
Fetched 21.5 kB in 0s (472 kB/s)
(Reading database ... 372341 files and directories currently installed.)
Preparing to replace liblockfile-bin 1.09-3 (using .../liblockfile-bin_1.09-3ubuntu0.1_amd64.deb) ...
Unpacking replacement liblockfile-bin ...
Preparing to replace liblockfile1 1.09-3 (using .../liblockfile1_1.09-3ubuntu0.1_amd64.deb) ...
Unpacking replacement liblockfile1 ...
Processing triggers for man-db ...
Setting up liblockfile-bin (1.09-3ubuntu0.1) ...
Setting up liblockfile1 (1.09-3ubuntu0.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
pkern@kaos:/tmp$ (echo $BASHPID; lockfile-create $lock --use-pid; cat ${lock}.lock)
1006597
1006597