1. 29 Jul, 2014 1 commit
    • Sven Wegener's avatar
      x86_32, entry: Store badsys error code in %eax · 5eb2fae2
      Sven Wegener authored
      commit 8142b215 upstream.
      
      Commit 554086d8 ("x86_32, entry: Do syscall exit work on badsys
      (CVE-2014-4508)") introduced a regression in the x86_32 syscall entry
      code, resulting in syscall() not returning proper errors for undefined
      syscalls on CPUs supporting the sysenter feature.
      
      The following code:
      
      > int result = syscall(666);
      > printf("result=%d errno=%d error=%s\n", result, errno, strerror(errno));
      
      results in:
      
      > result=666 errno=0 error=Success
      
      Obviously, the syscall return value is the called syscall number, but it
      should have been an ENOSYS error. When run under ptrace it behaves
      correctly, which makes it hard to debug in the wild:
      
      > result=-1 errno=38 error=Function not implemented
      
      The %eax register is the return value register. For debugging via ptrace
      the syscall entry code stores the complete register context on the
      stack. The badsys handlers only store the ENOSYS error code in the
      ptrace register set and do not set %eax like a regular syscall handler
      would. The old resume_userspace call chain contains code that clobbers
      %eax and it restores %eax from the ptrace registers afterwards. The same
      goes for the ptrace-enabled call chain. When ptrace is not used, the
      syscall return value is the passed-in syscall number from the untouched
      %eax register.
      
      Use %eax as the return value register in syscall_badsys and
      sysenter_badsys, like a real syscall handler does, and have the caller
      push the value onto the stack for ptrace access.
      Signed-off-by: default avatarSven Wegener <sven.wegener@stealer.net>
      Link: http://lkml.kernel.org/r/alpine.LNX.2.11.1407221022380.31021@titan.int.lan.stealer.netReviewed-and-tested-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      5eb2fae2
  2. 24 Jul, 2014 1 commit
  3. 21 Jul, 2014 4 commits
    • Xufeng Zhang's avatar
      sctp: Fix sk_ack_backlog wrap-around problem · 56ac66c9
      Xufeng Zhang authored
      commit d3217b15 upstream.
      
      Consider the scenario:
      For a TCP-style socket, while processing the COOKIE_ECHO chunk in
      sctp_sf_do_5_1D_ce(), after it has passed a series of sanity check,
      a new association would be created in sctp_unpack_cookie(), but afterwards,
      some processing maybe failed, and sctp_association_free() will be called to
      free the previously allocated association, in sctp_association_free(),
      sk_ack_backlog value is decremented for this socket, since the initial
      value for sk_ack_backlog is 0, after the decrement, it will be 65535,
      a wrap-around problem happens, and if we want to establish new associations
      afterward in the same socket, ABORT would be triggered since sctp deem the
      accept queue as full.
      Fix this issue by only decrementing sk_ack_backlog for associations in
      the endpoint's list.
      Fix-suggested-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarXufeng Zhang <xufeng.zhang@windriver.com>
      Acked-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Acked-by: default avatarVlad Yasevich <vyasevich@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Reference: CVE-2014-4667
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      56ac66c9
    • Nicholas Bellinger's avatar
      target: Explicitly clear ramdisk_mcp backend pages · ff5d076f
      Nicholas Bellinger authored
      [Note that a different patch to address the same issue went in during
      v3.15-rc1 (commit 4442dc8a), but includes a bunch of other changes that
      don't strictly apply to fixing the bug.]
      
      This patch changes rd_allocate_sgl_table() to explicitly clear
      ramdisk_mcp backend memory pages by passing __GFP_ZERO into
      alloc_pages().
      
      This addresses a potential security issue where reading from a
      ramdisk_mcp could return sensitive information, and follows what
      >= v3.15 does to explicitly clear ramdisk_mcp memory at backend
      device initialization time.
      Reported-by: default avatarJorge Daniel Sequeira Matias <jdsm@tecnico.ulisboa.pt>
      Cc: Jorge Daniel Sequeira Matias <jdsm@tecnico.ulisboa.pt>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Reference: CVE-2014-4027
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ff5d076f
    • Paolo Bonzini's avatar
      KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155) · bad3f63f
      Paolo Bonzini authored
      commit 5678de3f upstream.
      
      QE reported that they got the BUG_ON in ioapic_service to trigger.
      I cannot reproduce it, but there are two reasons why this could happen.
      
      The less likely but also easiest one, is when kvm_irq_delivery_to_apic
      does not deliver to any APIC and returns -1.
      
      Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that
      function is never reached.  However, you can target the similar loop in
      kvm_irq_delivery_to_apic_fast; just program a zero logical destination
      address into the IOAPIC, or an out-of-range physical destination address.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      bad3f63f
    • Tony Camuso's avatar
      ACPI / PAD: call schedule() when need_resched() is true · a0c72a16
      Tony Camuso authored
      commit 5b59c69e upstream.
      
      The purpose of the acpi_pad driver is to implement the "processor power
      aggregator" device as described in the ACPI 4.0 spec section 8.5. It
      takes requests from the BIOS (via ACPI) to put a specified number of
      CPUs into idle, in order to save power, until further notice.
      
      It does this by creating high-priority threads that try to keep the CPUs
      in a high C-state (using the monitor/mwait CPU instructions). The
      mwait() call is in a loop that checks periodically if the thread should
      end and a few other things.
      
      It was discovered through testing that the power_saving threads were
      causing the system to consume more power than the system was consuming
      before the threads were created. A counter in the main loop of
      power_saving_thread() revealed that it was spinning. The mwait()
      instruction was not keeping the CPU in a high C state very much if at
      all.
      
      Here is a simplification of the loop in function power_saving_thread() in
      drivers/acpi/acpi_pad.c
      
          while (!kthread_should_stop()) {
               :
              try_to_freeze()
               :
              while (!need_resched()) {
                   :
                  if (!need_resched())
                      __mwait(power_saving_mwait_eax, 1);
                   :
                  if (jiffies > expire_time) {
                      do_sleep = 1;
                      break;
                  }
              }
          }
      
      If need_resched() returns true, then mwait() is not called. It was
      returning true because of things like timer interrupts, as in the
      following sequence.
      
      hrtimer_interrupt->__run_hrtimer->tick_sched_timer-> update_process_times->
      rcu_check_callbacks->rcu_pending->__rcu_pending->set_need_resched
      
      Kernels 3.5.0-rc2+ do not exhibit this problem, because a patch to
      try_to_freeze() in include/linux/freezer.h introduces a call to
      might_sleep(), which ultimately calls schedule() to clear the reschedule
      flag and allows the the loop to execute the call to mwait().
      
      However, the changes to try_to_freeze are unrelated to acpi_pad, and it
      does not seem like a good idea to rely on an unrelated patch in a
      function that could later be changed and reintroduce this bug.
      
      Therefore, it seems better to make an explicit call to schedule() in the
      outer loop when the need_resched flag is set.
      Reported-and-tested-by: default avatarStuart Hayes <stuart_hayes@dell.com>
      Signed-off-by: default avatarTony Camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Leann Ogasawara <leann.ogasawara@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a0c72a16
  4. 18 Jul, 2014 1 commit
  5. 16 Jul, 2014 33 commits