mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Roland McGrath <roland@redhat.com>,
	Andy Lutomirski <luto@amacapital.net>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.8 01/13] x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508)
Date: Mon, 25 Aug 2014 09:54:47 -0700	[thread overview]
Message-ID: <1408985699-31838-2-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1408985699-31838-1-git-send-email-kamal@canonical.com>

3.8.13.28 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Lutomirski <luto@amacapital.net>

commit 554086d85e71f30abe46fc014fea31929a7c6a8a upstream.

The bad syscall nr paths are their own incomprehensible route
through the entry control flow.  Rearrange them to work just like
syscalls that return -ENOSYS.

This fixes an OOPS in the audit code when fast-path auditing is
enabled and sysenter gets a bad syscall nr (CVE-2014-4508).

This has probably been broken since Linux 2.6.27:
af0575bba0 i386 syscall audit fast-path

Cc: Roland McGrath <roland@redhat.com>
Reported-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/e09c499eade6fc321266dd6b54da7beb28d6991c.1403558229.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/entry_32.S | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 60d03c2..b32b466 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -434,9 +434,10 @@ sysenter_past_esp:
 	jnz sysenter_audit
 sysenter_do_call:
 	cmpl $(NR_syscalls), %eax
-	jae syscall_badsys
+	jae sysenter_badsys
 	call *sys_call_table(,%eax,4)
 	movl %eax,PT_EAX(%esp)
+sysenter_after_call:
 	LOCKDEP_SYS_EXIT
 	DISABLE_INTERRUPTS(CLBR_ANY)
 	TRACE_IRQS_OFF
@@ -686,7 +687,12 @@ END(syscall_fault)
 
 syscall_badsys:
 	movl $-ENOSYS,PT_EAX(%esp)
-	jmp resume_userspace
+	jmp syscall_exit
+END(syscall_badsys)
+
+sysenter_badsys:
+	movl $-ENOSYS,PT_EAX(%esp)
+	jmp sysenter_after_call
 END(syscall_badsys)
 	CFI_ENDPROC
 /*
-- 
1.9.1


  reply	other threads:[~2014-08-25 16:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 16:54 [3.8.y.z extended stable] Linux 3.8.13.28 stable review Kamal Mostafa
2014-08-25 16:54 ` Kamal Mostafa [this message]
2014-08-25 16:54 ` [PATCH 3.8 02/13] x86_32, entry: Store badsys error code in %eax Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 03/13] shmem: fix faulting into a hole while it's punched Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 04/13] shmem: fix faulting into a hole, not taking i_mutex Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 05/13] shmem: fix splicing from a hole while it's punched Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 06/13] target: Explicitly clear ramdisk_mcp backend pages Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 07/13] sctp: Fix sk_ack_backlog wrap-around problem Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 08/13] mnt: Only change user settable mount flags in remount Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 09/13] mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 10/13] mnt: Correct permission checks in do_remount Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 11/13] mnt: Change the default remount atime from relatime to the existing value Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 12/13] ptrace,x86: force IRET path after a ptrace_stop() Kamal Mostafa
2014-08-25 16:54 ` [PATCH 3.8 13/13] net/l2tp: don't fall back on UDP [get|set]sockopt Kamal Mostafa
2014-08-25 17:00 ` [3.8.y.z extended stable] Linux 3.8.13.28 stable review Greg KH
2014-08-25 19:14   ` Kamal Mostafa
2014-08-25 19:37     ` Greg KH

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=1408985699-31838-2-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=hpa@linux.intel.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=roland@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®