commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 01/03: patches/git-malloc-hook: Cherry-pick from upstream


From: Samuel Thibault
Subject: [hurd] 01/03: patches/git-malloc-hook: Cherry-pick from upstream
Date: Wed, 01 Jun 2016 22:37:25 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch master
in repository hurd.

commit f094bdb4409cc624837908a5ee2566ae27707458
Author: Samuel Thibault <address@hidden>
Date:   Wed Jun 1 18:45:03 2016 +0000

    patches/git-malloc-hook: Cherry-pick from upstream
    
    to fix potential mach-defpager hang.
---
 debian/changelog               |   4 +-
 debian/patches/git-malloc-hook | 117 +++++++++++++++++++++++++++++++++++++++++
 debian/patches/series          |   1 +
 3 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 45b83ac..cf48474 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
 hurd (1:0.8.git20160522-3) UNRELEASED; urgency=medium
 
   * control: Bump Standards-Version to 3.9.8 (no change)
+  * patches/git-malloc-hook: Cherry-pick from upstream to fix potential
+    mach-defpager hang.
 
- -- Samuel Thibault <address@hidden>  Sun, 22 May 2016 20:41:40 +0200
+ -- Samuel Thibault <address@hidden>  Wed, 01 Jun 2016 18:44:53 +0000
 
 hurd (1:0.8.git20160522-2) unstable; urgency=medium
 
diff --git a/debian/patches/git-malloc-hook b/debian/patches/git-malloc-hook
new file mode 100644
index 0000000..6af21c8
--- /dev/null
+++ b/debian/patches/git-malloc-hook
@@ -0,0 +1,117 @@
+commit 6f6d157c55b6973f0a557b65269b212d9dcd1fbe
+Author: Samuel Thibault <address@hidden>
+Date:   Mon May 30 23:34:23 2016 +0200
+
+    Revert "drop the deprecated malloc/free hooks in hurd/mach-defpager"
+    
+    This reverts commit 8c49801c8f7e3f800cabedf8fca8ccec3cf35a22.
+    
+    The malloc hook is needed for calloc.
+
+diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
+index 35ddf9a..ef844ac 100644
+--- a/mach-defpager/kalloc.c
++++ b/mach-defpager/kalloc.c
+@@ -34,9 +34,23 @@
+ 
+ #include <mach.h>
+ #include <pthread.h>          /* for spin locks */
++#include <malloc.h>           /* for malloc_hook/free_hook */
+ 
+ #include "wiring.h"
+ 
++static void init_hook (void);
++static void *malloc_hook (size_t size, const void *caller);
++static void free_hook (void *ptr, const void *caller);
++
++/* GNU libc 2.14 defines this macro to declare hook variables as volatile.
++   Define it as empty for older libc versions.  */
++#ifndef __MALLOC_HOOK_VOLATILE
++# define __MALLOC_HOOK_VOLATILE
++#endif
++
++void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) = init_hook;
++
++
+ /* #define    DEBUG */
+ 
+ /*
+@@ -250,14 +264,21 @@ kfree(   void *data,
+       }
+ }
+ 
+-void *
+-malloc (size_t size)
++static void
++init_hook (void)
++{
++  __malloc_hook = malloc_hook;
++  __free_hook = free_hook;
++}
++
++static void *
++malloc_hook (size_t size, const void *caller)
+ {
+   return (void *) kalloc ((vm_size_t) size);
+ }
+ 
+-void
+-free (void *ptr)
++static void
++free_hook (void *ptr, const void *caller)
+ {
+   /* Just ignore harmless attempts at cleanliness.  */
+   /*  panic("free not implemented"); */
+commit 1a36fdfe7cf17aa23f0bd43eb6cca4d28e510def
+Author: Samuel Thibault <address@hidden>
+Date:   Mon May 30 23:57:49 2016 +0200
+
+    Complete allocation hooks
+    
+    * mach-defpager/kalloc.c (realloc_hook, memalign_hook): New functions.
+    (init_hook): Set __realloc_hook to realloc_hook and __memalign_hook to
+    memalign_hook.
+
+diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
+index ef844ac..e4ed12f 100644
+--- a/mach-defpager/kalloc.c
++++ b/mach-defpager/kalloc.c
+@@ -40,6 +40,8 @@
+ 
+ static void init_hook (void);
+ static void *malloc_hook (size_t size, const void *caller);
++static void *realloc_hook (void *ptr, size_t size, const void *caller);
++static void *memalign_hook (size_t alignment, size_t size, const void 
*caller);
+ static void free_hook (void *ptr, const void *caller);
+ 
+ /* GNU libc 2.14 defines this macro to declare hook variables as volatile.
+@@ -268,6 +270,8 @@ static void
+ init_hook (void)
+ {
+   __malloc_hook = malloc_hook;
++  __realloc_hook = realloc_hook;
++  __memalign_hook = memalign_hook;
+   __free_hook = free_hook;
+ }
+ 
+@@ -277,6 +281,20 @@ malloc_hook (size_t size, const void *caller)
+   return (void *) kalloc ((vm_size_t) size);
+ }
+ 
++static void *
++realloc_hook (void *ptr, size_t size, const void *caller)
++{
++  panic("realloc_hook not implemented");
++}
++
++static void *
++memalign_hook (size_t alignment, size_t size, const void *caller)
++{
++  if (alignment > vm_page_size)
++    panic("memalign_hook not implemented");
++  return malloc_hook(size, caller);
++}
++
+ static void
+ free_hook (void *ptr, const void *caller)
+ {
diff --git a/debian/patches/series b/debian/patches/series
index 76ebc04..e06fedf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -30,3 +30,4 @@ netdde_log.patch
 libports-iterate-refcount.patch
 git-0ab3825f250486453892e3e18a702a44538bff6d
 git-60d14f5b3c4ea27af6f4220a15947c328bc888ee
+git-malloc-hook

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]