Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Pry Mar <pryorm09@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: jgross@suse.com, xen-devel <xen-devel@lists.xenproject.org>,
	Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
Subject: Re: [Xen-devel] bug: unable to LZ4 decompress ub1910 installer kernel when launching domU
Date: Wed, 4 Dec 2019 17:20:17 -0800
Message-ID: <CAHnBbQ_3J9azmqO9PEK8QywZ3HZVtYgpi1KrP7=KyjvkZNveXw@mail.gmail.com> (raw)
In-Reply-To: <65509778-2d73-6ed4-1537-95c5ae54e36e@suse.com>

On 12/4/19, Jan Beulich <jbeulich@suse.com> wrote:
> On 04.12.2019 08:14, Jeremi Piotrowski wrote:
>> Any suggestions how to proceed?
>
> Actually here's a better version (I think).
>
> Jan
>
> lz4: refine commit 9143a6c55ef7 for the 64-bit case
>
> I clearly went too far there: While the LZ4_WILDCOPY() instances indeed
> need prior guarding, LZ4_SECURECOPY() needs this only in the 32-bit case
> (where it simply aliases LZ4_WILDCOPY()). "cpy" can validly point
> (slightly) below "op" in these cases, due to
>
> 		cpy = op + length - (STEPSIZE - 4);
>
> where length can be as low as 0 and STEPSIZE is 8. However, instead of
> removing the check via "#if !LZ4_ARCH64", refine it such that it would
> also properly work in the 64-bit case, aborting decompression instead
> of continuing on bogus input.
>
> Reported-by: Mark Pryor <pryorm09@gmail.com>
> Reported-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- unstable.orig/xen/common/lz4/decompress.c
> +++ unstable/xen/common/lz4/decompress.c
> @@ -147,7 +147,7 @@ static int INIT lz4_uncompress(const uns
>  				goto _output_error;
>  			continue;
>  		}
> -		if (unlikely((unsigned long)cpy < (unsigned long)op))
> +		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
>  			goto _output_error;
>  		LZ4_SECURECOPY(ref, op, cpy);
>  		op = cpy; /* correction */
> @@ -279,7 +279,7 @@ static int lz4_uncompress_unknownoutputs
>  				goto _output_error;
>  			continue;
>  		}
> -		if (unlikely((unsigned long)cpy < (unsigned long)op))
> +		if (unlikely((unsigned long)cpy < (unsigned long)op - (STEPSIZE - 4)))
>  			goto _output_error;
>  		LZ4_SECURECOPY(ref, op, cpy);
>  		op = cpy; /* correction */
>
>
This patch worked building xen-4.12.1 in Buster with python3.

I can now boot Focal kernel-5.3 which is LZ4 compressed. The domU can
boot as pv, pvh, using direct kernel (kernel/ramdisk), or pygrub.

I looked into booting as pvgrub2, thinking the code is universal, but
no. Thats why I CC'd Juergen. I wanted to do a kernel direct boot with
scripted pvgrub2 kernel.

I expect that once I build stubdom including this patch, then pvgrub
will work too.

Thanks for the attention to this bug, now solved.
PryMar56

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 20:33 Pry Mar
2019-10-24  8:12 ` Jan Beulich
2019-12-01 17:47   ` Jeremi Piotrowski
2019-12-02 14:28     ` Andy Smith
2019-12-03  8:02     ` Jan Beulich
2019-12-04  7:14       ` Jeremi Piotrowski
2019-12-04 13:10         ` Jan Beulich
2019-12-04 13:27         ` Jan Beulich
2019-12-05  1:20           ` Pry Mar [this message]
2019-12-06  6:25           ` Jeremi Piotrowski

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHnBbQ_3J9azmqO9PEK8QywZ3HZVtYgpi1KrP7=KyjvkZNveXw@mail.gmail.com' \
    --to=pryorm09@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=jeremi.piotrowski@gmail.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@lists.xen.org
	public-inbox-index xen-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git