public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] x86-64: 32/64 syscall arch holes
@ 2009-02-28  3:02 Roland McGrath
  2009-02-28  3:03 ` [PATCH 1/2] x86-64: syscall-audit: fix 32/64 syscall hole Roland McGrath
  2009-02-28  3:04 ` [PATCH 2/2] x86-64: seccomp: " Roland McGrath
  0 siblings, 2 replies; 31+ messages in thread
From: Roland McGrath @ 2009-02-28  3:02 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: x86, linux-kernel, stable

On x86-64, a 32-bit process (TIF_IA32) can switch to 64-bit mode with
ljmp, and then use the "syscall" instruction to make a 64-bit system
call.  A 64-bit process make a 32-bit system call with int $0x80.

Both these uses can confuse some things that think they know what system
call and arguments the registers mean.  This is easily fixed by checking
TS_COMPAT ("syscall we are in is 32-bit") instead of TIF_IA32 ("this task
was started as 32-bit").

I don't know of any other arch that is susceptible to a similar problem.
I think on other 32/64 arch's either the syscall table is the same anyway,
or it's not possible to make an other-wordsize flavored syscall at all,
or both.

It occurred to me that the audit case was wrong, but I didn't try to test
it.  A test program similar to the seccomp exploit would be the way to do
it (but omit the prctl call) and there are many more options of a syscall
number whose presumed-arch meaning is harmless and not noticed by your
audit setup, but whose actually-other-arch meaning is something that could
be malicious and that your audit setup intends to flag.

The following changes since commit 778ef1e6cbb049c9bcbf405936ee6f2b6e451892:
  Linus Torvalds (1):
        Merge git://git.kernel.org/.../gregkh/staging-2.6

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frob/linux-2.6-roland.git x86/syscall-arch-holes

Roland McGrath (2):
      x86-64: syscall-audit: fix 32/64 syscall hole
      x86-64: seccomp: fix 32/64 syscall hole

 arch/x86/include/asm/seccomp_64.h |   14 ++++++++------
 arch/x86/kernel/ptrace.c          |    2 +-
 kernel/seccomp.c                  |   11 ++++++++---
 3 files changed, 17 insertions(+), 10 deletions(-)

Thanks,
Roland

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2009-05-11 12:15 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-28  3:02 [PATCH 0/2] x86-64: 32/64 syscall arch holes Roland McGrath
2009-02-28  3:03 ` [PATCH 1/2] x86-64: syscall-audit: fix 32/64 syscall hole Roland McGrath
2009-02-28  3:04 ` [PATCH 2/2] x86-64: seccomp: " Roland McGrath
2009-02-28  3:36   ` Linus Torvalds
2009-02-28  3:52     ` Linus Torvalds
2009-02-28  4:46       ` Ingo Molnar
2009-02-28  7:25       ` Roland McGrath
2009-02-28  7:31         ` Ingo Molnar
2009-02-28  7:36           ` Roland McGrath
2009-02-28 17:23         ` Linus Torvalds
2009-02-28 17:46           ` [stable] " Greg KH
2009-02-28 17:54             ` Arjan van de Ven
2009-02-28 18:23               ` Greg KH
2009-02-28 20:27                 ` Greg KH
2009-02-28 21:09           ` Benjamin Herrenschmidt
2009-03-02  1:44           ` Roland McGrath
2009-05-06 18:46           ` Markus Gutschke (顧孟勤)
2009-05-06 21:29             ` Ingo Molnar
2009-05-06 21:46               ` Markus Gutschke (顧孟勤)
2009-05-06 21:54                 ` Ingo Molnar
2009-05-06 22:08                   ` Markus Gutschke (顧孟勤)
2009-05-06 22:13                     ` Ingo Molnar
2009-05-06 22:21                       ` Markus Gutschke (顧孟勤)
2009-05-07  4:23                         ` Nicholas Miell
2009-05-07 10:11                           ` Ingo Molnar
2009-05-10  5:37                             ` Pavel Machek
2009-05-08 19:18                     ` Andi Kleen
2009-05-07  7:31                 ` Roland McGrath
2009-05-08  1:59                   ` David Wagner
2009-05-10  5:36                     ` Pavel Machek
     [not found]                 ` <20090507070312.DCC5EFC39E@magilla.sf.frob.com>
2009-05-07  8:01                   ` Markus Gutschke (顧孟勤)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox