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:	Sun, 23 Oct 2011 10:50:08 +0800
From:	Américo Wang <xiyou.wangcong@...il.com>
To:	Xin Tong <xerox.time.tech@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: copy_*_user

On Sun, Oct 23, 2011 at 1:06 AM, Xin Tong <xerox.time.tech@...il.com> wrote:
> I am investigating copy_from_user  and copy_to_user in linux under
> i386. These two function both take a pointer with virtual address and
> a pointer with physical address.
>
> copy_from_user calls __copy_from_user_ll and copy_to_user  calls
> __copy_to_user_ll. It make sense to me that __copy_to_user_ll converts
> the virtual address to physical address using the current process's
> page table.
>
[...]
> But it seems to be that __copy_from_user_ll  is not converted the
> address at all before attempting to copy. Can someone help explain to
> me why ?
>

You missed that __copy_to_user_ll() only does that when CONFIG_X86_WP_WORKS_OK
is not defined. And there is a comment right inside __copy_to_user_ll() said:


               /*
                 * CPU does not honor the WP bit when writing
                 * from supervisory mode, and due to preemption or SMP,
                 * the page tables can change at any time.
                 * Do it manually.      Manfred <manfred@...orfullife.com>
                 */

this is why it uses kmap_atomic()+memcpy() to copy the data.

Also, all the addresses are virtual address.
--
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