lkml.org 
[lkml]   [2019]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 10/20] x86: avoid W^X being broken during modules loading
From
Date
> On Feb 11, 2019, at 10:29 AM, Borislav Petkov <bp@alien8.de> wrote:
>
>> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
>> index 76d482a2b716..69f3e650ada8 100644
>> --- a/arch/x86/kernel/alternative.c
>> +++ b/arch/x86/kernel/alternative.c
>> @@ -667,15 +667,29 @@ void __init alternative_instructions(void)
>> * handlers seeing an inconsistent instruction while you patch.
>> */
>> void *__init_or_module text_poke_early(void *addr, const void *opcode,
>> - size_t len)
>> + size_t len)
>> {
>> unsigned long flags;
>> - local_irq_save(flags);
>> - memcpy(addr, opcode, len);
>> - local_irq_restore(flags);
>> - sync_core();
>> - /* Could also do a CLFLUSH here to speed up CPU recovery; but
>> - that causes hangs on some VIA CPUs. */
>> +
>> + if (static_cpu_has(X86_FEATURE_NX) &&
>
> Not a fast path - boot_cpu_has() is fine here.

Are you sure about that? This path is still used when modules are loaded.

\
 
 \ /
  Last update: 2019-02-11 19:47    [W:0.087 / U:1.948 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site