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]
Date:	Fri, 3 Jun 2011 14:31:27 -0500
From:	Scott Wood <scottwood@...escale.com>
To:	Alexey Dobriyan <adobriyan@...il.com>
CC:	Timur Tabi <timur@...escale.com>, <alan@...rguk.ukuu.org.uk>,
	<linux-kernel@...r.kernel.org>, <akpm@...ux-foundation.org>
Subject: Re: [PATCH] lib: introduce strdup_from_user

On Fri, 3 Jun 2011 22:12:37 +0300
Alexey Dobriyan <adobriyan@...il.com> wrote:

> On Fri, Jun 3, 2011 at 9:53 PM, Scott Wood <scottwood@...escale.com> wrote:
> > On Fri, 3 Jun 2011 21:39:28 +0300
> > Alexey Dobriyan <adobriyan@...il.com> wrote:
> >
> >> On Fri, Jun 3, 2011 at 9:34 PM, Timur Tabi <timur@...escale.com> wrote:
> >> > Would it be better if I did this:
> >>
> >> The point is data should cross kernelspace/userspace boundary only once.
> >>
> >
> > Why does it matter, as long as it doesn't hurt the kernel if userspace
> > plays games (i.e. take care of the NUL termination), and it's not a
> > performance problem?
> 
> Because now you're lucky C strings are NUL-terminated.
> If this "idiom" applies to some other case like "validate + copy",
> we have a bug.

It's not an idiom.  It is a simple solution to this particular problem.

> We copy data to kernelspace THEN validate or copy or whatever.
> This is obviously correct and safe.

That doesn't mean that other things are necessarily incorrect or unsafe.
The first access is not validation in this case.

In any case, as it appears there's already a strndup_user() in the kernel,
we'll just use that.  You can "fix" it to do a single userspace access, if
you'd like. :-)

-Scott

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