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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+ZWgVz_4NEJbsZWYBHn91M7UNxMNUk_+SebtOfBAoN_LA@mail.gmail.com>
Date:	Mon, 28 Sep 2015 18:08:34 +0200
From:	Dmitry Vyukov <dvyukov@...gle.com>
To:	Andrey Ryabinin <ryabinin.a.a@...il.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	"x86@...nel.org" <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Kostya Serebryany <kcc@...gle.com>,
	Alexander Potapenko <glider@...gle.com>,
	Andrey Konovalov <andreyknvl@...gle.com>,
	Sasha Levin <sasha.levin@...cle.com>,
	Andi Kleen <ak@...ux.intel.com>,
	kasan-dev <kasan-dev@...glegroups.com>
Subject: Re: [PATCH] arch/x86: fix out-of-bounds in get_wchan()

On Mon, Sep 28, 2015 at 5:40 PM, Andrey Ryabinin <ryabinin.a.a@...il.com> wrote:
> 2015-09-28 12:00 GMT+03:00 Dmitry Vyukov <dvyukov@...gle.com>:
>>         stack = (unsigned long)task_stack_page(p);
>> -       if (p->thread.sp < stack || p->thread.sp >= stack+THREAD_SIZE)
>> +       /* The task can be already running at this point, so tread carefully. */
>> +       fp = READ_ONCE(p->thread.sp);
>> +       if (fp < stack || fp >= stack+THREAD_SIZE)
>
> Since we deference fp, it should be "|| fp + sizeof(u64) >= stack + THREAD_SIZE"

Good point.
I guess it should be "|| fp + sizeof(u64) > stack + THREAD_SIZE",
because == is OK if we add 8.

>>                 return 0;
>> -       fp = *(u64 *)(p->thread.sp);
>> +       fp = READ_ONCE(*(u64 *)fp);
>>         do {
>>                 if (fp < (unsigned long)stack ||
>> -                   fp >= (unsigned long)stack+THREAD_SIZE)
>> +                   fp+8 >= (unsigned long)stack+THREAD_SIZE)
>
> The same as above;
>         'fp+8 +sizeof(u64) >= ...'
>
>>                         return 0;
>> -               ip = *(u64 *)(fp+8);
>> +               ip = READ_ONCE(*(u64 *)(fp+8));
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ