1. 18 6月, 2009 2 次提交
  2. 02 6月, 2009 1 次提交
  3. 21 4月, 2009 1 次提交
  4. 26 2月, 2009 1 次提交
    • H
      crypto: api - Fix module load deadlock with fallback algorithms · a760a665
      Herbert Xu 提交于
      With the mandatory algorithm testing at registration, we have
      now created a deadlock with algorithms requiring fallbacks.
      This can happen if the module containing the algorithm requiring
      fallback is loaded first, without the fallback module being loaded
      first.  The system will then try to test the new algorithm, find
      that it needs to load a fallback, and then try to load that.
      
      As both algorithms share the same module alias, it can attempt
      to load the original algorithm again and block indefinitely.
      
      As algorithms requiring fallbacks are a special case, we can fix
      this by giving them a different module alias than the rest.  Then
      it's just a matter of using the right aliases according to what
      algorithms we're trying to find.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      a760a665
  5. 25 12月, 2008 1 次提交
    • H
      crypto: padlock - Avoid resetting cword on successive operations · 420a4b20
      Herbert Xu 提交于
      Resetting the control word is quite expensive.  Fortunately this
      isn't an issue for the common operations such as CBC and ECB as
      the whole operation is done through a single call.  However, modes
      such as LRW and XTS have to call padlock over and over again for
      one operation which really hurts if each call resets the control
      word.
      
      This patch uses an idea by Sebastian Siewior to store the last
      control word used on a CPU and only reset the control word if
      that changes.
      
      Note that any task switch automatically resets the control word
      so we only need to be accurate with regard to the stored control
      word when no task switches occur.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      420a4b20
  6. 13 8月, 2008 1 次提交
    • S
      crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore() · e4914012
      Suresh Siddha 提交于
      Wolfgang Walter reported this oops on his via C3 using padlock for
      AES-encryption:
      
      ##################################################################
      
      BUG: unable to handle kernel NULL pointer dereference at 000001f0
      IP: [<c01028c5>] __switch_to+0x30/0x117
      *pde = 00000000
      Oops: 0002 [#1] PREEMPT
      Modules linked in:
      
      Pid: 2071, comm: sleep Not tainted (2.6.26 #11)
      EIP: 0060:[<c01028c5>] EFLAGS: 00010002 CPU: 0
      EIP is at __switch_to+0x30/0x117
      EAX: 00000000 EBX: c0493300 ECX: dc48dd00 EDX: c0493300
      ESI: dc48dd00 EDI: c0493530 EBP: c04cff8c ESP: c04cff7c
       DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
      Process sleep (pid: 2071, ti=c04ce000 task=dc48dd00 task.ti=d2fe6000)
      Stack: dc48df30 c0493300 00000000 00000000 d2fe7f44 c03b5b43 c04cffc8 00000046
             c0131856 0000005a dc472d3c c0493300 c0493470 d983ae00 00002696 00000000
             c0239f54 00000000 c04c4000 c04cffd8 c01025fe c04f3740 00049800 c04cffe0
      Call Trace:
       [<c03b5b43>] ? schedule+0x285/0x2ff
       [<c0131856>] ? pm_qos_requirement+0x3c/0x53
       [<c0239f54>] ? acpi_processor_idle+0x0/0x434
       [<c01025fe>] ? cpu_idle+0x73/0x7f
       [<c03a4dcd>] ? rest_init+0x61/0x63
       =======================
      
      Wolfgang also found out that adding kernel_fpu_begin() and kernel_fpu_end()
      around the padlock instructions fix the oops.
      
      Suresh wrote:
      
      These padlock instructions though don't use/touch SSE registers, but it behaves
      similar to other SSE instructions. For example, it might cause DNA faults
      when cr0.ts is set. While this is a spurious DNA trap, it might cause
      oops with the recent fpu code changes.
      
      This is the code sequence  that is probably causing this problem:
      
      a) new app is getting exec'd and it is somewhere in between
         start_thread() and flush_old_exec() in the load_xyz_binary()
      
      b) At pont "a", task's fpu state (like TS_USEDFPU, used_math() etc) is
         cleared.
      
      c) Now we get an interrupt/softirq which starts using these encrypt/decrypt
         routines in the network stack. This generates a math fault (as
         cr0.ts is '1') which sets TS_USEDFPU and restores the math that is
         in the task's xstate.
      
      d) Return to exec code path, which does start_thread() which does
         free_thread_xstate() and sets xstate pointer to NULL while
         the TS_USEDFPU is still set.
      
      e) At the next context switch from the new exec'd task to another task,
         we have a scenarios where TS_USEDFPU is set but xstate pointer is null.
         This can cause an oops during unlazy_fpu() in __switch_to()
      
      Now:
      
      1) This should happen with or with out pre-emption. Viro also encountered
         similar problem with out CONFIG_PREEMPT.
      
      2) kernel_fpu_begin() and kernel_fpu_end() will fix this problem, because
         kernel_fpu_begin() will manually do a clts() and won't run in to the
         situation of setting TS_USEDFPU in step "c" above.
      
      3) This was working before the fpu changes, because its a spurious
         math fault  which doesn't corrupt any fpu/sse registers and the task's
         math state was always in an allocated state.
      
      With out the recent lazy fpu allocation changes, while we don't see oops,
      there is a possible race still present in older kernels(for example,
      while kernel is using kernel_fpu_begin() in some optimized clear/copy
      page and an interrupt/softirq happens which uses these padlock
      instructions generating DNA fault).
      
      This is the failing scenario that existed even before the lazy fpu allocation
      changes:
      
      0. CPU's TS flag is set
      
      1. kernel using FPU in some optimized copy  routine and while doing
      kernel_fpu_begin() takes an interrupt just before doing clts()
      
      2. Takes an interrupt and ipsec uses padlock instruction. And we
      take a DNA fault as TS flag is still set.
      
      3. We handle the DNA fault and set TS_USEDFPU and clear cr0.ts
      
      4. We complete the padlock routine
      
      5. Go back to step-1, which resumes clts() in kernel_fpu_begin(), finishes
      the optimized copy routine and does kernel_fpu_end(). At this point,
      we have cr0.ts again set to '1' but the task's TS_USEFPU is stilll
      set and not cleared.
      
      6. Now kernel resumes its user operation. And at the next context
      switch, kernel sees it has do a FP save as TS_USEDFPU is still set
      and then will do a unlazy_fpu() in __switch_to(). unlazy_fpu()
      will take a DNA fault, as cr0.ts is '1' and now, because we are
      in __switch_to(), math_state_restore() will get confused and will
      restore the next task's FP state and will save it in prev tasks's FP state.
      Remember, in __switch_to() we are already on the stack of the next task
      but take a DNA fault for the prev task.
      
      This causes the fpu leakage.
      
      Fix the padlock instruction usage by calling them inside the
      context of new routines irq_ts_save/restore(), which clear/restore cr0.ts
      manually in the interrupt context. This will not generate spurious DNA
      in the  context of the interrupt which will fix the oops encountered and
      the possible FPU leakage issue.
      Reported-and-bisected-by: NWolfgang Walter <wolfgang.walter@stwm.de>
      Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      e4914012
  7. 10 7月, 2008 1 次提交
  8. 21 4月, 2008 1 次提交
  9. 11 1月, 2008 3 次提交
  10. 28 12月, 2007 1 次提交
  11. 11 10月, 2007 1 次提交
  12. 21 9月, 2006 7 次提交
  13. 15 7月, 2006 1 次提交
  14. 26 6月, 2006 2 次提交
    • H
      [CRYPTO] padlock: Rearrange context structure to reduce code size · 82062c72
      Herbert Xu 提交于
      i386 assembly has more compact instructions for accessing 7-bit offsets.
      So by moving the large members to the end of the structure we can save
      quite a bit of code size.  This patch shaves about 10% or 300 bytes off
      the padlock-aes file.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      82062c72
    • H
      [CRYPTO] all: Pass tfm instead of ctx to algorithms · 6c2bb98b
      Herbert Xu 提交于
      Up until now algorithms have been happy to get a context pointer since
      they know everything that's in the tfm already (e.g., alignment, block
      size).
      
      However, once we have parameterised algorithms, such information will
      be specific to each tfm.  So the algorithm API needs to be changed to
      pass the tfm structure instead of the context pointer.
      
      This patch is basically a text substitution.  The only tricky bit is
      the assembly routines that need to get the context pointer offset
      through asm-offsets.h.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      6c2bb98b
  15. 21 3月, 2006 1 次提交
    • H
      [CRYPTO] api: Align tfm context as wide as possible · f10b7897
      Herbert Xu 提交于
      Since tfm contexts can contain arbitrary types we should provide at least
      natural alignment (__attribute__ ((__aligned__))) for them.  In particular,
      this is needed on the Xscale which is a 32-bit architecture with a u64 type
      that requires 64-bit alignment.  This problem was reported by Ronen Shitrit.
      
      The crypto_tfm structure's size was 44 bytes on 32-bit architectures and
      80 bytes on 64-bit architectures.  So adding this requirement only means
      that we have to add an extra 4 bytes on 32-bit architectures.
      
      On i386 the natural alignment is 16 bytes which also benefits the VIA
      Padlock as it no longer has to manually align its context structure to
      128 bits.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f10b7897
  16. 22 2月, 2006 1 次提交
  17. 10 1月, 2006 2 次提交
  18. 07 7月, 2005 4 次提交
  19. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4