Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-20 Thread Linus Torvalds
On Wed, Nov 20, 2013 at 12:36 PM, H. Peter Anvin wrote: > > That being said, "lea (%rdx,%rcx,8),%ecx" (leal, as opposed to leaq) is > a perfectly legitimate instruction and actually one byte shorter. The > big question is if some broken version of gas will choke on it. At least gcc-4.8.2 generat

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-20 Thread H. Peter Anvin
On 11/20/2013 12:13 PM, Linus Torvalds wrote: > On Wed, Nov 20, 2013 at 11:28 AM, H. Peter Anvin wrote: >>> >>> .section .fixup,"ax" >>> 11: lea (%rdx,%rcx,8),%rcx >>> 12: movl %ecx,%edx /* ecx is zerorest also */ >> >> -> Even if %rdx+%rcx*8 > 2^32 we end up truncating at 12: -

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-20 Thread Linus Torvalds
On Wed, Nov 20, 2013 at 11:28 AM, H. Peter Anvin wrote: >> >> .section .fixup,"ax" >> 11: lea (%rdx,%rcx,8),%rcx >> 12: movl %ecx,%edx /* ecx is zerorest also */ > > -> Even if %rdx+%rcx*8 > 2^32 we end up truncating at 12: -- not that it > matters, since both arguments are prot

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-20 Thread H. Peter Anvin
On 11/16/2013 10:44 PM, Linus Torvalds wrote: > So this doesn't do the 32-bit truncation in the error path of the > generic string copy. Oversight? > >Linus I looked at the code again, and it turns out to be false alarm. We *do* do 32-bit truncation in every path, still: > ENTRY(copy_us

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-20 Thread H. Peter Anvin
On 11/19/2013 11:38 AM, Linus Torvalds wrote: > On Mon, Nov 18, 2013 at 8:37 PM, H. Peter Anvin wrote: >> >> Do you have a preference: >> >> 1. Considering the 32-bit truncation incidental (take it or leave it); >> 2. Require the 32-bit truncation, or >> 3. Get rid of it completely? > > I don't h

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-19 Thread Linus Torvalds
On Mon, Nov 18, 2013 at 8:37 PM, H. Peter Anvin wrote: > > Do you have a preference: > > 1. Considering the 32-bit truncation incidental (take it or leave it); > 2. Require the 32-bit truncation, or > 3. Get rid of it completely? I don't have a huge preference, but I hate the current situation (w

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-18 Thread H. Peter Anvin
On 11/16/2013 10:44 PM, Linus Torvalds wrote: > So this doesn't do the 32-bit truncation in the error path of the generic > string copy. Oversight? > >Linus Hi Linus, Do you have a preference: 1. Considering the 32-bit truncation incidental (take it or leave it); 2. Require the 32-bit t

Re: [tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-16 Thread H. Peter Anvin
On 11/16/2013 10:44 PM, Linus Torvalds wrote: > So this doesn't do the 32-bit truncation in the error path of the generic > string copy. Oversight? > >Linus Indeed... although in the kernel it seems to be taken as an invariant that copy lengths over 4G is simply prohibited. There are pla

[tip:x86/asm] x86-64, copy_user: Remove zero byte check before copy user buffer.

2013-11-16 Thread tip-bot for Fenghua Yu
Commit-ID: f4cb1cc18f364d761d5614eb62936647f259 Gitweb: http://git.kernel.org/tip/f4cb1cc18f364d761d5614eb62936647f259 Author: Fenghua Yu AuthorDate: Sat, 16 Nov 2013 12:37:01 -0800 Committer: H. Peter Anvin CommitDate: Sat, 16 Nov 2013 18:00:58 -0800 x86-64, copy_user: Remove