Bug 108531 - btrfs crashes (with grsec)/has size overflow in extend_map (reading from written/moved files)
Summary: btrfs crashes (with grsec)/has size overflow in extend_map (reading from writ...
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: x86-64 Linux
: P1 high
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-27 13:58 UTC by alex
Modified: 2022-10-04 09:56 UTC (History)
4 users (show)

See Also:
Kernel Version: 4.2.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments
output kernel (411.72 KB, image/jpeg)
2015-11-27 13:58 UTC, alex
Details

Description alex 2015-11-27 13:58:12 UTC
Created attachment 195591 [details]
output kernel

Trigger:
I ran my backup script accidentally over a directory where a program of mine heavily wrote in files,moved them.
This seems to have triggered a size overflow in btrfs/extend_map.c (line 238) which was reported and blocked by pax.
It seems that reading from written or moved files can trigger this bug.

I don't know exactly if it is a btrfs upstream bug or a grsec bug.
My linux distro is Archlinux, with the exact kernel version: linux-grsec 4.2.6.201511232037-1.
Comment 1 Martin 2015-12-03 20:54:17 UTC
I had same bug. I reported it there
https://bugs.gentoo.org/show_bug.cgi?id=567046
After I applied this patch https://projects.archlinux.org/svntogit/community.git/tree/trunk/btrfs-overflow.patch?h=packages/linux-grsec btrfs didn't crash anymore. But as you can see in my bug report on gentoo em->block_len and merge->block_len has many times value ffffffffffffffff
Comment 2 David Sterba 2015-12-04 15:06:45 UTC
I can reproduce it locally, still investigating.
Comment 3 Martin 2016-01-10 19:13:03 UTC
Patch is included in new Gentoo packages. Did you know if values 0xffffffffffffffff on em->block_len and merge->block_len are correct? Or this patch is only workaround to handle overflow in filesystem without crash?

Note You need to log in before you can comment on or make changes to this bug.