lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 23 Nov 2017 07:25:32 -0800
From:   Andy Lutomirski <luto@...nel.org>
To:     Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc:     Ingo Molnar <mingo@...nel.org>, Andy Lutomirski <luto@...nel.org>,
        X86 ML <x86@...nel.org>, Borislav Petkov <bpetkov@...e.de>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Brian Gerst <brgerst@...il.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 16/16] x86/entry/64: Move the IST stacks into cpu_entry_area

On Tue, Nov 21, 2017 at 6:45 AM, Andrey Ryabinin
<aryabinin@...tuozzo.com> wrote:
>
>
> On 11/21/2017 10:38 AM, Ingo Molnar wrote:
>>
>> * Andy Lutomirski <luto@...nel.org> wrote:
>>
>>>  /* May not be marked __init: used by software suspend */
>>>  void syscall_init(void)
>>>  {
>>> @@ -1627,7 +1637,7 @@ void cpu_init(void)
>>>       * set up and load the per-CPU TSS
>>>       */
>>>      if (!oist->ist[0]) {
>>> -            char *estacks = per_cpu(exception_stacks, cpu);
>>> +            char *estacks = get_cpu_entry_area(cpu)->exception_stacks;
>>>
>>>              for (v = 0; v < N_EXCEPTION_STACKS; v++) {
>>>                      estacks += exception_stack_sizes[v];
>>
>> This generates a new build warning:
>>
>>  /home/mingo/tip/arch/x86/kernel/cpu/common.c: In function ‘syscall_init’:
>>  /home/mingo/tip/arch/x86/kernel/cpu/common.c:1443:6: warning: unused variable ‘cpu’ [-Wunused-variable]
>>    int cpu = smp_processor_id();
>>
>> because 'cpu' is now unused in the !CONFIG_IA32_EMULATION part.
>>
>> The naive fix is something like the patch below, untested.
>>
>> Thanks,
>>
>>       Ingo
>>
>>  arch/x86/kernel/cpu/common.c | 30 ++++++++++++++++--------------
>>  1 file changed, 16 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>> index c7f3a0a19dce..557bad9f4179 100644
>> --- a/arch/x86/kernel/cpu/common.c
>> +++ b/arch/x86/kernel/cpu/common.c
>> @@ -1440,24 +1440,26 @@ void syscall_init(void)
>>       extern char _entry_trampoline[];
>>       extern char entry_SYSCALL_64_trampoline[];
>>
>> -     int cpu = smp_processor_id();
>> -
>>       wrmsr(MSR_STAR, 0, (__USER32_CS << 16) | __KERNEL_CS);
>>       wrmsrl(MSR_LSTAR, (unsigned long)get_cpu_entry_area(smp_processor_id())->entry_trampoline + (entry_SYSCALL_64_trampoline - _entry_trampoline));
>
>              It would be better to use 'cpu' variable here  ^^^^^^^^^^^^^^^^^

That's what I did :)

Powered by blists - more mailing lists