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]
Message-ID: <m3sktol53n.fsf@gravicappa.englab.brq.redhat.com>
Date:	Sat, 02 Aug 2008 00:53:32 +0200
From:	Vitaly Mayatskikh <v.mayatskih@...il.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Vitaly Mayatskikh <v.mayatskih@...il.com>,
	linux-kernel@...r.kernel.org, Andi Kleen <andi@...stfloor.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] x86: Optimize tail handling for copy_user

Linus Torvalds <torvalds@...ux-foundation.org> writes:

> I was actually thinking more along the lines of actually doing a 
> test-suite with the few most relevant system calls (to catch the few cases 
> that matter), and judicious use of mmap/munmap to make sure to trigger it 
> in-kernel.

Well, my test is a kernel module (with help of systemtap). It tests
copy_from_user, copy_to_user, copy_user_generic_unrolled,
copy_user_generic_string and __copy_user_nocache directly. Test
allocates a page in kernel space and uses a page in user space (this is
for range checks in copy_from/to_user) and tries to make a fault in
every possible place of these routines. I don't know how to get a
userspace page from kernel module easily, and did a dirty hack with
available pages and sys_mprotect. However, it works.

> It probably doesn't really need all that many system calls to trigger all 
> the relevant paths. A "read()" should trigger the "to_user()" case, and a 
> write() to a file should trigger the 'from_user_nocache()" case. And while 
> the "from_user()" case with zeroing migth be harder to see (because all 
> _normal_ users should also look at the error case and return EFAULT), I 
> think there are a few cases where we just depend on the zeroing.

I found it hard to do a good testing for copy_user from user space
program and have used systemtap.

> Doing a
>
> 	git grep '	copy_from_user('
>
> (that's a tab in that grep thing) shows at least the termios code doing 
> it, for example. But fewer cases than I expected.
>
> 			Linus

It might be a good idea to find such potentially faulty places.

-- 
wbr, Vitaly
--
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