e111a16404
Busybox crashes due to no mode being given when opening:
$ ./busybox truncate -s 1M foo
*** invalid open64 call: O_CREAT without mode ***: ./busybox terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f66d921338f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f66d92aac9c]
/lib/x86_64-linux-gnu/libc.so.6(+0xeb6aa)[0x7f66d928b6aa]
./busybox[0x4899f9]
======= Memory map: ========
00400000-004d0000 r-xp 00000000 00:1a 137559 /home/ari/busybox/busybox
006cf000-006d0000 r--p 000cf000 00:1a 137559 /home/ari/busybox/busybox
006d0000-006d1000 rw-p 000d0000 00:1a 137559 /home/ari/busybox/busybox
006d1000-006d4000 rw-p 00000000 00:00 0
014e7000-01508000 rw-p 00000000 00:00 0 [heap]
7f66d8f8a000-7f66d8fa0000 r-xp 00000000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d8fa0000-7f66d919f000 ---p 00016000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d919f000-7f66d91a0000 rw-p 00015000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f66d91a0000-7f66d935b000 r-xp 00000000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
7f66d935b000-7f66d955a000 ---p 001bb000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955a000-7f66d955e000 r--p 001ba000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
7f66d955e000-7f66d9560000 rw-p 001be000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so
7f66d9560000-7f66d9565000 rw-p 00000000 00:00 0
7f66d9565000-7f66d966a000 r-xp 00000000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
7f66d966a000-7f66d9869000 ---p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
7f66d9869000-7f66d986a000 r--p 00104000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986a000-7f66d986b000 rw-p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so
7f66d986b000-7f66d988e000 r-xp 00000000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a64000-7f66d9a67000 rw-p 00000000 00:00 0
7f66d9a8a000-7f66d9a8d000 rw-p 00000000 00:00 0
7f66d9a8d000-7f66d9a8e000 r--p 00022000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8e000-7f66d9a8f000 rw-p 00023000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so
7f66d9a8f000-7f66d9a90000 rw-p 00000000 00:00 0
7ffc47761000-7ffc47782000 rw-p 00000000 00:00 0 [stack]
7ffc477ab000-7ffc477ad000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
$
Fix this by simply always setting the mode, as it doesn't hurt even
when O_CREAT is not specified.
This bug is a regression introduced in
|
||
---|---|---|
.. | ||
libcoreutils | ||
basename.c | ||
cal.c | ||
cat.c | ||
catv.c | ||
chgrp.c | ||
chmod.c | ||
chown.c | ||
chroot.c | ||
cksum.c | ||
comm.c | ||
Config.src | ||
cp.c | ||
cut.c | ||
date.c | ||
dd.c | ||
df.c | ||
dirname.c | ||
dos2unix.c | ||
du.c | ||
echo.c | ||
env.c | ||
expand.c | ||
expr.c | ||
false.c | ||
fold.c | ||
fsync.c | ||
head.c | ||
hostid.c | ||
id_test.sh | ||
id.c | ||
install.c | ||
Kbuild.src | ||
length.c.disabled | ||
ln.c | ||
logname.c | ||
ls.c | ||
md5_sha1_sum.c | ||
mkdir.c | ||
mkfifo.c | ||
mknod.c | ||
mv.c | ||
nice.c | ||
nohup.c | ||
od_bloaty.c | ||
od.c | ||
printenv.c | ||
printf.c | ||
pwd.c | ||
readlink.c | ||
realpath.c | ||
rm.c | ||
rmdir.c | ||
seq.c | ||
shuf.c | ||
sleep.c | ||
sort.c | ||
split.c | ||
stat.c | ||
stty.c | ||
sum.c | ||
sync.c | ||
tac.c | ||
tail.c | ||
tee.c | ||
test_ptr_hack.c | ||
test.c | ||
touch.c | ||
tr.c | ||
true.c | ||
truncate.c | ||
tty.c | ||
uname.c | ||
uniq.c | ||
unlink.c | ||
usleep.c | ||
uudecode.c | ||
uuencode.c | ||
wc.c | ||
who.c | ||
whoami.c | ||
yes.c |