<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/asm-x86, branch v2.6.26.5</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/include/asm-x86?h=v2.6.26.5</id>
<link rel='self' href='https://git.amat.us/linux/atom/include/asm-x86?h=v2.6.26.5'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2008-08-20T18:05:15Z</updated>
<entry>
<title>crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore()</title>
<updated>2008-08-20T18:05:15Z</updated>
<author>
<name>Suresh Siddha</name>
<email>suresh.b.siddha@intel.com</email>
</author>
<published>2008-08-15T00:13:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=faf996d6cdc3a8e6205ae5226f667aa7d1f5f6c2'/>
<id>urn:sha1:faf996d6cdc3a8e6205ae5226f667aa7d1f5f6c2</id>
<content type='text'>
crypto: padlock - fix VIA PadLock instruction usage with irq_ts_save/restore()

[ Upstream commit: e49140120c88eb99db1a9172d9ac224c0f2bbdd2 ]

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: [&lt;c01028c5&gt;] __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:[&lt;c01028c5&gt;] 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:
[&lt;c03b5b43&gt;] ? schedule+0x285/0x2ff
[&lt;c0131856&gt;] ? pm_qos_requirement+0x3c/0x53
[&lt;c0239f54&gt;] ? acpi_processor_idle+0x0/0x434
[&lt;c01025fe&gt;] ? cpu_idle+0x73/0x7f
[&lt;c03a4dcd&gt;] ? 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: Wolfgang Walter &lt;wolfgang.walter@stwm.de&gt;
Signed-off-by: Suresh Siddha &lt;suresh.b.siddha@intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>x86: fix spin_is_contended()</title>
<updated>2008-08-20T18:05:13Z</updated>
<author>
<name>Jan Beulich</name>
<email>jbeulich@novell.com</email>
</author>
<published>2008-08-17T00:25:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a6582aa43703213e727161911938db89c511aa57'/>
<id>urn:sha1:a6582aa43703213e727161911938db89c511aa57</id>
<content type='text'>
commit 7bc069c6bc4ede519a7116be1b9e149a1dbf787a upstream

The masked difference is what needs to be compared against 1, rather
than the difference of masked values (which can be negative).

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Acked-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Fix typos from signal_32/64.h merge</title>
<updated>2008-08-01T19:43:01Z</updated>
<author>
<name>Herton Ronaldo Krzesinski</name>
<email>herton@mandriva.com.br</email>
</author>
<published>2008-07-21T18:30:12Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f26eb5b7962376661e7ddd5c8e7ba3da692b7122'/>
<id>urn:sha1:f26eb5b7962376661e7ddd5c8e7ba3da692b7122</id>
<content type='text'>
commit 723edb5060855ef36ddeca51a070784b0e0d16df upstream

Fallout from commit 33185c504f8e521b398536b5a8d415779a24593c ("x86:
merge signal_32/64.h")

Thanks to Dick Streefland who provided an useful testcase on
http://lkml.org/lkml/2008/3/17/205 (only applicable to 2.6.24.x), that
helped a lot as a deterministic way to bisect an issue that leaded to
this fix.

Signed-off-by: Herton Ronaldo Krzesinski &lt;herton@mandriva.com.br&gt;
Signed-off-by: Luiz Fernando N. Capitulino &lt;lcapitulino@mandriva.com.br&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2008-07-12T21:34:31Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-07-12T21:34:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9df2fe986770bc4c76e8fe72c20b71268eec39a7'/>
<id>urn:sha1:9df2fe986770bc4c76e8fe72c20b71268eec39a7</id>
<content type='text'>
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: fix ldt limit for 64 bit
</content>
</entry>
<entry>
<title>x86: fix ldt limit for 64 bit</title>
<updated>2008-07-12T05:11:31Z</updated>
<author>
<name>Michael Karcher</name>
<email>kernel@mkarcher.dialup.fu-berlin.de</email>
</author>
<published>2008-07-11T16:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5ac37f87ff18843aabab84cf75b2f8504c2d81fe'/>
<id>urn:sha1:5ac37f87ff18843aabab84cf75b2f8504c2d81fe</id>
<content type='text'>
Fix size of LDT entries. On x86-64, ldt_desc is a double-sized descriptor.

Signed-off-by: Michael Karcher &lt;kernel@mkarcher.dialup.fu-berlin.de&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>x86: KVM guest: Add memory clobber to hypercalls</title>
<updated>2008-07-06T08:05:18Z</updated>
<author>
<name>Anthony Liguori</name>
<email>aliguori@us.ibm.com</email>
</author>
<published>2008-07-03T16:02:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ca3739327b89bb4053a62ac41b67b106c1967ab0'/>
<id>urn:sha1:ca3739327b89bb4053a62ac41b67b106c1967ab0</id>
<content type='text'>
Hypercalls can modify arbitrary regions of memory.  Make sure to indicate this
in the clobber list.  This fixes a hang when using KVM_GUEST kernel built with
GCC 4.3.0.

This was originally spotted and analyzed by Marcelo.

Signed-off-by: Anthony Liguori &lt;aliguori@us.ibm.com&gt;
Signed-off-by: Avi Kivity &lt;avi@qumranet.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2008-06-30T15:56:57Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-06-30T15:56:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bbad5d4750ab3b44a196f9bdd982972e41b7e520'/>
<id>urn:sha1:bbad5d4750ab3b44a196f9bdd982972e41b7e520</id>
<content type='text'>
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  ptrace GET/SET FPXREGS broken
  x86: fix cpu hotplug crash
  x86: section/warning fixes
  x86: shift bits the right way in native_read_tscp
</content>
</entry>
<entry>
<title>x86: shift bits the right way in native_read_tscp</title>
<updated>2008-06-26T12:49:17Z</updated>
<author>
<name>Max Asbock</name>
<email>masbock@us.ibm.com</email>
</author>
<published>2008-06-25T21:45:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=41aefdcc98fdba47459eab67630293d67e855fc3'/>
<id>urn:sha1:41aefdcc98fdba47459eab67630293d67e855fc3</id>
<content type='text'>
native_read_tscp shifts the bits in the high order value in the
wrong direction, the attached patch fixes that.

Signed-off-by: Max Asbock &lt;masbock@linux.vnet.ibm.com&gt;
Acked-by: Glauber Costa &lt;gcosta@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Merge branch 'kvm-updates-2.6.26' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm</title>
<updated>2008-06-25T01:09:06Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-06-25T01:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=919c0d14ae93073a3957c018a6d86ceb1e2e454b'/>
<id>urn:sha1:919c0d14ae93073a3957c018a6d86ceb1e2e454b</id>
<content type='text'>
* 'kvm-updates-2.6.26' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm:
  KVM: Remove now unused structs from kvm_para.h
  x86: KVM guest: Use the paravirt clocksource structs and functions
  KVM: Make kvm host use the paravirt clocksource structs
  x86: Make xen use the paravirt clocksource structs and functions
  x86: Add structs and functions for paravirt clocksource
  KVM: VMX: Fix host msr corruption with preemption enabled
  KVM: ioapic: fix lost interrupt when changing a device's irq
  KVM: MMU: Fix oops on guest userspace access to guest pagetable
  KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend)
  KVM: MMU: Fix rmap_write_protect() hugepage iteration bug
  KVM: close timer injection race window in __vcpu_run
  KVM: Fix race between timer migration and vcpu migration
</content>
</entry>
<entry>
<title>KVM: Remove now unused structs from kvm_para.h</title>
<updated>2008-06-24T18:02:33Z</updated>
<author>
<name>Gerd Hoffmann</name>
<email>kraxel@redhat.com</email>
</author>
<published>2008-06-03T14:17:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6b1ed9086592fd4b066daae222751bb6757ca5eb'/>
<id>urn:sha1:6b1ed9086592fd4b066daae222751bb6757ca5eb</id>
<content type='text'>
The kvm_* structs are obsoleted by the pvclock_* ones.
Now all users have been switched over and the old structs
can be dropped.

Signed-off-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;
Signed-off-by: Avi Kivity &lt;avi@qumranet.com&gt;
</content>
</entry>
</feed>
