commit 8d513a350c2584b70a52c80eef1c6f9f93d63109 Author: Alexandre Frade Date: Mon Apr 6 02:13:08 2020 -0300 5.6.2-xanmod2 Signed-off-by: Alexandre Frade commit 85a974e1da920ce6a75f9ccfb3551fd68e510790 Author: Adam Borowski Date: Tue Mar 31 22:39:13 2020 -0700 .gitignore: add ZSTD-compressed files For now, that's arch/x86/boot/compressed/vmlinux.bin.zst but probably more will come, thus let's be consistent with all other compressors. Tested-by: Sedat Dilek Reviewed-by: Kees Cook Signed-off-by: Nick Terrell Signed-off-by: Adam Borowski commit 0635a4ea07c1a65a0cde41b0e5b1afe50a7129cd Author: Nick Terrell Date: Tue Mar 31 22:39:12 2020 -0700 x86: Add support for ZSTD compressed kernel * Add support for zstd compressed kernel * Bump the heap size for zstd. * Update the documentation. Integrates the ZSTD decompression code to the x86 pre-boot code. Zstandard requires slightly more memory during the kernel decompression on x86 (192 KB vs 64 KB), and the memory usage is independent of the window size. This patch has been boot tested with both a zstd and gzip compressed kernel on i386 and x86_64 using buildroot and QEMU. Additionally, this has been tested in production on x86_64 devices. We saw a 2 second boot time reduction by switching kernel compression from xz to zstd. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit 5c73eb782edbce3bfca11d4e0e482198b7d63a80 Author: Nick Terrell Date: Tue Mar 31 22:39:11 2020 -0700 x86: bump ZO_z_extra_bytes margin for zstd Bump the ZO_z_extra_bytes margin for zstd. Zstd needs 3 bytes per 128 KB, and has a 22 byte fixed overhead. Zstd needs to maintain 128 KB of space at all times, since that is the maximum block size. See the comments regarding in-place decompression added in lib/decompress_unzstd.c for details. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit d7b60d318d579f1186b85f923777cd36e099a2f8 Author: Nick Terrell Date: Tue Mar 31 22:39:10 2020 -0700 usr: add support for zstd compressed initramfs * Add support for a zstd compressed initramfs. * Add compression for compressing built-in initramfs with zstd. I have tested this patch by boot testing with buildroot and QEMU. Specifically, I booted the kernel with both a zstd and gzip compressed initramfs, both built into the kernel and separate. I ensured that the correct compression algorithm was used. I tested on arm, aarch64, i386, and x86_64. This patch has been tested in production on aarch64 and x86_64 devices. Additionally, I have performance measurements from internal use in production. On an aarch64 device we saw 19 second boot time improvement from switching from lzma to zstd (27 seconds to 8 seconds). On an x86_64 device we saw a 9 second boot time reduction from switching from xz to zstd. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit e6178ab5b1d4ea8b91cfdce43d4c23e608a0ee8c Author: Nick Terrell Date: Tue Mar 31 22:39:09 2020 -0700 init: add support for zstd compressed kernel * Adds the zstd cmd to scripts/Makefile.lib * Adds the HAVE_KERNEL_ZSTD and KERNEL_ZSTD options Architecture specific support is still needed for decompression. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit 549c042f9815309e02eb62593f53a7d1606b6eab Author: Nick Terrell Date: Tue Mar 31 22:39:08 2020 -0700 lib: add zstd support to decompress * Add unzstd() and the zstd decompress interface. * Add zstd support to decompress_method(). The decompress_method() and unzstd() functions are used to decompress the initramfs and the initrd. The __decompress() function is used in the preboot environment to decompress a zstd compressed kernel. The zstd decompression function allows the input and output buffers to overlap because that is used by x86 kernel decompression. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit 002e9a81fc909b6a24e18bf30cd8567d276530df Author: Nick Terrell Date: Tue Mar 31 22:39:07 2020 -0700 lib: prepare xxhash for preboot environment Don't export symbols if XXH_PREBOOT is defined. This change is necessary to get xxhash to work in a preboot environment, which is needed to support zstd-compressed kernels. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell commit 0b8123b69522c21422fff0e8bc54fc7927b3725b Author: Nick Terrell Date: Tue Mar 31 22:39:06 2020 -0700 lib: prepare zstd for preboot environment * Don't export symbols if ZSTD_PREBOOT is defined. * Remove a double definition of the CHECK_F macro when the zstd library is amalgamated. * Switch ZSTD_copy8() to __builtin_memcpy(), because in the preboot environment on x86 gcc can't inline `memcpy()` otherwise. * Limit the gcc hack in ZSTD_wildcopy() to the broken gcc version. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81388. These changes are necessary to get the build to work in the preboot environment, and to get reasonable performance. ZSTD_copy8() and ZSTD_wildcopy() are in the core of the zstd hot loop. So outlining these calls to memcpy(), and having an extra branch are very detrimental to performance. Reviewed-by: Kees Cook Tested-by: Sedat Dilek Signed-off-by: Nick Terrell