mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
selftests/sgx: Include memory clobber for inline asm in test enclave
[ Upstream commit853a57a43e
] Add the "memory" clobber to the EMODPE and EACCEPT asm blocks to tell the compiler the assembly code accesses to the secinfo struct. This ensures the compiler treats the asm block as a memory barrier and the write to secinfo will be visible to ENCLU. Fixes:20404a8085
("selftests/sgx: Add test for EPCM permission changes") Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Kai Huang <kai.huang@intel.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Link: https://lore.kernel.org/all/20231005153854.25566-4-jo.vanbulck%40cs.kuleuven.be Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2cfae256a1
commit
bf92b82101
1 changed files with 5 additions and 3 deletions
|
@ -24,10 +24,11 @@ static void do_encl_emodpe(void *_op)
|
|||
secinfo.flags = op->flags;
|
||||
|
||||
asm volatile(".byte 0x0f, 0x01, 0xd7"
|
||||
:
|
||||
: /* no outputs */
|
||||
: "a" (EMODPE),
|
||||
"b" (&secinfo),
|
||||
"c" (op->epc_addr));
|
||||
"c" (op->epc_addr)
|
||||
: "memory" /* read from secinfo pointer */);
|
||||
}
|
||||
|
||||
static void do_encl_eaccept(void *_op)
|
||||
|
@ -42,7 +43,8 @@ static void do_encl_eaccept(void *_op)
|
|||
: "=a" (rax)
|
||||
: "a" (EACCEPT),
|
||||
"b" (&secinfo),
|
||||
"c" (op->epc_addr));
|
||||
"c" (op->epc_addr)
|
||||
: "memory" /* read from secinfo pointer */);
|
||||
|
||||
op->ret = rax;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue