From: David Laight <David.Laight@ACULAB.COM>
To: 'Daniel Xu' <dxu@dxuuu.xyz>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>
Cc: "kernel-team@fb.com" <kernel-team@fb.com>
Subject: RE: [PATCH bpf v2 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator
Date: Thu, 5 Nov 2020 09:00:00 +0000 [thread overview]
Message-ID: <cbe00e1421db4566a076102506b6d670@AcuMS.aculab.com> (raw)
In-Reply-To: <487a07aa911b4e822a0b931f7b33a4f67fedb6bd.1604542786.git.dxu@dxuuu.xyz>
From: Daniel Xu
> Sent: 05 November 2020 02:26
...
> --- a/lib/strncpy_from_user.c
> +++ b/lib/strncpy_from_user.c
> @@ -35,17 +35,22 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src,
> goto byte_at_a_time;
>
> while (max >= sizeof(unsigned long)) {
> - unsigned long c, data;
> + unsigned long c, data, mask, *out;
>
> /* Fall back to byte-at-a-time if we get a page fault */
> unsafe_get_user(c, (unsigned long __user *)(src+res), byte_at_a_time);
It's not related to this change, but since both addresses
are aligned (checked earlier) a page fault on the word read
is fatal.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-11-05 9:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 2:25 [PATCH bpf v2 0/2] Fix bpf_probe_read_user_str() overcopying Daniel Xu
2020-11-05 2:25 ` [PATCH bpf v2 1/2] lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator Daniel Xu
2020-11-05 9:00 ` David Laight [this message]
2020-11-05 18:16 ` Song Liu
2020-11-05 18:18 ` Song Liu
2020-11-05 19:28 ` Daniel Xu
2020-11-15 10:41 ` [lib/strncpy_from_user.c] 2903f3d558: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= kernel test robot
2020-11-05 2:25 ` [PATCH bpf v2 2/2] selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after NUL Daniel Xu
2020-11-05 18:30 ` Song Liu
2020-11-05 19:27 ` Daniel Xu
2020-11-05 21:32 ` Andrii Nakryiko
2020-11-05 23:22 ` Daniel Xu
2020-11-05 23:31 ` Song Liu
2020-11-05 23:55 ` Daniel Xu
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=cbe00e1421db4566a076102506b6d670@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).