WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] incorrect xfree for mini-os

To: INAKOSHI Hiroya <inakoshi.hiroya@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] incorrect xfree for mini-os
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Wed, 2 Apr 2008 11:52:48 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 02 Apr 2008 03:54:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <47F36351.4040106@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, INAKOSHI Hiroya <inakoshi.hiroya@xxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
References: <47F36351.4040106@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
INAKOSHI Hiroya, le Wed 02 Apr 2008 19:43:29 +0900, a écrit :
> xfree in extras/mini-os/lib/xmalloc.c is incorrect.
> 
> It has to check first if the memory to free is so big as to be freed
> directly by free_pages.
> 
> mini-os domains crash without this patch if they don't configure vfb
> correctly.
> 
> Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@xxxxxxxxxxxxxx>

Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

> diff -r db943e8d1051 extras/mini-os/lib/xmalloc.c
> --- a/extras/mini-os/lib/xmalloc.c    Tue Apr 01 10:09:33 2008 +0100
> +++ b/extras/mini-os/lib/xmalloc.c    Wed Apr 02 19:34:40 2008 +0900
> @@ -208,6 +208,13 @@ void xfree(const void *p)
>      pad = (struct xmalloc_pad *)p - 1;
>      hdr = (struct xmalloc_hdr *)((char *)p - pad->hdr_size);
>  
> +    /* Big allocs free directly. */
> +    if ( hdr->size >= PAGE_SIZE )
> +    {
> +        free_pages(hdr, get_order(hdr->size));
> +        return;
> +    }
> +
>      /* We know hdr will be on same page. */
>      if(((long)p & PAGE_MASK) != ((long)hdr & PAGE_MASK))
>      {
> @@ -220,13 +227,6 @@ void xfree(const void *p)
>      {
>          printk("Should not be previously freed\n");
>          *(int*)0=0;
> -    }
> -
> -    /* Big allocs free directly. */
> -    if ( hdr->size >= PAGE_SIZE )
> -    {
> -        free_pages(hdr, get_order(hdr->size));
> -        return;
>      }
>  
>      /* Merge with other free block, or put in list. */

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel


-- 
Samuel
* x remarque qu'avec un peu de volonté, on peut faire du code de porc
dans d'importe quel langage Turing-complet
 -+- x sur #ens-mim - codons porc -+-

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>