All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Lutomirski <luto@mit.edu>,
	Al Viro <viro@zeniv.linux.org.uk>, Borislav Petkov <bp@amd64.org>,
	Ingo Molnar <mingo@kernel.org>,
	"user-mode-linux-devel@lists.sourceforge.net" 
	<user-mode-linux-devel@lists.sourceforge.net>,
	Richard Weinberger <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>
Subject: Re: [uml-devel] SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386)
Date: Mon, 22 Aug 2011 16:46:24 -0700	[thread overview]
Message-ID: <4E52EA50.6070105@zytor.com> (raw)
In-Reply-To: <CA+55aFw4C+ShLHF2NYZMQ-Lhjow3mJ62_eqO_iAww2nh7V_-Uw@mail.gmail.com>

On 08/22/2011 04:27 PM, Linus Torvalds wrote:
> On Mon, Aug 22, 2011 at 3:04 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>>
>> However, we could just issue a SIGILL or SIGSEGV at this point; the same
>> way we would if we got an #UD or #GP fault; SIGILL/#UD would be
>> consistent with Intel CPUs here.
> 
> Considering that this is not a remotely new issue, and that it has
> been around for years without anybody even noticing, I'd really prefer
> to just fix things going forwards rather than add any code to actively
> break any possible unlucky legacy users.
> 
> So I think the "let's fix the vdso case for sysenter" + "let's remove
> the 32-bit syscall vdso" is the right solution. If somebody has
> hardcoded syscall instructions, or generates them dynamically with
> some JIT, that's their problem. We'll continue to support it as well
> as we ever have (read: "almost nobody will ever notice").
> 
> One thing we *could* do is to just say "we never restart a x86-32
> 'syscall' instruction at all", and just make such a case return EINTR.
> IOW, do something along the lines of the appended pseudo-patch.
> 
> Because returning -EINTR is always "almost correct".
> 

I have to say it worries me from a potential security hole point of
view, especially since it clearly isn't very well trod ground to begin
with.  An almost-never-used path with access to the full system call
suite is scarier than hell in that sense.

Keep in mind support for SYSCALL32 is already (vendor-)conditional.

(The obvious solution of just putting the proper register frame back in
its place would be okay except for totally breaking anything
trace-on-exit as already hashed to death...)

	-hpa

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Lutomirski <luto@mit.edu>,
	"user-mode-linux-devel@lists.sourceforge.net"
	<user-mode-linux-devel@lists.sourceforge.net>,
	Richard Weinberger <richard@nod.at>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@amd64.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Ingo Molnar <mingo@kernel.org>
Subject: Re: [uml-devel] SYSCALL, ptrace and syscall restart breakages (Re: [RFC] weird crap with vdso on uml/i386)
Date: Mon, 22 Aug 2011 16:46:24 -0700	[thread overview]
Message-ID: <4E52EA50.6070105@zytor.com> (raw)
In-Reply-To: <CA+55aFw4C+ShLHF2NYZMQ-Lhjow3mJ62_eqO_iAww2nh7V_-Uw@mail.gmail.com>

On 08/22/2011 04:27 PM, Linus Torvalds wrote:
> On Mon, Aug 22, 2011 at 3:04 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>>
>> However, we could just issue a SIGILL or SIGSEGV at this point; the same
>> way we would if we got an #UD or #GP fault; SIGILL/#UD would be
>> consistent with Intel CPUs here.
> 
> Considering that this is not a remotely new issue, and that it has
> been around for years without anybody even noticing, I'd really prefer
> to just fix things going forwards rather than add any code to actively
> break any possible unlucky legacy users.
> 
> So I think the "let's fix the vdso case for sysenter" + "let's remove
> the 32-bit syscall vdso" is the right solution. If somebody has
> hardcoded syscall instructions, or generates them dynamically with
> some JIT, that's their problem. We'll continue to support it as well
> as we ever have (read: "almost nobody will ever notice").
> 
> One thing we *could* do is to just say "we never restart a x86-32
> 'syscall' instruction at all", and just make such a case return EINTR.
> IOW, do something along the lines of the appended pseudo-patch.
> 
> Because returning -EINTR is always "almost correct".
> 

I have to say it worries me from a potential security hole point of
view, especially since it clearly isn't very well trod ground to begin
with.  An almost-never-used path with access to the full system call
suite is scarier than hell in that sense.

Keep in mind support for SYSCALL32 is already (vendor-)conditional.

(The obvious solution of just putting the proper register frame back in
its place would be okay except for totally breaking anything
trace-on-exit as already hashed to death...)

	-hpa

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  reply	other threads:[~2011-08-22 23:47 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
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 [this message]
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=4E52EA50.6070105@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@amd64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@mit.edu \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --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.