lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Aug 2020 17:46:50 -0400
From:   Peter Geis <pgwipeout@...il.com>
To:     nolange79@...il.com
Cc:     linux-kernel@...r.kernel.org, Petr Malat <oss@...at.biz>,
        Kees Cook <keescook@...omium.org>,
        Adam Borowski <kilobyte@...band.pl>,
        Sedat Dilek <sedat.dilek@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Nick Terrell <terrelln@...com>,
        Russell King <linux@...linux.org.uk>,
        Arnd Bergmann <arnd@...db.de>, linux-tegra@...r.kernel.org
Subject: [PATCH] arm: Add support for ZSTD compressed kernel

Good Evening,

I had attempted to get this working as well, but have run into
difficulties with both my implementation and yours as well.
My implementation was almost the same as yours, with the exception of
also changing:
@@ -303,7 +305,7 @@ restart: adr r0, LC1

 #ifndef CONFIG_ZBOOT_ROM
  /* malloc space is above the relocated stack (64k max) */
- add r10, sp, #0x10000
+ add r10, sp, #0x30000
 #else
  /*
  * With ZBOOT_ROM the bss/stack is non relocatable,

On QEMU this implementation works fine.
However on bare metal tegra30, I get the following error:

Jumping to kernel at:4861 ms

C:0x80A000C0-0x8112BA40->0x8152C700-0x81C58080
Uncompressing Linux...

ZSTD-compressed dstSize is too small

 -- System halted

The only difference between the bare metal test and the qemu test is
the zImage with appended dtb is packaged in the android boot format
for the bare metal test.
Otherwise it's exactly the same file.

I had to modify the original zstd error message because it grouped
several errors together.
Here is my patch for that:

diff --git a/lib/decompress_unzstd.c b/lib/decompress_unzstd.c
index 062617bb0afe..89ac73e900ce 100644
--- a/lib/decompress_unzstd.c
+++ b/lib/decompress_unzstd.c
@@ -103,10 +103,14 @@ static int INIT handle_zstd_error(size_t ret,
void (*error)(char *x))
  error("Input is not in the ZSTD format (wrong magic bytes)");
  break;
  case ZSTD_error_dstSize_tooSmall:
+ error("ZSTD-compressed dstSize is too small");
+ break;
  case ZSTD_error_corruption_detected:
- case ZSTD_error_checksum_wrong:
  error("ZSTD-compressed data is corrupt");
  break;
+ case ZSTD_error_checksum_wrong:
+ error("ZSTD-compressed data checksum is wrong");
+ break;
  default:
  error("ZSTD-compressed data is probably corrupt");
  break;

Very Respectfully,
Peter Geis

Powered by blists - more mailing lists