Skip to content
Permalink
Browse files

x86: only use lfence if x86 bcb config enabled

Work around a testcase problem, where we want to check some
logic for the bounds check bypass mitigation in the common
kernel code. By changing the ifdef to the x86-specific option
for these lfence instructions, we avoid IAMCU build errors
but still test the common code.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie authored and nashif committed Jun 30, 2019
1 parent e809289 commit a3a89ed9d59326aada63ebebd66cfdeb777a7d0f
Showing with 2 additions and 2 deletions.
  1. +1 −1 arch/x86/core/ia32/userspace.S
  2. +1 −1 arch/x86/core/ia32/x86_mmu.c
@@ -199,7 +199,7 @@ SECTION_FUNC(TEXT, z_x86_syscall_entry_stub)
jae _bad_syscall

_id_ok:
#ifdef CONFIG_BOUNDS_CHECK_BYPASS_MITIGATION
#ifdef CONFIG_X86_BOUNDS_CHECK_BYPASS_MITIGATION
/* Prevent speculation with bogus system call IDs */
lfence
#endif
@@ -162,7 +162,7 @@ int z_arch_buffer_validate(void *addr, size_t size, int write)
}
ret = 0;
out:
#ifdef CONFIG_BOUNDS_CHECK_BYPASS_MITIGATION
#ifdef CONFIG_X86_BOUNDS_CHECK_BYPASS_MITIGATION
__asm__ volatile ("lfence" : : : "memory");
#endif

0 comments on commit a3a89ed

Please sign in to comment.
You can’t perform that action at this time.