From patchwork Tue Dec 16 23:59:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 4286 Received: (qmail 998 invoked by alias); 16 Dec 2014 23:59:12 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 916 invoked by uid 89); 16 Dec 2014 23:59:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Use PTR_MANGLE on libgcc unwinder function pointers. Message-Id: <20141216235908.C2BCC2C2446@topped-with-meat.com> Date: Tue, 16 Dec 2014 15:59:08 -0800 (PST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=gsLHgE-tcZof7JiEQ_oA:9 a=CjuIK1q_8ugA:10 This makes the unwinder wrapper in libc consistent with the one in libpthread with regard to pointer mangling. Tested x86_64-linux-gnu. Thanks, Roland * sysdeps/gnu/unwind-resume.c: #include . (init): Apply PTR_MANGLE to pointers before storing them. (_Unwind_Resume, __gcc_personality_v0): Apply PTR_DEMANGLE to pointers before using them. --- a/sysdeps/gnu/unwind-resume.c +++ b/sysdeps/gnu/unwind-resume.c @@ -20,6 +20,7 @@ #include #include #include +#include #pragma GCC optimize ("-fexceptions", "-fasynchronous-unwind-tables") @@ -43,7 +44,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; } @@ -52,7 +55,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 @@ -63,6 +69,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); }