Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 552642 - sys-kernel/hardened-sources-3.19.1 PAX: size overflow detected in function unlzma
Summary: sys-kernel/hardened-sources-3.19.1 PAX: size overflow detected in function un...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-20 14:50 UTC by Vladimir Lushnikov
Modified: 2015-09-10 22:20 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Lushnikov 2015-06-20 14:50:50 UTC
Since the 3.19 kernel series (I started testing with 3.19.1) the LZMA initramfs image decompression has not been working. After getting the earlyprintk output via USB debug, I see the following in the kernel logs:

[    0.342973] PAX: size overflow detected in function unlzma lib/decompress_unlzma.c:607 cicus.202_642 max, count: 5

After looking around I saw #548505 which had a similar issue with bzip2. After disabling LZMA support and enable bzip2 everything looks fine on sys-kernel/hardened-sources-4.0.5. 

decompress_unlzma.c has not changed between 3.18 and 4.0.

Reproducible: Always
Comment 1 Vladimir Lushnikov 2015-06-20 14:52:18 UTC
Related to: https://bugs.gentoo.org/show_bug.cgi?id=548508

Steps to reproduce: 

1. Create a lzma-compressed initramfs on any kernel between 3.19.1-hardened and 4.0.5-hardened
2. Enable the pax overflow plugin
3. Try to boot linux with said initramfs
Comment 2 Vladimir Lushnikov 2015-06-20 14:52:48 UTC
Gcc version:

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.4/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.4/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.8.4/work/gcc-4.8.4/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.4/python --enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.8.4 p1.6, pie-0.6.1' --enable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --enable-lto --without-cloog --disable-libsanitizer
Thread model: posix
gcc version 4.8.4 (Gentoo Hardened 4.8.4 p1.6, pie-0.6.1)
Comment 3 Anthony Basile gentoo-dev 2015-06-20 15:10:05 UTC
(In reply to Vladimir Lushnikov from comment #1)
> Related to: https://bugs.gentoo.org/show_bug.cgi?id=548508
> 
> Steps to reproduce: 
> 
> 1. Create a lzma-compressed initramfs on any kernel between 3.19.1-hardened
> and 4.0.5-hardened
> 2. Enable the pax overflow plugin
> 3. Try to boot linux with said initramfs

Is this fixed on 4.0.5?
Comment 4 Vladimir Lushnikov 2015-06-20 15:29:27 UTC
No, not fixed in 4.0.5 (apologies if my range was confusing)
Comment 5 PaX Team 2015-06-20 22:56:17 UTC
can you try the following patch please?

--- a/lib/decompress_unlzma.c     2014-10-05 21:52:23.767986012 +0200
+++ b/lib/decompress_unlzma.c     2015-06-21 00:10:34.632649318 +0200
@@ -39,10 +39,10 @@

 #define        MIN(a, b) (((a) < (b)) ? (a) : (b))

-static long long INIT read_int(unsigned char *ptr, int size)
+static unsigned long long INIT read_int(unsigned char *ptr, int size)
 {
        int i;
-       long long ret = 0;
+       unsigned long long ret = 0;

        for (i = 0; i < size; i++)
                ret = (ret << 8) | ptr[size-i-1];
Comment 6 Vladimir Lushnikov 2015-06-29 07:38:15 UTC
Thanks for the patch, it works.
Comment 7 Anthony Basile gentoo-dev 2015-06-29 16:08:59 UTC
(In reply to Vladimir Lushnikov from comment #6)
> Thanks for the patch, it works.

@pipacs, did that land yet in a grsec patcset?
Comment 8 PaX Team 2015-06-29 16:39:37 UTC
(In reply to Anthony Basile from comment #7)
> @pipacs, did that land yet in a grsec patcset?

sure, a few days ago (you can also check the grsec changelog, we always put an url back to the bugreport if one exists ;).