Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp417344ybb; Wed, 1 Apr 2020 02:35:10 -0700 (PDT) X-Google-Smtp-Source: APiQypK7y0lPRIaagZ3F3n90Afdl6x8p+GNV38WlzT0WluUzfMWEkF11/SVsPgTxKS97X58OnNYk X-Received: by 2002:aca:34c6:: with SMTP id b189mr2078310oia.63.1585733710712; Wed, 01 Apr 2020 02:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585733710; cv=none; d=google.com; s=arc-20160816; b=bURzxgldYbK92WFkuxNXXEESyBOItxURQW8N6NlEyssIrVOzrOA++ug6nQrYhxkC6l Cw2xsEZQ3z5KIcCnPJsvhKQgKmK2EuRdJ/na0z0zJHSTb9K4Pha2x80fBJc0gMkq8qW5 s4x3yG8DOB/amzcKbkYPwAN/MfvS3F6Cpx7i/nKim6mBJRkqOmRhZ6DRmmAL6efLl0Pr VjJLJxVaHYNkFzk5Si6xcAZM1/y1cHfefcQV1LSe41/KBtbo6hkGTEH+IgVa3yNA59NZ 5tqWYZowxu/yUOWSZ/Z5X6eCoCQ7bWcb76zKGQc/ryGIh4A3IJdvD9AT0X2A0bVnmWNz YywQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vUv/lbJ4IeUM8v6YQUNQdmYTTdjt5W9ALsyTWkj5050=; b=of11kdOKi96TKTJRBkO1q7koW1LWjn2PQ09H3UYYG59vZtcm/TZfywglDQ/LWHAi5s YhWWLHSuA9P0V68mDCcW6keEoRZhpl6TG50jKxalFcsPuviEpBSBFkzqjqqHho/Ri03V M1yQsjp14drBBlm3rxlIQOAd4ubBOgeFJ04smRCU1GqlxBH3GdAOf0w6v4MT6GC3BRwL B5URqv6vGCAJojKkrQyc7VGT79Mg7cbLAN+M0mdcQRyxQY9pYteiW+bcIsRShknMgUtz D7LT+NS6BaUsq4a3/iIedcMChU3ENLZPjzUmhuFF05VZG16Tf1E+u+PJifYX0NB4e6V8 HpRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cvdIZiUl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w81si688698oia.48.2020.04.01.02.34.58; Wed, 01 Apr 2020 02:35:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cvdIZiUl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731870AbgDAJdQ (ORCPT + 99 others); Wed, 1 Apr 2020 05:33:16 -0400 Received: from mail.skyhub.de ([5.9.137.197]:58780 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727541AbgDAJdQ (ORCPT ); Wed, 1 Apr 2020 05:33:16 -0400 Received: from zn.tnic (p200300EC2F0BCE001428728FF98D3445.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:ce00:1428:728f:f98d:3445]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E4F391EC013F; Wed, 1 Apr 2020 11:33:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1585733594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=vUv/lbJ4IeUM8v6YQUNQdmYTTdjt5W9ALsyTWkj5050=; b=cvdIZiUlXVMwZAWWu+rebyz6DuUQgk418JgIURTEFPeDyUFSFYnJyD+nmj204a50rLQH3F an6+bBJyJvt3fWIWgkmrp5vNY8OoluShWL7YZHP5xBMNRjejEerUNZ2i2pihKIU6FEWtrS IM63WzlbD0+JKpoZr3TOVqrwb/4glZI= Date: Wed, 1 Apr 2020 11:33:10 +0200 From: Borislav Petkov To: Nick Terrell Cc: Nick Terrell , linux-kernel@vger.kernel.org, Chris Mason , linux-kbuild@vger.kernel.org, x86@kernel.org, gregkh@linuxfoundation.org, Petr Malat , Kees Cook , Kernel Team , Adam Borowski , Patrick Williams , rmikey@fb.com, mingo@kernel.org, Patrick Williams , Sedat Dilek Subject: Re: [PATCH v4 6/8] x86: bump ZO_z_extra_bytes margin for zstd Message-ID: <20200401093310.GA13748@zn.tnic> References: <20200401053913.216783-1-nickrterrell@gmail.com> <20200401053913.216783-7-nickrterrell@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200401053913.216783-7-nickrterrell@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 10:39:11PM -0700, Nick Terrell wrote: > From: Nick Terrell > > 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 > --- > arch/x86/boot/header.S | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S > index 97d9b6d6c1af..b820875c5c95 100644 > --- a/arch/x86/boot/header.S > +++ b/arch/x86/boot/header.S > @@ -536,8 +536,14 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr > # the size-dependent part now grows so fast. > # > # extra_bytes = (uncompressed_size >> 8) + 65536 > +# > +# ZSTD compressed data grows by at most 3 bytes per 128K, and only has a 22 > +# byte fixed overhead but has a maximum block size of 128K, so it needs a > +# larger margin. > +# > +# extra_bytes = (uncompressed_size >> 8) + 131072 > > -#define ZO_z_extra_bytes ((ZO_z_output_len >> 8) + 65536) > +#define ZO_z_extra_bytes ((ZO_z_output_len >> 8) + 131072) > #if ZO_z_output_len > ZO_z_input_len > # define ZO_z_extract_offset (ZO_z_output_len + ZO_z_extra_bytes - \ > ZO_z_input_len) > -- So why is this change unconditional if only this compression alg. needs it? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette