From: =?UTF-8?Q?Vladimir_'=cf=86-coder/phcoder'_Serbinenko?= Subject: Re: [PATCH v2 2/6] relocator: Do not use memory region if its starta is smaller than size Date: Fri, 12 Feb 2016 15:57:59 +0100 Message-ID: <56BDF2F7.8040908__22548.9417127848$1455289152$gmane$org@gmail.com> References: <1437402954-7375-1-git-send-email-daniel.kiper@oracle.com> <1437402954-7375-3-git-send-email-daniel.kiper@oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1517622995827209093==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aUFAZ-0002QB-4r for xen-devel@lists.xenproject.org; Fri, 12 Feb 2016 14:58:03 +0000 Received: by mail-wm0-f68.google.com with SMTP id 128so3133995wmz.3 for ; Fri, 12 Feb 2016 06:58:01 -0800 (PST) In-Reply-To: <1437402954-7375-3-git-send-email-daniel.kiper@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Daniel Kiper , xen-devel@lists.xenproject.org, grub-devel@gnu.org Cc: jgross@suse.com, keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.citrix.com, roy.franz@linaro.org, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, wei.liu2@citrix.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============1517622995827209093== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1rNat9eMNfEF7SBjIkqh8b4DPvSd5bebS" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1rNat9eMNfEF7SBjIkqh8b4DPvSd5bebS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Applied, thanks On 20.07.2015 16:35, Daniel Kiper wrote: > malloc_in_range() should not use memory region if its starta is smaller= > than size. Otherwise target wraps around and points to region which is > usually not a RAM, e.g.: >=20 > loader/multiboot.c:93: segment 0: paddr=3D0x800000, memsz=3D0x3f800000,= vaddr=3D0x800000 > lib/relocator.c:1241: min_addr =3D 0x0, max_addr =3D 0xffffffffffffffff= , target =3D 0x800000 > lib/relocator.c:434: trying to allocate in 0x800000-0xffffffffffffffff = aligned 0x1 size 0x3f800000 > lib/relocator.c:434: trying to allocate in 0x0-0x800000 aligned 0x1 siz= e 0x3f800000 > lib/relocator.c:434: trying to allocate in 0x0-0xffffffffffffffff align= ed 0x1 size 0x3f800000 > lib/relocator.c:1188: allocated: 0xffffffffc07fffff+0x3f800000 > lib/relocator.c:1277: allocated 0xffffffffc07fffff/0x800000 >=20 > Signed-off-by: Daniel Kiper > --- > grub-core/lib/relocator.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c > index f759c7f..4eee0c5 100644 > --- a/grub-core/lib/relocator.c > +++ b/grub-core/lib/relocator.c > @@ -748,7 +748,7 @@ malloc_in_range (struct grub_relocator *rel, > /* Found an usable address. */ > goto found; > } > - if (isinsidebefore && !isinsideafter && !from_low_priv) > + if (isinsidebefore && !isinsideafter && !from_low_priv && starta >=3D= size) > { > target =3D starta - size; > if (target > end - size) >=20 --1rNat9eMNfEF7SBjIkqh8b4DPvSd5bebS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREKAAYFAla98vcACgkQmBXlbbo5nOvoMQD+Ij71X5cCLCNFaSee4o1yhvUU ssz7QBm9mLeQa6kzT90BAJDM+awELXEQtZTl/iT7koBPJEClZk46Ep4woZGiea6W =R7YQ -----END PGP SIGNATURE----- --1rNat9eMNfEF7SBjIkqh8b4DPvSd5bebS-- --===============1517622995827209093== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============1517622995827209093==--