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: <CAH6sp9NybJf9dVYLq1rHx94e9BT=_gF9T8+VaRyRXgWpYhaKNA@mail.gmail.com>
Date:	Thu, 20 Aug 2015 11:58:16 +0200
From:	Frans Klaver <fransklaver@...il.com>
To:	yalin wang <yalin.wang2010@...il.com>
Cc:	bp@...e.de, Ingo Molnar <mingo@...nel.org>, dave@...1.net,
	bhe@...hat.com, Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] fs/kcore: change copy_to_user to copy_in_user

On Thu, Aug 20, 2015 at 10:59 AM, yalin wang <yalin.wang2010@...il.com> wrote:
> the copy_to_user() here expect can fix the fault on both kernel and
> user address, this is not true on other platforms except x86,
> change to user copy_in_user() so that can detect the page fault,
> work as expected.

Could you rephrase this into multiple sentences in comprehensible
English? What is the expected behavior, what is the unexpected
behavior and what can people do to trigger it?


> Signed-off-by: yalin wang <yalin.wang2010@...il.com>
> ---
>  fs/proc/kcore.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
> index 92e6726..4f28deb 100644
> --- a/fs/proc/kcore.c
> +++ b/fs/proc/kcore.c
> @@ -515,8 +515,12 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
>                 } else {
>                         if (kern_addr_valid(start)) {
>                                 unsigned long n;
> -
> -                               n = copy_to_user(buffer, (char *)start, tsz);
> +                               if ((start + tsz < tsz) ||
> +                                               (start + tsz) > TASK_SIZE)
> +                                       return -EFAULT;
> +                               set_fs(KERNEL_DS);
> +                               n = copy_in_user(buffer, (char *)start, tsz);
> +                               set_fs(USER_DS);
>                                 /*
>                                  * We cannot distinguish between fault on source
>                                  * and fault on destination. When this happens
> --
> 1.9.1
>
> --
> 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/
--
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