aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-09 14:47:05 +0100
committerDamjan Marion <damarion@cisco.com>2022-03-09 14:47:05 +0100
commit317cace6185ae134d78a38e1a20249baf751035e (patch)
treebc7121e745cbb169a4cd8bfdcbb7e8546982274d /src/vppinfra
parent7fc0ee7f65fbbced6e987f8bfd927a595b7ff7ee (diff)
vat: fix vat_suspend crash
Deadly combination is clib_{set,long}jmp + lazy linking + tail call compiler optimization. On the first call to clib_setjmp, dynamic linker executes loader code which then calls clib_setjmp, so stored stack position contains dynamic loader data. Tail call optimization simply jumps back to the calling code when clib_longjump is called and that results in wrong return address used from the stack. Change-Id: Ia7d8dbd5b2c425cdd0449374aa07ab6b684a330e Type: fix Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/clib.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index b3a2580e73a..76dd0ebf2ad 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -109,6 +109,12 @@
#define __clib_section(s) __attribute__ ((section(s)))
#define __clib_warn_unused_result __attribute__ ((warn_unused_result))
#define __clib_export __attribute__ ((visibility("default")))
+#ifdef __clang__
+#define __clib_no_tail_calls __attribute__ ((disable_tail_calls))
+#else
+#define __clib_no_tail_calls \
+ __attribute__ ((optimize ("no-optimize-sibling-calls")))
+#endif
#define never_inline __attribute__ ((__noinline__))