Mercurial > hg > release > heapstats-1.0
changeset 78:ec74982008b5 default tip
Bug 3421: Override functions might crash on Fedora 26
Reviewed-by: ykubota
https://github.com/HeapStats/heapstats/pull/110
author | Yasumasa Suenaga <yasuenag@gmail.com> |
---|---|
date | Tue, 18 Jul 2017 12:02:27 +0900 |
parents | 31e2f34f62d5 |
children | |
files | agent/ChangeLog agent/src/overrideFunc.S |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/ChangeLog Wed Jul 05 14:02:51 2017 +0900 +++ b/agent/ChangeLog Tue Jul 18 12:02:27 2017 +0900 @@ -1,3 +1,7 @@ +2017-07-18 Yasumasa Suenaga <yasuenag@gmail.com> + + * Bug 3421: Override functions might crash on Fedora 26 + 2017-07-05 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> * Bump to 1.0.8
--- a/agent/src/overrideFunc.S Wed Jul 05 14:02:51 2017 +0900 +++ b/agent/src/overrideFunc.S Tue Jul 18 12:02:27 2017 +0900 @@ -1,7 +1,7 @@ /*! * \file overrideFunc.S * \brief This file is used to override JVM inner function.<br> - * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2017 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,7 +25,9 @@ #define OVERRIDE_FUNC_DEFINE(header, ary_idx) \ .global header##_override_func_##ary_idx ; \ .type header##_override_func_##ary_idx, @function; \ - header##_override_func_##ary_idx: ; + header##_override_func_##ary_idx: ; \ + push %rbp; \ + mov %rsp, %rbp; #if defined(__amd64__) @@ -163,6 +165,8 @@ #define OVERRIDE_CALLBACK_DEFINE(header, ary_idx, func) \ OVERRIDE_FUNC_DEFINE(header, ary_idx) \ + /* Stack alignment */ \ + sub $8, %rsp; \ \ /* Get all override info. */ ; \ GET_ALL_FUNC_ADDR(header, ary_idx) \ @@ -439,6 +443,10 @@ #if defined(__amd64__) pop %r11 DO_LOAD_REG + /* Restore stack pointer */ + mov %rbp, %rsp; + /* Restore base pointer */ + pop %rbp; jmp *%r11 #elif defined(__i386__) addl $0x4, %esp @@ -450,6 +458,10 @@ .RETURN_CALLER_FUNC: #if defined(__amd64__) + /* Restore stack pointer */ + mov %rbp, %rsp; + /* Restore base pointer */ + pop %rbp; /* Return caller. Return address exists on top of stack. */ /* We need to pop return address from stack. */ pop %r11