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] [day] [month] [year] [list]
Date:	Tue, 15 Apr 2014 14:36:50 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>,
	Vegard Nossum <vegard.nossum@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: + lib-stringc-strlcpy-might-read-too-far.patch added to -mm tree

On Tue, Apr 15, 2014 at 2:18 PM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> On Tue, Apr 15, 2014 at 01:49:38PM +0300, Alexey Dobriyan wrote:
>> Return value matters. It may not matter for kernel, because kernel is
>> not heavy string user.
>> But it is better to not diverge from master code:
>> http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.c?rev=1.11
>>
>
> Oh...  Hm.  Maybe we should drop this patch then.
>
>> Counter-rationale:
>> * strlcpy() accepts strings, so if you're giving raw buffer you're
>> doing it wrong.
>> * last byte of last page argument is bogus because kernel copies data
>> from userspace first.
>
> The last byte of the page argument seems possible:
>
>         foo = kmalloc();
>         copy_from_user(foo, arg, sizeof(foo));

Correct code would do
        foo->bar[sizeof(foo->bar)-1] = '\0';
if this field is a string.

>         strlcpy(dest.str, foo->bar, sizeof(dest.str));
--
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