Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aUmh1-00062E-KX for mharc-grub-devel@gnu.org; Sat, 13 Feb 2016 21:45:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUmgz-00061z-0O for grub-devel@gnu.org; Sat, 13 Feb 2016 21:45:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUmgt-0003K6-U0 for grub-devel@gnu.org; Sat, 13 Feb 2016 21:45:44 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:49591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUmgt-0003Jv-Gi for grub-devel@gnu.org; Sat, 13 Feb 2016 21:45:39 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1E2jaPP013873 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 14 Feb 2016 02:45:36 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u1E2jaqr012623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 14 Feb 2016 02:45:36 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u1E2jZKm011579; Sun, 14 Feb 2016 02:45:35 GMT Received: from dhcp-amer-vpn-rmdc-anyconnect-10-159-109-233.vpn.oracle.com (/10.159.109.233) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 13 Feb 2016 18:45:35 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: [PATCH] ieee1275: prevent buffer over-read From: Eric Snowberg In-Reply-To: <064AE656-A5FA-41D8-B335-B69E396BAD46@oracle.com> Date: Sat, 13 Feb 2016 19:45:42 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1455324637-45091-1-git-send-email-eric.snowberg@oracle.com> <064AE656-A5FA-41D8-B335-B69E396BAD46@oracle.com> To: The development of GNU GRUB X-Mailer: Apple Mail (2.2104) X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 Cc: Vladimir 'phcoder' Serbinenko 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: Sun, 14 Feb 2016 02:45:46 -0000 > On Feb 13, 2016, at 9:08 AM, Eric Snowberg = wrote: >=20 >>=20 >> On Feb 13, 2016, at 7:05 AM, Vladimir 'phcoder' Serbinenko = wrote: >>=20 >>=20 >>=20 >> Le sam. 13 f=C3=A9vr. 2016 01:51, Eric Snowberg = a =C3=A9crit : >> Prevent buffer over-read in grub_machine_mmap_iterate. This was >> causing phys_base from being calculated properly. This then >> caused the wrong value to be placed in ramdisk_image within >> struct linux_hdrs. Which prevented the ramdisk from loading on >> boot. >>=20 >> Newer SPARC systems contain more than 8 available memory entries. >>=20 >> For example on a T5-8 with 2TB of memory, the memory layout could >> look like this: >>=20 >> T5-8 Memory >> reg 00000000 30000000 0000003f b0000000 >> 00000800 00000000 00000040 00000000 >> 00001000 00000000 00000040 00000000 >> 00001800 00000000 00000040 00000000 >> 00002000 00000000 00000040 00000000 >> 00002800 00000000 00000040 00000000 >> 00003000 00000000 00000040 00000000 >> 00003800 00000000 00000040 00000000 >> available 00003800 00000000 0000003f ffcae000 >> 00003000 00000000 00000040 00000000 >> 00002800 00000000 00000040 00000000 >> 00002000 00000000 00000040 00000000 >> 00001800 00000000 00000040 00000000 >> 00001000 00000000 00000040 00000000 >> 00000800 00000000 00000040 00000000 >> 00000000 70000000 0000003f 70000000 >> 00000000 6eef8000 00000000 00002000 >> 00000000 30400000 00000000 3eaf6000 >> name memory >>=20 >> Signed-off-by: Eric Snowberg >> --- >> grub-core/kern/ieee1275/mmap.c | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >>=20 >> diff --git a/grub-core/kern/ieee1275/mmap.c = b/grub-core/kern/ieee1275/mmap.c >> index 911bb00..8df4e9b 100644 >> --- a/grub-core/kern/ieee1275/mmap.c >> +++ b/grub-core/kern/ieee1275/mmap.c >> @@ -25,7 +25,7 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, = void *hook_data) >> { >> grub_ieee1275_phandle_t root; >> grub_ieee1275_phandle_t memory; >> - grub_uint32_t available[32]; >> + grub_uint32_t available[64]; >> Please 512 at least so this can lands further down the road >=20 > Ok, I=E2=80=99ll change the array to 512 I tested this new patch out with 512, it doesn=E2=80=99t work well with = some older OBP versions. I get an error from OBP that I=E2=80=99ve = never seen before. I changed it to 128 and this seems to work. =20 Would you accept 128 instead? If so, I need to test it on some more = equipment before sending out the updated patch. >=20 >> grub_ssize_t available_size; >> grub_uint32_t address_cells =3D 1; >> grub_uint32_t size_cells =3D 1; >> @@ -49,6 +49,9 @@ grub_machine_mmap_iterate (grub_memory_hook_t hook, = void *hook_data) >> sizeof available, = &available_size)) >> return grub_error (GRUB_ERR_UNKNOWN_DEVICE, >> "couldn't examine /memory/available property"); >> + if (available_size > sizeof available) >> Brackets around available >> + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, >> + "/memory response buffer exceeded=E2=80=9D); >=20 > And I=E2=80=99ll add the brackets and resubmit >=20 >>=20 >> if (grub_ieee1275_test_flag = (GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS)) >> { >> -- >> 1.7.1 >>=20 >>=20 >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> https://lists.gnu.org/mailman/listinfo/grub-devel >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel