All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lutomirski <luto@mit.edu>
To: Richard Weinberger <richard@nod.at>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	user-mode-linux-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC] weird crap with vdso on uml/i386
Date: Sat, 20 Aug 2011 17:26:00 -0400	[thread overview]
Message-ID: <CAObL_7FoPHu6AKneswjEmiU4UBjUuKpYahakOaTNXM3=ZCpYaA@mail.gmail.com> (raw)
In-Reply-To: <4E501F51.9060905@nod.at>

On Sat, Aug 20, 2011 at 4:55 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 20.08.2011 22:14, schrieb Al Viro:
>>
>> On Sat, Aug 20, 2011 at 05:22:23PM +0200, Richard Weinberger wrote:
>>
>>> Hmmm, very strange.
>>> Sadly I cannot reproduce the issue. :(
>>> Everything works fine within UML.
>>> (Of course I've applied your vDSO/i386 patches)
>>>
>>> My test setup:
>>> Host kernel: 2.6.37 and 3.0.1
>>> Distro: openSUSE 11.4/x86_64
>>>
>>> UML kernel: 3.1-rc2
>>> Distro: openSUSE 11.1/i386
>>>
>>> Does the problem also occur with another host kernel or a different
>>> guest image?
>>
>> Could you check what you get in __kernel_vsyscall()?  On iAMD64 box
>> where that sucker contains sysenter-based variant the bug is not
>> present.  IOW, it's sensitive to syscall vs. systenter vs. int 0x80
>> differences.
>
> OK, this explains why I cannot reproduce it.
> My Intel Core2 box is sysenter-based.
>
> (gdb) disass __kernel_vsyscall
> 0xffffe420 <__kernel_vsyscall+0>:       push   %ecx
> 0xffffe421 <__kernel_vsyscall+1>:       push   %edx
> 0xffffe422 <__kernel_vsyscall+2>:       push   %ebp
> 0xffffe423 <__kernel_vsyscall+3>:       mov    %esp,%ebp
> 0xffffe425 <__kernel_vsyscall+5>:       sysenter
> 0xffffe427 <__kernel_vsyscall+7>:       nop
> 0xffffe428 <__kernel_vsyscall+8>:       nop
> 0xffffe429 <__kernel_vsyscall+9>:       nop
> 0xffffe42a <__kernel_vsyscall+10>:      nop
> 0xffffe42b <__kernel_vsyscall+11>:      nop
> 0xffffe42c <__kernel_vsyscall+12>:      nop
> 0xffffe42d <__kernel_vsyscall+13>:      nop
> 0xffffe42e <__kernel_vsyscall+14>:      jmp 0xffffe423<__kernel_vsyscall+3>
> 0xffffe430 <__kernel_vsyscall+16>:      pop    %ebp
> 0xffffe431 <__kernel_vsyscall+17>:      pop    %edx
> 0xffffe432 <__kernel_vsyscall+18>:      pop    %ecx
> 0xffffe433 <__kernel_vsyscall+19>:      ret
>
>> I can throw the trimmed-down fs image your way, BTW (66MB of bzipped ext2
>> ;-/)
>> if you want to see if that gets reproduced on your box.  I'll drop it on
>> anonftp if you are interested.  FWIW, the same kernel binary/same image
>> result in
>>        * K7 box - no breakage, SYSENTER-based vdso
>>        * K8 box - breakage as described, SYSCALL-based vdso32
>>        * P4 box - no breakage, SYSENTER-based vdso32
>> Hell knows...  In theory that would seem to point towards
>> ia32_cstar_target(),
>> so I'm going to RTFS carefully through that animal.
>
> Now I'm testing with a Debian fs from:
> http://fs.devloop.org.uk/filesystems/Debian-Squeeze/
>
>> The thing is, whatever happens happens when victim gets resumed inside
>> vdso page.  I'll try to dump PTRACE_SETREGS and see the values host
>> kernel asked to set and work from there, but the interesting part is
>> bloody hard to singlestep through - the victim is back to user mode and
>> it is already traced by the guest kernel, so it's not as if we could
>> attach host gdb to it and walk through that crap.  And guest gdb is not
>> going to be able to set breakpoints in there - vdso page is r/o...
>
> [ CC'ing luto@mit.edu ]
> Andy, do you have an idea?
> You can find Al's original report here:
> http://marc.info/?l=linux-kernel&m=131380315624244&w=2

I'm missing a bit of the background.  Is the user-on-UML app calling
into a vdso entry provided by UML or into a vdso entry provided by the
host?

Why does anything care whether ecx is saved?  Doesn't the default
calling convention allow the callee to clobber ecx?

But my guess is that the 64-bit host sysret code might be buggy (or
the value in gs:whatever is wrong). Can you get gdb to breakpoint at
the beginning of __kernel_vsyscall before the crash?

--Andy

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lutomirski <luto@mit.edu>
To: Richard Weinberger <richard@nod.at>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	user-mode-linux-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC] weird crap with vdso on uml/i386
Date: Sat, 20 Aug 2011 17:26:00 -0400	[thread overview]
Message-ID: <CAObL_7FoPHu6AKneswjEmiU4UBjUuKpYahakOaTNXM3=ZCpYaA@mail.gmail.com> (raw)
In-Reply-To: <4E501F51.9060905@nod.at>

On Sat, Aug 20, 2011 at 4:55 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 20.08.2011 22:14, schrieb Al Viro:
>>
>> On Sat, Aug 20, 2011 at 05:22:23PM +0200, Richard Weinberger wrote:
>>
>>> Hmmm, very strange.
>>> Sadly I cannot reproduce the issue. :(
>>> Everything works fine within UML.
>>> (Of course I've applied your vDSO/i386 patches)
>>>
>>> My test setup:
>>> Host kernel: 2.6.37 and 3.0.1
>>> Distro: openSUSE 11.4/x86_64
>>>
>>> UML kernel: 3.1-rc2
>>> Distro: openSUSE 11.1/i386
>>>
>>> Does the problem also occur with another host kernel or a different
>>> guest image?
>>
>> Could you check what you get in __kernel_vsyscall()?  On iAMD64 box
>> where that sucker contains sysenter-based variant the bug is not
>> present.  IOW, it's sensitive to syscall vs. systenter vs. int 0x80
>> differences.
>
> OK, this explains why I cannot reproduce it.
> My Intel Core2 box is sysenter-based.
>
> (gdb) disass __kernel_vsyscall
> 0xffffe420 <__kernel_vsyscall+0>:       push   %ecx
> 0xffffe421 <__kernel_vsyscall+1>:       push   %edx
> 0xffffe422 <__kernel_vsyscall+2>:       push   %ebp
> 0xffffe423 <__kernel_vsyscall+3>:       mov    %esp,%ebp
> 0xffffe425 <__kernel_vsyscall+5>:       sysenter
> 0xffffe427 <__kernel_vsyscall+7>:       nop
> 0xffffe428 <__kernel_vsyscall+8>:       nop
> 0xffffe429 <__kernel_vsyscall+9>:       nop
> 0xffffe42a <__kernel_vsyscall+10>:      nop
> 0xffffe42b <__kernel_vsyscall+11>:      nop
> 0xffffe42c <__kernel_vsyscall+12>:      nop
> 0xffffe42d <__kernel_vsyscall+13>:      nop
> 0xffffe42e <__kernel_vsyscall+14>:      jmp 0xffffe423<__kernel_vsyscall+3>
> 0xffffe430 <__kernel_vsyscall+16>:      pop    %ebp
> 0xffffe431 <__kernel_vsyscall+17>:      pop    %edx
> 0xffffe432 <__kernel_vsyscall+18>:      pop    %ecx
> 0xffffe433 <__kernel_vsyscall+19>:      ret
>
>> I can throw the trimmed-down fs image your way, BTW (66MB of bzipped ext2
>> ;-/)
>> if you want to see if that gets reproduced on your box.  I'll drop it on
>> anonftp if you are interested.  FWIW, the same kernel binary/same image
>> result in
>>        * K7 box - no breakage, SYSENTER-based vdso
>>        * K8 box - breakage as described, SYSCALL-based vdso32
>>        * P4 box - no breakage, SYSENTER-based vdso32
>> Hell knows...  In theory that would seem to point towards
>> ia32_cstar_target(),
>> so I'm going to RTFS carefully through that animal.
>
> Now I'm testing with a Debian fs from:
> http://fs.devloop.org.uk/filesystems/Debian-Squeeze/
>
>> The thing is, whatever happens happens when victim gets resumed inside
>> vdso page.  I'll try to dump PTRACE_SETREGS and see the values host
>> kernel asked to set and work from there, but the interesting part is
>> bloody hard to singlestep through - the victim is back to user mode and
>> it is already traced by the guest kernel, so it's not as if we could
>> attach host gdb to it and walk through that crap.  And guest gdb is not
>> going to be able to set breakpoints in there - vdso page is r/o...
>
> [ CC'ing luto@mit.edu ]
> Andy, do you have an idea?
> You can find Al's original report here:
> http://marc.info/?l=linux-kernel&m=131380315624244&w=2

I'm missing a bit of the background.  Is the user-on-UML app calling
into a vdso entry provided by UML or into a vdso entry provided by the
host?

Why does anything care whether ecx is saved?  Doesn't the default
calling convention allow the callee to clobber ecx?

But my guess is that the 64-bit host sysret code might be buggy (or
the value in gs:whatever is wrong). Can you get gdb to breakpoint at
the beginning of __kernel_vsyscall before the crash?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  reply	other threads:[~2011-08-20 21:26 UTC|newest]

Thread overview: 161+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 18:58 Subject: [PATCH 00/91] pending uml patches Al Viro
2011-08-18 18:58 ` [uml-devel] " Al Viro
2011-08-18 19:12 ` Richard Weinberger
2011-08-18 19:12   ` [uml-devel] " Richard Weinberger
2011-08-18 19:19   ` Al Viro
2011-08-18 19:19     ` [uml-devel] " Al Viro
2011-08-19  4:31     ` Al Viro
2011-08-19  8:51       ` Richard Weinberger
2011-08-19  8:51         ` [uml-devel] " Richard Weinberger
2011-08-20  1:18         ` [RFC] weird crap with vdso on uml/i386 Al Viro
2011-08-20 15:22           ` Richard Weinberger
2011-08-20 20:14             ` Al Viro
2011-08-20 20:14               ` [uml-devel] " Al Viro
2011-08-20 20:55               ` Richard Weinberger
2011-08-20 21:26                 ` Andrew Lutomirski [this message]
2011-08-20 21:26                   ` Andrew Lutomirski
2011-08-20 21:38                   ` Richard Weinberger
2011-08-20 21:38                     ` [uml-devel] " Richard Weinberger
2011-08-20 21:40                   ` Andrew Lutomirski
2011-08-20 21:40                     ` [uml-devel] " Andrew Lutomirski
2011-08-21  6:34                     ` Al Viro
2011-08-21  6:34                       ` [uml-devel] " Al Viro
2011-08-21  8:42                       ` SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386) Al Viro
2011-08-21  8:42                         ` [uml-devel] " Al Viro
2011-08-21 11:24                         ` Andrew Lutomirski
2011-08-21 11:24                           ` [uml-devel] " Andrew Lutomirski
2011-08-21 13:37                           ` Andrew Lutomirski
2011-08-21 13:37                             ` [uml-devel] " Andrew Lutomirski
2011-08-21 14:51                             ` Al Viro
2011-08-21 14:51                               ` [uml-devel] " Al Viro
2011-08-21 14:43                           ` Al Viro
2011-08-21 16:41                             ` Al Viro
2011-08-21 16:41                               ` [uml-devel] " Al Viro
2011-08-22  0:44                               ` Andrew Lutomirski
2011-08-22  0:44                                 ` Andrew Lutomirski
2011-08-22  1:09                                 ` Linus Torvalds
2011-08-22  1:19                                   ` Al Viro
2011-08-22  1:19                                     ` [uml-devel] " Al Viro
2011-08-22  1:19                                   ` H. Peter Anvin
2011-08-22  1:19                                     ` [uml-devel] " H. Peter Anvin
2011-08-22 21:25                                   ` [tip:x86/urgent] x86-32, vdso: On system call restart after SYSENTER, use int $0x80 tip-bot for H. Peter Anvin
2011-08-23 23:40                                   ` tip-bot for H. Peter Anvin
2011-08-22  1:16                                 ` SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386) Al Viro
2011-08-22  1:16                                   ` [uml-devel] " Al Viro
2011-08-22  1:41                                   ` Linus Torvalds
2011-08-22  1:41                                     ` [uml-devel] " Linus Torvalds
2011-08-22  1:48                                     ` H. Peter Anvin
2011-08-22  1:48                                       ` [uml-devel] " H. Peter Anvin
2011-08-22  2:01                                       ` Andrew Lutomirski
2011-08-22  2:01                                         ` [uml-devel] " Andrew Lutomirski
2011-08-22  2:07                                         ` Al Viro
2011-08-22  2:07                                           ` [uml-devel] " Al Viro
2011-08-22  2:26                                           ` Andrew Lutomirski
2011-08-22  2:26                                             ` [uml-devel] " Andrew Lutomirski
2011-08-22  2:34                                             ` H. Peter Anvin
2011-08-22  2:34                                               ` [uml-devel] " H. Peter Anvin
2011-08-22  4:05                                             ` H. Peter Anvin
2011-08-22  4:05                                               ` [uml-devel] " H. Peter Anvin
2011-08-22  9:53                                               ` Ingo Molnar
2011-08-22 13:34                                                 ` Andrew Lutomirski
2011-08-22 13:34                                                   ` Andrew Lutomirski
2011-08-22 14:40                                                   ` Borislav Petkov
2011-08-22 14:40                                                     ` Borislav Petkov
2011-08-22 15:13                                                     ` Al Viro
2011-08-22 15:13                                                       ` Al Viro
2011-08-22 20:05                                                       ` Linus Torvalds
2011-08-22 20:05                                                         ` Linus Torvalds
2011-08-22 20:11                                                         ` H. Peter Anvin
2011-08-22 20:11                                                           ` H. Peter Anvin
2011-08-22 21:52                                                           ` Andrew Lutomirski
2011-08-22 21:52                                                             ` Andrew Lutomirski
2011-08-22 22:04                                                             ` H. Peter Anvin
2011-08-22 22:04                                                               ` H. Peter Anvin
2011-08-22 23:27                                                               ` Linus Torvalds
2011-08-22 23:46                                                                 ` H. Peter Anvin
2011-08-22 23:46                                                                   ` H. Peter Anvin
2011-08-23  0:03                                                                 ` Al Viro
2011-08-23  0:03                                                                   ` Al Viro
2011-08-23  0:07                                                                   ` Al Viro
2011-08-23  0:07                                                                     ` Al Viro
2011-08-23  0:07                                                                   ` H. Peter Anvin
2011-08-23  0:07                                                                     ` H. Peter Anvin
2011-08-23  0:22                                                                     ` Linus Torvalds
2011-08-23  0:22                                                                       ` Linus Torvalds
2011-08-23  1:01                                                                       ` Al Viro
2011-08-23  1:13                                                                         ` Al Viro
2011-08-23  1:13                                                                           ` Al Viro
2011-08-23  1:59                                                                           ` Linus Torvalds
2011-08-23  1:59                                                                             ` Linus Torvalds
2011-08-23  2:59                                                                             ` Al Viro
2011-08-23  2:59                                                                               ` Al Viro
2011-08-23  2:17                                                                           ` Al Viro
2011-08-23  6:15                                                                             ` Al Viro
2011-08-23 14:26                                                                               ` Borislav Petkov
2011-08-23 16:30                                                                                 ` Al Viro
2011-08-23 16:30                                                                                   ` Al Viro
2011-08-23 16:03                                                                               ` Linus Torvalds
2011-08-23 16:03                                                                                 ` Linus Torvalds
2011-08-23 16:11                                                                                 ` Andrew Lutomirski
2011-08-23 16:11                                                                                   ` Andrew Lutomirski
2011-08-23 16:20                                                                                   ` Linus Torvalds
2011-08-23 16:20                                                                                     ` Linus Torvalds
2011-08-23 17:33                                                                                     ` Al Viro
2011-08-23 17:33                                                                                       ` Al Viro
2011-08-23 18:04                                                                                       ` Al Viro
2011-08-23 18:04                                                                                         ` Al Viro
2011-08-24 12:44                                                                                       ` [PATCH] x86, asm: Document some of the syscall asm glue Borislav Petkov
2011-08-23 16:22                                                                                   ` [uml-devel] SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386) Borislav Petkov
2011-08-23 16:29                                                                                     ` Linus Torvalds
2011-08-23 16:53                                                                                       ` Al Viro
2011-08-23 16:53                                                                                         ` Al Viro
2011-08-23 16:58                                                                                         ` Richard Weinberger
2011-08-23 16:58                                                                                           ` Richard Weinberger
2011-08-23 17:07                                                                                           ` Al Viro
2011-08-23 17:07                                                                                             ` Al Viro
2011-08-23 17:29                                                                                             ` Richard Weinberger
2011-08-23 17:29                                                                                               ` Richard Weinberger
2011-08-25  0:05                                                                                             ` Richard Weinberger
2011-08-23 19:15                                                                                     ` H. Peter Anvin
2011-08-23 19:15                                                                                       ` H. Peter Anvin
2011-08-23 20:56                                                                                       ` Borislav Petkov
2011-08-23 21:06                                                                                         ` H. Peter Anvin
2011-08-23 21:10                                                                                           ` Borislav Petkov
2011-08-23 23:04                                                                                             ` H. Peter Anvin
2011-08-23 23:04                                                                                               ` H. Peter Anvin
2011-08-24 21:10                                                                                             ` H. Peter Anvin
2011-08-24 21:10                                                                                               ` H. Peter Anvin
2011-08-23 16:48                                                                                 ` Al Viro
2011-08-23 16:48                                                                                   ` Al Viro
2011-08-23 17:33                                                                                   ` Linus Torvalds
2011-08-23 17:33                                                                                     ` Linus Torvalds
2011-08-23 21:08                                                                                     ` H. Peter Anvin
2011-08-23 21:08                                                                                       ` H. Peter Anvin
2011-08-23 21:20                                                                                       ` Linus Torvalds
2011-08-23 21:20                                                                                         ` Linus Torvalds
2011-08-23 23:04                                                                                         ` H. Peter Anvin
2011-08-23 23:04                                                                                           ` H. Peter Anvin
2011-08-23 19:18                                                                                   ` H. Peter Anvin
2011-08-23 19:18                                                                                     ` H. Peter Anvin
2011-08-23 19:24                                                                                     ` Linus Torvalds
2011-08-23 19:24                                                                                       ` Linus Torvalds
2011-08-23 19:26                                                                                       ` H. Peter Anvin
2011-08-23 19:26                                                                                         ` H. Peter Anvin
2011-08-23 19:41                                                                                       ` Al Viro
2011-08-23 19:41                                                                                         ` Al Viro
2011-08-23 19:43                                                                                         ` Linus Torvalds
2011-08-23 19:43                                                                                           ` Linus Torvalds
2011-08-23 21:17                                                                                           ` Al Viro
2011-08-23 21:17                                                                                             ` Al Viro
2011-08-23  1:16                                                                         ` Andrew Lutomirski
2011-08-23  1:18                                                                           ` H. Peter Anvin
2011-08-23  1:18                                                                             ` H. Peter Anvin
2011-08-22  4:07                                     ` Al Viro
2011-08-22  4:11                                       ` H. Peter Anvin
2011-08-22  4:11                                         ` [uml-devel] " H. Peter Anvin
2011-08-22  4:26                                         ` Al Viro
2011-08-22  4:26                                           ` [uml-devel] " Al Viro
2011-08-22  5:03                                           ` H. Peter Anvin
2011-08-22  5:03                                             ` [uml-devel] " H. Peter Anvin
2011-08-23  5:10                                             ` Andrew Lutomirski
2011-08-23  5:10                                               ` [uml-devel] " Andrew Lutomirski

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='CAObL_7FoPHu6AKneswjEmiU4UBjUuKpYahakOaTNXM3=ZCpYaA@mail.gmail.com' \
    --to=luto@mit.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=torvalds@linux-foundation.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.