Re: [PATCH] Free coroutine stack when releasing coroutine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

This wasn't pushed yet, but is the cause for
https://bugzilla.redhat.com/show_bug.cgi?id=1028637

I'll push this amended version (with same author/log as the initial
patch) if noone objects:
diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
index f960cfb..3663dfb 100644
--- a/gtk/coroutine_ucontext.c
+++ b/gtk/coroutine_ucontext.c
@@ -25,8 +25,10 @@
 #include <sys/types.h>
 #endif
 #include <sys/mman.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "coroutine.h"

 #ifndef MAP_ANONYMOUS
@@ -70,7 +72,8 @@ int coroutine_init(struct coroutine *co)
                            MAP_PRIVATE | MAP_ANONYMOUS,
                            -1, 0);
        if (co->cc.stack == MAP_FAILED)
-               return -1;
+               g_error("Failed to allocate %u bytes for coroutine stack:
%s",
+                       (unsigned)co->stack_size, strerror(errno));
        co->cc.entry = coroutine_trampoline;
        co->cc.release = _coroutine_release;
        co->exited = 0;


Christophe

On Fri, Sep 13, 2013 at 01:30:18PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> The coroutine_init function mmap's a stack for the
> ucontext coroutine, but nothing ever munmaps it.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  gtk/coroutine_ucontext.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
> index 79e4afe..f65337e 100644
> --- a/gtk/coroutine_ucontext.c
> +++ b/gtk/coroutine_ucontext.c
> @@ -48,6 +48,8 @@ static int _coroutine_release(struct continuation *cc)
>  			return ret;
>  	}
>  
> +	munmap(co->cc.stack, co->cc.stack_size);
> +
>  	co->caller = NULL;
>  
>  	return 0;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgpTXkFXtpbf5.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]