[lkml]   [2009]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH 0/2] x86-64: 32/64 syscall arch holes
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://

are available in the git repository at:

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(-)


 \ /
  Last update: 2009-02-28 04:11    [W:0.115 / U:2.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site