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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVgC7yKsu0KM0=TfUuX9msn9ru_nG=Fv6Mz6PKDTnWGnQ@mail.gmail.com>
Date:	Thu, 20 Mar 2014 08:02:26 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Stefani Seibold <stefani@...bold.net>,
	Greg KH <gregkh@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	X86 ML <x86@...nel.org>, Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <ak@...ux.intel.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	John Stultz <john.stultz@...aro.org>,
	Pavel Emelyanov <xemul@...allels.com>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	andriy.shevchenko@...ux.intel.com,
	Martin Runge <Martin.Runge@...de-schwarz.com>,
	Andreas Brief <Andreas.Brief@...de-schwarz.com>
Subject: Re: [PATCH] x86, vdso32: fix out of memory handling setup vDSO

On Thu, Mar 20, 2014 at 5:30 AM, Thomas Gleixner <tglx@...utronix.de> wrote:
> On Thu, 20 Mar 2014, Stefani Seibold wrote:
>> Am Donnerstag, den 20.03.2014, 10:53 +0100 schrieb Thomas Gleixner:
>> > On Thu, 20 Mar 2014, Stefani Seibold wrote:
>> >
>> > > This patch add a correct out of memory handling for setup a 32 bit vDSO.
>> > >
>> > > The patch is against tip commit 4e40112c4ff6a577dd06d92b2a54cdf06265bf74
>> > >
>> > > Signed-off-by: Stefani Seibold <stefani@...bold.net>
>> > > ---
>> > >  arch/x86/vdso/vdso32-setup.c | 17 ++++++++++++++++-
>> > >  1 file changed, 16 insertions(+), 1 deletion(-)
>> > >
>> > > diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
>> > > index 0bc363a..e1171c2 100644
>> > > --- a/arch/x86/vdso/vdso32-setup.c
>> > > +++ b/arch/x86/vdso/vdso32-setup.c
>> > > @@ -134,8 +134,14 @@ int __init sysenter_setup(void)
>> > >   }
>> > >
>> > >   vdso32_size = (vdso_len + PAGE_SIZE - 1) / PAGE_SIZE;
>> > > - vdso32_pages = kmalloc(sizeof(*vdso32_pages) * vdso32_size, GFP_ATOMIC);
>> > > +
>> > > + vdso32_pages = kmalloc(sizeof(*vdso32_pages) * vdso32_size, GFP_ATOMIC);
>> >
>> > Why is this GFP_ATOMIC and not GFP_ATOMIC ?
>> >
>> > That code is called either from identify_boot_cpu(), where GFP_KERNEL
>> > is perfectly valid and from subsys_initcall(sysenter_setup) which is
>> > way late in the boot process where GFP_KERNEL is the RightThing.
>> >
>> > Aside of that, why do we need to call it early for X86_32 and late for
>> > X86_64?
>> >
>> > We need the vdso before we head off to user space, but not in the
>> > early boot process.
>> >
>>
>> All complains are design decisions not made by me. I will send a patch
>> for the GFP_ATOMIC thing. For the other one it would be the best to ask
>> Andy for the reason.
>
> I'm not saying it's your fault, but if we rework code, then we really
> should question such things. What happens if you remove the x32 call
> and make the x64 subsys thing valid for both cases?
>

It's not just that.  The x86_64 and x32 vdso page arrays are *far*
cleaner than the 32-bit variant.  They manage to do the entire vdso
setup dance without any allocation at all.  This avoids silly
questions about error handling and GFP_KERNEL :)

See vdso/vdso.S for the rather small amount of magic needed.

--Andy
--
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