Skip to content

Commit 1fe094a

Browse files
committed
selftests/sgx: Remove incomplete ABI sanitization code in test enclave
JIRA: https://issues.redhat.com/browse/RHEL-22826 Upstream Status: merged into the linux.git commit 886c5be Author: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be> Date: Thu Oct 5 17:38:54 2023 +0200 selftests/sgx: Remove incomplete ABI sanitization code in test enclave As the selftest enclave is *not* intended for production, simplify the code by not initializing CPU configuration registers as expected by the ABI on enclave entry or cleansing caller-save registers on enclave exit. Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/all/da0cfb1e-e347-f7f2-ac72-aec0ee0d867d@intel.com/ Link: https://lore.kernel.org/all/20231005153854.25566-14-jo.vanbulck%40cs.kuleuven.be Signed-off-by: Vladis Dronov <vdronov@redhat.com>
1 parent 033547d commit 1fe094a

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

tools/testing/selftests/sgx/test_encl_bootstrap.S

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,11 @@ encl_entry_core:
5959

6060
push %rcx # push the address after EENTER
6161

62+
# NOTE: as the selftest enclave is *not* intended for production,
63+
# simplify the code by not initializing ABI registers on entry or
64+
# cleansing caller-save registers on exit.
6265
call encl_body
6366

64-
/* Clear volatile GPRs, except RAX (EEXIT function). */
65-
xor %rcx, %rcx
66-
xor %rdx, %rdx
67-
xor %rdi, %rdi
68-
xor %rsi, %rsi
69-
xor %r8, %r8
70-
xor %r9, %r9
71-
xor %r10, %r10
72-
xor %r11, %r11
73-
74-
# Reset status flags.
75-
add %rdx, %rdx # OF = SF = AF = CF = 0; ZF = PF = 1
76-
7767
# Prepare EEXIT target by popping the address of the instruction after
7868
# EENTER to RBX.
7969
pop %rbx

0 commit comments

Comments
 (0)