Revision 9dcbeed4d7e11e1dcf5e55475de3754f0855d1c2 authored by David Sterba on 09 November 2015, 10:44:45 UTC, committed by Chris Mason on 25 November 2015, 13:19:50 UTC
The calculation of range length in btrfs_sync_file leads to signed
overflow. This was caught by PaX gcc SIZE_OVERFLOW plugin.

https://forums.grsecurity.net/viewtopic.php?f=1&t=4284

The fsync call passes 0 and LLONG_MAX, the range length does not fit to
loff_t and overflows, but the value is converted to u64 so it silently
works as expected.

The minimal fix is a typecast to u64, switching functions to take
(start, end) instead of (start, len) would be more intrusive.

Coccinelle script found that there's one more opencoded calculation of
the length.

<smpl>
@@
loff_t start, end;
@@
* end - start
</smpl>

CC: stable@vger.kernel.org
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
1 parent d5f2e33
History
File Mode Size
Makefile -rw-r--r-- 377 bytes
compat.c -rw-r--r-- 19.1 KB
compat_mq.c -rw-r--r-- 3.9 KB
ipc_sysctl.c -rw-r--r-- 5.4 KB
mq_sysctl.c -rw-r--r-- 2.9 KB
mqueue.c -rw-r--r-- 35.7 KB
msg.c -rw-r--r-- 24.1 KB
msgutil.c -rw-r--r-- 3.6 KB
namespace.c -rw-r--r-- 4.0 KB
sem.c -rw-r--r-- 56.1 KB
shm.c -rw-r--r-- 32.5 KB
syscall.c -rw-r--r-- 2.3 KB
util.c -rw-r--r-- 21.2 KB
util.h -rw-r--r-- 6.4 KB

back to top