This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 0f378ef87f8c6b0e7fbd4c8e65bf5ba60356e353
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Sat Apr 13 09:36:22 2024 +0200
Add endbr32/64 instruction at the start of asm functions
Only do so when compiling with -fcf-protection (=> __CET__ is defined).
Inspired by:
https://github.com/openbsd/ports/commit/004ff08738baa98bea634e8b6b49dfd246dd0644
Comment:
Fixes SIGILL in tests on 11th gen intel (IBT)
https://git.enlightenment.org/old/legacy-imlib2/issues/23
---
src/lib/amd64_blend.S | 1 +
src/lib/amd64_blend_cmod.S | 1 +
src/lib/asm.h | 10 ++++++++++
src/lib/asm_blend.S | 1 +
src/lib/asm_blend_cmod.S | 1 +
src/lib/asm_rgba.S | 1 +
6 files changed, 15 insertions(+)
diff --git a/src/lib/amd64_blend.S b/src/lib/amd64_blend.S
index 5721913..a5b6862 100644
--- a/src/lib/amd64_blend.S
+++ b/src/lib/amd64_blend.S
@@ -97,6 +97,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba)
#define ENTER \
+ ENDBR_ ; \
pushq %rbp ; \
movq %rsp, %rbp ; \
pushq %rbx ; \
diff --git a/src/lib/amd64_blend_cmod.S b/src/lib/amd64_blend_cmod.S
index e75b868..8395077 100644
--- a/src/lib/amd64_blend_cmod.S
+++ b/src/lib/amd64_blend_cmod.S
@@ -105,6 +105,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba_cmod)
#define ENTER \
+ ENDBR_ ; \
pushq %rbp ; \
movq %rsp, %rbp ; \
pushq %rbx ; \
diff --git a/src/lib/asm.h b/src/lib/asm.h
index 59cc7c4..773cd8d 100644
--- a/src/lib/asm.h
+++ b/src/lib/asm.h
@@ -17,4 +17,14 @@
.size PR_(sym),.-PR_(sym); \
.align 8;
+#ifdef __CET__
+#if defined(DO_MMX_ASM)
+#define ENDBR_ endbr32
+#elif defined(DO_AMD64_ASM)
+#define ENDBR_ endbr64
+#endif
+#else
+#define ENDBR_
+#endif
+
#endif /* __ASM_H */
diff --git a/src/lib/asm_blend.S b/src/lib/asm_blend.S
index e598fde..6890948 100644
--- a/src/lib/asm_blend.S
+++ b/src/lib/asm_blend.S
@@ -61,6 +61,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba)
/*\ Common code \*/
/*\ Set MMX mode, save registers, load common parameters \*/
#define ENTER \
+ ENDBR_ ;\
pushl %ebp ;\
movl %esp, %ebp ;\
pushl %ebx ;\
diff --git a/src/lib/asm_blend_cmod.S b/src/lib/asm_blend_cmod.S
index 9fedb79..73fa9c4 100644
--- a/src/lib/asm_blend_cmod.S
+++ b/src/lib/asm_blend_cmod.S
@@ -79,6 +79,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba_cmod)
/*\ Common code \*/
/*\ Set MMX mode, save registers, load common parameters \*/
#define ENTER \
+ ENDBR_ ;\
pushl %ebp ;\
movl %esp, %ebp ;\
pushl %ebx ;\
diff --git a/src/lib/asm_rgba.S b/src/lib/asm_rgba.S
index 552756d..fd2a44e 100644
--- a/src/lib/asm_rgba.S
+++ b/src/lib/asm_rgba.S
@@ -36,6 +36,7 @@ FN_(imlib_get_cpuid)
/*\ Common code \*/
/*\ Save registers, load common parameters \*/
#define ENTER \
+ ENDBR_; \
pushl %ebp; \
movl %esp, %ebp; \
pushl %ebx; \
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.