1. 26 May, 2008 4 commits
    • Ingo Molnar's avatar
      x86: fix canary of the boot CPU's idle task · 7e09b2a0
      Ingo Molnar authored
      the boot CPU's idle task has a zero stackprotector canary value.
      
      this is a special task that is never forked, so the fork code
      does not randomize its canary. Do it when we hit cpu_idle().
      
      Academic sidenote: this means that the early init code runs with a
      zero canary and hence the canary becomes predictable for this short,
      boot-only amount of time.
      
      Although attack vectors against early init code are very rare, it might
      make sense to move this initialization to an earlier point.
      (to one of the early init functions that never return - such as
      start_kernel())
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      7e09b2a0
    • Arjan van de Ven's avatar
      x86: setup stack canary for the idle threads · ce22bd92
      Arjan van de Ven authored
      The idle threads for non-boot CPUs are a bit special in how they
      are created; the result is that these don't have the stack canary
      set up properly in their PDA. Easiest fix is to just always set
      the PDA up correctly when entering the idle thread; this is a NOP
      for the boot cpu.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      ce22bd92
    • Ingo Molnar's avatar
      x86: fix stackprotector canary updates during context switches · e0032087
      Ingo Molnar authored
      fix a bug noticed and fixed by pageexec@freemail.hu.
      
      if built with -fstack-protector-all then we'll have canary checks built
      into the __switch_to() function. That does not work well with the
      canary-switching code there: while we already use the %rsp of the
      new task, we still call __switch_to() whith the previous task's canary
      value in the PDA, hence the __switch_to() ssp prologue instructions
      will store the previous canary. Then we update the PDA and upon return
      from __switch_to() the canary check triggers and we panic.
      
      so update the canary after we have called __switch_to(), where we are
      at the same stackframe level as the last stackframe of the next
      (and now freshly current) task.
      
      Note: this means that we call __switch_to() [and its sub-functions]
      still with the old canary, but that is not a problem, both the previous
      and the next task has a high-quality canary. The only (mostly academic)
      disadvantage is that the canary of one task may leak onto the stack of
      another task, increasing the risk of information leaks, were an attacker
      able to read the stack of specific tasks (but not that of others).
      
      To solve this we'll have to reorganize the way we switch tasks, and move
      the PDA setting into the switch_to() assembly code. That will happen in
      another patch.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      e0032087
    • Ingo Molnar's avatar
      x86: stackprotector & PARAVIRT fix · 4c7f8900
      Ingo Molnar authored
      on paravirt enabled 64-bit kernels the paravirt ops do function
      calls themselves - which is bad with the stackprotector - for
      example pda_init() loads 0 into %gs and then does MSR_GS_BASE
      write (which modifies gs.base) - but that MSR write is a function
      call on paravirt, which with stackprotector tries to read the
      stack canary from the PDA ... crashing the bootup.
      
      the solution was suggested by Arjan van de Ven: to exclude paravirt.c
      from stackprotector, too many lowlevel functionality is in it. It's
      not like we'll have paravirt functions with character arrays on
      their stack anyway...
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      4c7f8900
  2. 25 May, 2008 16 commits
  3. 24 May, 2008 20 commits