From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Vegard Nossum <vegard.nossum@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: + lib-stringc-strlcpy-might-read-too-far.patch added to -mm tree
Date: Tue, 15 Apr 2014 14:18:00 +0300 [thread overview]
Message-ID: <20140415111800.GW4963@mwanda> (raw)
In-Reply-To: <CACVxJT-f+K_z-XxqjDVU_QK-VJPqnCEbWuMJF1fyTL0V0xiTgA@mail.gmail.com>
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));
strlcpy(dest.str, foo->bar, sizeof(dest.str));
It's a very unlikely scenario. You have to be very unlucky to hit it at
all.
regards,
dan carpenter
next prev parent reply other threads:[~2014-04-15 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <534c5757.VydWMxxcqkXGiwNa%akpm@linux-foundation.org>
2014-04-15 10:49 ` + lib-stringc-strlcpy-might-read-too-far.patch added to -mm tree Alexey Dobriyan
2014-04-15 11:18 ` Dan Carpenter [this message]
2014-04-15 11:36 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140415111800.GW4963@mwanda \
--to=dan.carpenter@oracle.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vegard.nossum@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox