From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZkRZ-0002fR-98 for qemu-devel@nongnu.org; Tue, 07 May 2013 12:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZkRU-0006k0-K7 for qemu-devel@nongnu.org; Tue, 07 May 2013 12:08:45 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:35625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZkRU-0006jo-DF for qemu-devel@nongnu.org; Tue, 07 May 2013 12:08:40 -0400 Date: Tue, 7 May 2013 12:08:33 -0400 (EDT) From: Paolo Bonzini Message-ID: <26394976.7333823.1367942913958.JavaMail.root@redhat.com> In-Reply-To: References: <1367936238-12196-1-git-send-email-pbonzini@redhat.com> <1367936238-12196-2-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 01/40] memory: assert that PhysPageEntry's ptr does not overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: aik@ozlabs.ru, jan kiszka , qemu-devel@nongnu.org, qemulist@gmail.com, stefanha@redhat.com, david@gibson.dropbear.id.au ----- Messaggio originale ----- > Da: "Peter Maydell" > A: "Paolo Bonzini" > Cc: qemu-devel@nongnu.org, aik@ozlabs.ru, "jan kiszka" , qemulist@gmail.com, > stefanha@redhat.com, david@gibson.dropbear.id.au > Inviato: Marted=C3=AC, 7 maggio 2013 17:44:59 > Oggetto: Re: [Qemu-devel] [PATCH 01/40] memory: assert that PhysPageEntry= 's ptr does not overflow >=20 > On 7 May 2013 15:16, Paolo Bonzini wrote: > > Signed-off-by: Paolo Bonzini > > --- > > exec.c | 2 ++ > > 1 files changed, 2 insertions(+), 0 deletions(-) > > > > diff --git a/exec.c b/exec.c > > index 19725db..2e5b89a 100644 > > --- a/exec.c > > +++ b/exec.c > > @@ -719,6 +719,8 @@ static void destroy_all_mappings(AddressSpaceDispat= ch > > *d) > > > > static uint16_t phys_section_add(MemoryRegionSection *section) > > { > > + assert(phys_sections_nb < TARGET_PAGE_SIZE); > > + > > if (phys_sections_nb =3D=3D phys_sections_nb_alloc) { > > phys_sections_nb_alloc =3D MAX(phys_sections_nb_alloc * 2, 16)= ; > > phys_sections =3D g_renew(MemoryRegionSection, phys_sections, >=20 > Why is the limit we're asserting not the same as the maximum > size that we pass to g_renew() below? That's a minimum size, isn't it? I'm asserting that the physical section number doesn't overflow into the page, since the TLB entries are stored as a combination of the two. Paolo