From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aUFAg-0000aI-UI for mharc-grub-devel@gnu.org; Fri, 12 Feb 2016 09:58:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUFAe-0000Wv-Ht for grub-devel@gnu.org; Fri, 12 Feb 2016 09:58:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUFAY-0007n4-K7 for grub-devel@gnu.org; Fri, 12 Feb 2016 09:58:08 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:32995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUFAY-0007n0-7E for grub-devel@gnu.org; Fri, 12 Feb 2016 09:58:02 -0500 Received: by mail-wm0-x243.google.com with SMTP id c200so3149597wme.0 for ; Fri, 12 Feb 2016 06:58:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type; bh=dcfOrHk5J3ERvcvJJ6YbDmubOiVt2Ebcm3m57JyIXvc=; b=ywSopuuPxd6d8pCpQwq69jBCduYOspGuVcks6kRg45mgBY5JbqowWujIZ16rwbqk/e 3iEQWdteuXbncio0hT7lD/8ul0FnGM8zKvgcChIHZdHX5ufGCrBMawz9G0sm4SydHSw6 kjYqCYpUEEyl24Sovn6oYIQUhIed6sCIn1HuSJgqbAiV+1KPR/te3/hJouUKPlAj5i3u /+v60dTcLGATAiUIN3uJqPf6sEYgCyScg1UiH4GkrsUHU+1gbWcADAfQyb3lsHY14Rfj prUuGew9MCSg3mvviWYMPPjRFXIhUmz81A2DHbnMXWKXp1TleMdlWW5EfWeiSEzd/XVr oXCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=dcfOrHk5J3ERvcvJJ6YbDmubOiVt2Ebcm3m57JyIXvc=; b=LYFikojvl28HKOWAQ+S5qzNgCsww61tWz1+287o3aeRyJj3Vy5l59WkFDfvM5wF769 wiDjf4vWJDbgN7MdUlbXUnrc16BmwgfEwNHybNq72zR7uh2DZw8rSa79DD8BR2UEZ3jG 4AZ/9aROmK0S4kO87Ir6URdlk2UIWb87wP04Bas/6ODPq4+mn4KuJr7dvUrkayrU0EK6 WdB3nEC5B/Mwd2zgTyUHht6L72mVlyepqVyWZ5Xs1UkNpRA1qiMeLeNnTkJjsN2TE2xV ItW/UXuDGdO4hYCLpAcwodPBUpGXtLDsNmSBz77Fb2dSZ72jCeTF1ywAdSVwSyqu5diF AiQg== X-Gm-Message-State: AG10YOTtmvfufLmrOpW2CmTrIoFXKbm+Bl+LKtJ0YlQRS+m9U+OO4n0uD6hOoySxidhRcg== X-Received: by 10.28.102.68 with SMTP id a65mr3697411wmc.12.1455289081381; Fri, 12 Feb 2016 06:58:01 -0800 (PST) Received: from ?IPv6:2620:0:105f:fd00:a2a8:cdff:fe64:b3b5? ([2620:0:105f:fd00:a2a8:cdff:fe64:b3b5]) by smtp.gmail.com with ESMTPSA id e198sm2792381wmd.0.2016.02.12.06.57.59 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Feb 2016 06:57:59 -0800 (PST) Subject: Re: [PATCH v2 2/6] relocator: Do not use memory region if its starta is smaller than size To: Daniel Kiper , xen-devel@lists.xenproject.org, grub-devel@gnu.org References: <1437402954-7375-1-git-send-email-daniel.kiper@oracle.com> <1437402954-7375-3-git-send-email-daniel.kiper@oracle.com> From: =?UTF-8?Q?Vladimir_'=cf=86-coder/phcoder'_Serbinenko?= Message-ID: <56BDF2F7.8040908@gmail.com> Date: Fri, 12 Feb 2016 15:57:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <1437402954-7375-3-git-send-email-daniel.kiper@oracle.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1rNat9eMNfEF7SBjIkqh8b4DPvSd5bebS" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 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 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2016 14:58:09 -0000 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--