FS#47173 - [linux-grsec] PAX: size overflow detected in function ext4_mark_iloc_dirty

Attached to Project: Community Packages
Opened by Sairon Istyar (saironiq) - Wednesday, 25 November 2015, 09:28 GMT
Last edited by Daniel Micay (thestinger) - Friday, 18 December 2015, 06:57 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Daniel Micay (thestinger)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Transmission gets killed after calling fallocate(),
affected partition becomes unusable (jbd2 kernel thread hangs),
system reset required. Didn't occur with the previous linux-grsec version.

Additional info:
* package version(s)
linux-grsec 4.2.6.201511211841-1
paxd 30-1
transmission-cli 2.84-1
* config and/or log files etc.
see attached log

Steps to reproduce:
* start a torrent download in transmission
This task depends upon

Closed by  Daniel Micay (thestinger)
Friday, 18 December 2015, 06:57 GMT
Reason for closing:  Fixed
Comment by Alex W (awh) - Wednesday, 25 November 2015, 15:14 GMT
Confirming this happening on 4.2.6.201511211841-1 with btrfs (as my rootfs). Firefox was the catalyst for me - after opening it it wasn't interruptable and then shortly after there was an entire system freeze (REISUBing didn't work).
Attached kernel log of the pax overflow error, it's similar to the original.
Comment by Daniel Micay (thestinger) - Wednesday, 25 November 2015, 20:55 GMT
They're already aware of the ext4 issue so hopefully it will be fixed soon. Can watch to see what happens here:

https://forums.grsecurity.net/viewtopic.php?f=3&t=4324?

The btrfs issue is one that they didn't already have reported so it would be helpful to gather some more information about it. This case is likely a real bug in the kernel that's being caught rather than a false positive. I attached a patch for logging the values before the overflow occurs which might be helpful to figure out what's going on (can add it with the others in the PKGBUILD with patch -p1). It assigns the maximum possible value in some places via (u64)-1 and it might be what's triggering this.
Comment by Daniel Micay (thestinger) - Wednesday, 25 November 2015, 20:56 GMT
It will probably spam the logs quite a bit when there's disk activity, but the only bit that's actually relevant is whatever it logs directly before the SIZE_OVERFLOW failure. Could get saner logging by branching on an overflow check but it's not really worth the trouble.
Comment by Alex W (awh) - Wednesday, 25 November 2015, 21:22 GMT
I tried building from ABS with the patch included but grsecurity-3.1-4.2.6-201511211841.patch is 404ing. Was it removed because of these issues?
Comment by Daniel Micay (thestinger) - Wednesday, 25 November 2015, 21:49 GMT
No, the older patches are just always removed. I need to update the package in the repositories.
Comment by Daniel Micay (thestinger) - Wednesday, 25 November 2015, 21:50 GMT
You just need to change the timestamp variable to 201511232037 and it should work.
Comment by Alex W (awh) - Wednesday, 25 November 2015, 23:28 GMT
Yep, it's u64 size. See attached log - these were the very last lines in the journal before reboot.
Comment by Sairon Istyar (saironiq) - Thursday, 26 November 2015, 10:58 GMT
The ext4 issue should be fixed in the upcoming patch, see https://forums.grsecurity.net/viewtopic.php?f=3&t=4324#p15800
Comment by David Manouchehri (Manouchehri) - Saturday, 28 November 2015, 02:14 GMT
Experiencing the same issue when attempting to copy a large file across hard drives.

~ > mount | grep btrfs
/dev/mapper/crypt on / type btrfs (rw,noatime,compress=lzo,ssd,discard,space_cache,commit=300,subvolid=5,subvol=/)

https://gist.githubusercontent.com/Manouchehri/08ad11ea73accb2df108/raw/799cc66c2757af112e9d53553fa00f480c1d7184/dmesg.log

What's the last known good kernel? 4.2.6.201511182042-1 or 4.2.6.201511141543-1?
Comment by David Manouchehri (Manouchehri) - Saturday, 28 November 2015, 02:26 GMT
Downgrading to 4.2.6.201511182042-1 seems to have done the trick for the moment.

~ > sudo pacman -U /var/cache/pacman/pkg/linux-grsec-4.2.6.201511182042-1-x86_64.pkg.tar.xz
~ > reboot
~ > uname -a
Linux archbox 4.2.6.201511182042-1-grsec #1 SMP PREEMPT Wed Nov 18 23:28:18 EST 2015 x86_64 GNU/Linux
Comment by PaX Team (paxteam) - Sunday, 29 November 2015, 12:15 GMT
there's a proposed fix on the btrfs list now: http://marc.info/?t=144862133900003&r=1&w=2
Comment by Daniel Micay (thestinger) - Sunday, 29 November 2015, 17:31 GMT
The original fix wasn't complete but I've tested the revised one with a btrfs loop filesystem and at the very least the basic SQLite test suite passes. It looks quite sane to me (i.e. it won't do anything bad) but there could be overflows left.
Comment by Daniel Micay (thestinger) - Sunday, 29 November 2015, 17:32 GMT
Anyway, I included the revised patch in the current package so it's my fault if anything horrible happens :).

https://projects.archlinux.org/svntogit/community.git/tree/trunk/btrfs-overflow.patch?h=packages/linux-grsec
Comment by David Manouchehri (Manouchehri) - Sunday, 29 November 2015, 20:16 GMT
Thanks Daniel, 4.2.6.201511282239-1 looks good on my end.
Comment by David Manouchehri (Manouchehri) - Monday, 30 November 2015, 01:28 GMT
I may have spoken too soon.

Chromium has crashed my system twice in the past hour. Not sure if it's related; my logs are missing information about the crash, so unfortunately I don't have any more details.

Loading...