1 Star 0 Fork 29

wuzx / libffi

forked from src-openEuler / libffi 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-x86-64-Always-double-jump-table-slot-size-for-CET-71.patch 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
陈子扬 提交于 2022-07-29 07:25 . backport patches from upstream
From 3ac265d5c0e038e324bae29131dbc4bacb4935ea Mon Sep 17 00:00:00 2001
From: hjl-tools <hjl.tools@gmail.com>
Date: Sun, 15 May 2022 18:43:56 -0700
Subject: [PATCH] x86-64: Always double jump table slot size for CET (#710)
(#711)
When CET is enabled, double jump table slot size to add 4 bytes of ENDBR64
for CET. Since CET enabled clang doesn't have the LLVM assembler bug:
https://bugs.llvm.org/show_bug.cgi?id=21501
fixed by
commit 04d39260d64e08b8bfb3844109ad43d4055b2e8d
Author: Rafael Espindola <rafael.espindola@gmail.com>
Date: Wed Nov 4 23:50:29 2015 +0000
Simplify .org processing and make it a bit more powerful.
we can use .org to allocate jump table slot size to 16 bytes.
Conflict:NA
Reference:https://github.com/libffi/libffi/commit/3ac265d5c0e038e324bae29131dbc4bacb4935ea
---
src/x86/unix64.S | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/x86/unix64.S b/src/x86/unix64.S
index 8cf3a23..d9c5bd4 100644
--- a/src/x86/unix64.S
+++ b/src/x86/unix64.S
@@ -39,14 +39,13 @@
actual table. The entry points into the table are all 8 bytes.
The use of ORG asserts that we're at the correct location. */
/* ??? The clang assembler doesn't handle .org with symbolic expressions. */
-#if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
+#ifdef __CET__
+/* Double slot size to 16 byte to add 4 bytes of ENDBR64. */
+# define E(BASE, X) .balign 8; .org BASE + X * 16
+#elif defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__))
# define E(BASE, X) .balign 8
#else
-# ifdef __CET__
-# define E(BASE, X) .balign 8; .org BASE + X * 16
-# else
-# define E(BASE, X) .balign 8; .org BASE + X * 8
-# endif
+# define E(BASE, X) .balign 8; .org BASE + X * 8
#endif
/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
--
2.23.0
1
https://gitee.com/wuzx065891/libffi.git
git@gitee.com:wuzx065891/libffi.git
wuzx065891
libffi
libffi
master

搜索帮助