Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1534945
| From | Dmitry Vyukov <dvyukov@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume |
| Date | 2016-12-02 15:10 +0100 |
| Message-ID | <sJWHg-4R5-37@gated-at.bofh.it> (permalink) |
| References | (6 earlier) <sJDEB-7vD-13@gated-at.bofh.it> <sJDOi-7Cs-9@gated-at.bofh.it> <sJGj7-1KM-3@gated-at.bofh.it> <sJWHg-4R5-39@gated-at.bofh.it> <sJWHg-4R5-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Dec 2, 2016 at 3:01 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Fri, Dec 02, 2016 at 04:41:09PM +0300, Andrey Ryabinin wrote:
>>
>>
>> On 12/01/2016 11:31 PM, Josh Poimboeuf wrote:
>>
>> > arch/x86/kernel/acpi/wakeup_64.S | 16 ++++++++++++++++
>> > 1 file changed, 16 insertions(+)
>> >
>> > diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
>> > index 169963f..1df9b75 100644
>> > --- a/arch/x86/kernel/acpi/wakeup_64.S
>> > +++ b/arch/x86/kernel/acpi/wakeup_64.S
>> > @@ -109,6 +109,22 @@ ENTRY(do_suspend_lowlevel)
>> > movq pt_regs_r14(%rax), %r14
>> > movq pt_regs_r15(%rax), %r15
>> >
>> > +#ifdef CONFIG_KASAN
>> > + /*
>> > + * The suspend path may have poisoned some areas deeper in the stack,
>> > + * which we now need to unpoison.
>> > + *
>> > + * We can't call kasan_unpoison_task_stack_below() because it uses %gs
>> > + * for 'current', which hasn't been set up yet. Instead, calculate the
>> > + * stack range manually and call kasan_unpoison_shadow().
>> > + */
>> > + movq %rsp, %rdi
>> > + andq $CURRENT_MASK, %rdi
>> > + movq %rsp, %rsi
>> > + xorq %rdi, %rsi
>> > + call kasan_unpoison_shadow
>> > +#endif
>> > +
>>
>> Looks good, but in fact we can use kasan_unpoison_task_stack_below(). We just need to change it a little:
>>
>> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
>> index 70c0097..e779236 100644
>> --- a/mm/kasan/kasan.c
>> +++ b/mm/kasan/kasan.c
>> @@ -80,7 +80,9 @@ void kasan_unpoison_task_stack(struct task_struct *task)
>> /* Unpoison the stack for the current task beyond a watermark sp value. */
>> asmlinkage void kasan_unpoison_task_stack_below(const void *watermark)
>> {
>> - __kasan_unpoison_stack(current, watermark);
>> + void *base = (void *)((unsigned long)watermark & ~(THREAD_SIZE - 1));
>> +
>> + kasan_unpoison_shadow(base, watermark - base);
>> }
>>
>>
>> With this we don't have to calculate stack range in assembly.
>
> That is better indeed, will do a v3.
agree
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Scott Bauer <scott.bauer@intel.com> - 2016-11-29 19:30 +0100
Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Josh Poimboeuf <jpoimboe@redhat.com> - 2016-11-30 19:40 +0100
Re: BUG: KASAN: stack-out-of-bounds in unwind_get_return_address Scott Bauer <scott.bauer@intel.com> - 2016-11-30 20:10 +0100
[PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 00:20 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rafael@kernel.org> - 2016-12-01 15:10 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:00 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rafael@kernel.org> - 2016-12-01 18:10 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Ingo Molnar <mingo@kernel.org> - 2016-12-02 11:20 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 16:00 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 17:50 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:00 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:20 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:30 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 18:40 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-01 18:50 +0100
Re: [PATCH] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 19:00 +0100
[PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-01 21:40 +0100
Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-02 10:50 +0100
Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Pavel Machek <pavel@ucw.cz> - 2016-12-02 14:00 +0100
Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Dmitry Vyukov <dvyukov@google.com> - 2016-12-02 15:10 +0100
Re: [PATCH v2] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 15:10 +0100
[PATCH v3] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 15:50 +0100
Re: [PATCH v3] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 16:10 +0100
[PATCH v4] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 18:50 +0100
Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on suspend/resume Pavel Machek <pavel@ucw.cz> - 2016-12-02 22:10 +0100
Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on suspend/resume Josh Poimboeuf <jpoimboe@redhat.com> - 2016-12-02 23:00 +0100
Re: [PATCH v4] x86/suspend: fix false positive KASAN warning on suspend/resume "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-12-08 01:20 +0100
csiph-web