Skip to content

Commit

Permalink
Use PTR_MANGLE on libgcc unwinder function pointers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland McGrath committed Dec 16, 2014
1 parent f0481d9 commit 3eb5d2f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2014-12-16 Roland McGrath <roland@hack.frob.com>

* sysdeps/gnu/unwind-resume.c: #include <sysdep.h>.
(init): Apply PTR_MANGLE to pointers before storing them.
(_Unwind_Resume, __gcc_personality_v0): Apply PTR_DEMANGLE to pointers
before using them.

2014-12-16 Joseph Myers <joseph@codesourcery.com>

[BZ #17719]
Expand Down
15 changes: 12 additions & 3 deletions sysdeps/gnu/unwind-resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <stdio.h>
#include <unwind.h>
#include <gnu/lib-names.h>
#include <sysdep.h>

static void (*libgcc_s_resume) (struct _Unwind_Exception *exc)
__attribute__ ((noreturn));
Expand All @@ -41,7 +42,9 @@ init (void)
__libc_fatal (LIBGCC_S_SO
" must be installed for pthread_cancel to work\n");

PTR_MANGLE (resume);
libgcc_s_resume = resume;
PTR_MANGLE (personality);
libgcc_s_personality = personality;
}

Expand All @@ -50,7 +53,10 @@ _Unwind_Resume (struct _Unwind_Exception *exc)
{
if (__glibc_unlikely (libgcc_s_resume == NULL))
init ();
(*libgcc_s_resume) (exc);

__typeof (libgcc_s_resume) resume = libgcc_s_resume;
PTR_DEMANGLE (resume);
(*resume) (exc);
}

_Unwind_Reason_Code
Expand All @@ -61,6 +67,9 @@ __gcc_personality_v0 (int version, _Unwind_Action actions,
{
if (__glibc_unlikely (libgcc_s_personality == NULL))
init ();
return (*libgcc_s_personality) (version, actions, exception_class,
ue_header, context);

__typeof (libgcc_s_personality) personality = libgcc_s_personality;
PTR_DEMANGLE (personality);

return (*personality) (version, actions, exception_class, ue_header, context);
}

0 comments on commit 3eb5d2f

Please sign in to comment.