<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/include/asm/current.h, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-02-14T09:49:37Z</updated>
<entry>
<title>Merge branch 'x86/bugs' into x86/core, to pick up pending changes before dependent patches</title>
<updated>2024-02-14T09:49:37Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-02-14T09:48:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4589f199eb68afd462bd792f730c7936fe3dafb5'/>
<id>urn:sha1:4589f199eb68afd462bd792f730c7936fe3dafb5</id>
<content type='text'>
Merge in pending alternatives patching infrastructure changes, before
applying more patches.

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'v6.8-rc4' into x86/percpu, to resolve conflicts and refresh the branch</title>
<updated>2024-02-14T09:45:07Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2024-02-14T09:45:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=03c11eb3b16dc0058589751dfd91f254be2be613'/>
<id>urn:sha1:03c11eb3b16dc0058589751dfd91f254be2be613</id>
<content type='text'>
Conflicts:
	arch/x86/include/asm/percpu.h
	arch/x86/include/asm/text-patching.h

Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/bugs: Rename CONFIG_CALL_DEPTH_TRACKING  =&gt; CONFIG_MITIGATION_CALL_DEPTH_TRACKING</title>
<updated>2024-01-10T09:52:28Z</updated>
<author>
<name>Breno Leitao</name>
</author>
<published>2023-11-21T16:07:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fa31af31e726c7f5a8f84800153054ca499338a'/>
<id>urn:sha1:5fa31af31e726c7f5a8f84800153054ca499338a</id>
<content type='text'>
Step 3/10 of the namespace unification of CPU mitigations related Kconfig options.

Suggested-by: Josh Poimboeuf &lt;jpoimboe@kernel.org&gt;
Signed-off-by: Breno Leitao &lt;leitao@debian.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: https://lore.kernel.org/r/20231121160740.1249350-4-leitao@debian.org
</content>
</entry>
<entry>
<title>Kill unnecessary kernel.h include</title>
<updated>2023-12-27T16:49:56Z</updated>
<author>
<name>Kent Overstreet</name>
</author>
<published>2023-12-15T22:02:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=30094208cdc68cea9d814f8df94da7d0902ac6cd'/>
<id>urn:sha1:30094208cdc68cea9d814f8df94da7d0902ac6cd</id>
<content type='text'>
More trimming down unnecessary includes.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
</content>
</entry>
<entry>
<title>x86/percpu: Fix "const_pcpu_hot" version generation failure</title>
<updated>2023-12-11T10:47:14Z</updated>
<author>
<name>Uros Bizjak</name>
</author>
<published>2023-12-04T21:02:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e3703630bd3fead041a6bfb3a3f2a9891af6c34'/>
<id>urn:sha1:0e3703630bd3fead041a6bfb3a3f2a9891af6c34</id>
<content type='text'>
Version generation for "const_pcpu_hot" symbol failed because genksyms
doesn't know the __seg_gs keyword. Effectively revert commit 4604c052b84d
("x86/percpu: Declare const_pcpu_hot as extern const variable") and
use this_cpu_read_const() instead to avoid "sparse: dereference of
noderef expression" warning when reading const_pcpu_hot.

Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: https://lore.kernel.org/r/20231204210320.114429-1-ubizjak@gmail.com
</content>
</entry>
<entry>
<title>x86/percpu: Declare const_pcpu_hot as extern const variable</title>
<updated>2023-11-30T19:19:33Z</updated>
<author>
<name>Uros Bizjak</name>
</author>
<published>2023-11-30T16:27:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4604c052b84d66407f5e68045a1939685eac401e'/>
<id>urn:sha1:4604c052b84d66407f5e68045a1939685eac401e</id>
<content type='text'>
const_pcpu_hot is aliased by linker to pcpu_hot, so there is no need
to use the DECLARE_PER_CPU_ALIGNED() macro. Also, declare const_pcpu_hot
as extern to avoid allocating storage space for the aliased structure.

Fixes: ed2f752e0e0a ("x86/percpu: Introduce const-qualified const_pcpu_hot to micro-optimize code generation")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20231130162949.83518-1-ubizjak@gmail.com
Closes: https://lore.kernel.org/oe-kbuild-all/202311302257.tSFtZnly-lkp@intel.com/
</content>
</entry>
<entry>
<title>x86/percpu: Introduce const-qualified const_pcpu_hot to micro-optimize code generation</title>
<updated>2023-10-23T09:27:35Z</updated>
<author>
<name>Uros Bizjak</name>
</author>
<published>2023-10-20T16:19:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ed2f752e0e0a21d941ca0ee539ef3d4cd576bc5e'/>
<id>urn:sha1:ed2f752e0e0a21d941ca0ee539ef3d4cd576bc5e</id>
<content type='text'>
Some variables in pcpu_hot, currently current_task and top_of_stack
are actually per-thread variables implemented as per-CPU variables
and thus stable for the duration of the respective task.  There is
already an attempt to eliminate redundant reads from these variables
using this_cpu_read_stable() asm macro, which hides the dependency
on the read memory address. However, the compiler has limited ability
to eliminate asm common subexpressions, so this approach results in a
limited success.

The solution is to allow more aggressive elimination by aliasing
pcpu_hot into a const-qualified const_pcpu_hot, and to read stable
per-CPU variables from this constant copy.

The current per-CPU infrastructure does not support reads from
const-qualified variables. However, when the compiler supports segment
qualifiers, it is possible to declare the const-aliased variable in
the relevant named address space. The compiler considers access to the
variable, declared in this way, as a read from a constant location,
and will optimize reads from the variable accordingly.

By implementing constant-qualified const_pcpu_hot, the compiler can
eliminate redundant reads from the constant variables, reducing the
number of loads from current_task from 3766 to 3217 on a test build,
a -14.6% reduction.

The reduction of loads translates to the following code savings:

        text           data     bss      dec            hex filename
  25,477,353        4389456  808452 30675261        1d4113d vmlinux-old.o
  25,476,074        4389440  808452 30673966        1d40c2e vmlinux-new.o

representing a code size reduction of -1279 bytes.

[ mingo: Updated the changelog, EXPORT(const_pcpu_hot). ]

Co-developed-by: Nadav Amit &lt;namit@vmware.com&gt;
Signed-off-by: Nadav Amit &lt;namit@vmware.com&gt;
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20231020162004.135244-1-ubizjak@gmail.com
</content>
</entry>
<entry>
<title>x86/retbleed: Add SKL return thunk</title>
<updated>2022-10-17T14:41:15Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2022-09-15T11:11:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d8213864ade86b48fc492584ea86d65a62f892e'/>
<id>urn:sha1:5d8213864ade86b48fc492584ea86d65a62f892e</id>
<content type='text'>
To address the Intel SKL RSB underflow issue in software it's required to
do call depth tracking.

Provide a return thunk for call depth tracking on Intel SKL CPUs.

The tracking does not use a counter. It uses uses arithmetic shift
right on call entry and logical shift left on return.

The depth tracking variable is initialized to 0x8000.... when the call
depth is zero. The arithmetic shift right sign extends the MSB and
saturates after the 12th call. The shift count is 5 so the tracking covers
12 nested calls. On return the variable is shifted left logically so it
becomes zero again.

 CALL	 	   	RET
 0: 0x8000000000000000	0x0000000000000000
 1: 0xfc00000000000000	0xf000000000000000
...
11: 0xfffffffffffffff8	0xfffffffffffffc00
12: 0xffffffffffffffff	0xffffffffffffffe0

After a return buffer fill the depth is credited 12 calls before the next
stuffing has to take place.

There is a inaccuracy for situations like this:

   10 calls
    5 returns
    3 calls
    4 returns
    3 calls
    ....

The shift count might cause this to be off by one in either direction, but
there is still a cushion vs. the RSB depth. The algorithm does not claim to
be perfect, but it should obfuscate the problem enough to make exploitation
extremly difficult.

The theory behind this is:

RSB is a stack with depth 16 which is filled on every call. On the return
path speculation "pops" entries to speculate down the call chain. Once the
speculative RSB is empty it switches to other predictors, e.g. the Branch
History Buffer, which can be mistrained by user space and misguide the
speculation path to a gadget.

Call depth tracking is designed to break this speculation path by stuffing
speculation trap calls into the RSB which are never getting a corresponding
return executed. This stalls the prediction path until it gets resteered,

The assumption is that stuffing at the 12th return is sufficient to break
the speculation before it hits the underflow and the fallback to the other
predictors. Testing confirms that it works. Johannes, one of the retbleed
researchers. tried to attack this approach but failed.

There is obviously no scientific proof that this will withstand future
research progress, but all we can do right now is to speculate about it.

The SAR/SHL usage was suggested by Andi Kleen.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220915111147.890071690@infradead.org
</content>
</entry>
<entry>
<title>x86/softirq: Move softirq pending next to current task</title>
<updated>2022-10-17T14:41:05Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2022-09-15T11:11:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7fcecafebed90d03f35bec6e147fc0b5f6e1bc71'/>
<id>urn:sha1:7fcecafebed90d03f35bec6e147fc0b5f6e1bc71</id>
<content type='text'>
Another hot variable which is strict per CPU and benefits from
being in the same cache line.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220915111145.702133710@infradead.org
</content>
</entry>
<entry>
<title>x86/percpu: Move irq_stack variables next to current_task</title>
<updated>2022-10-17T14:41:05Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2022-09-15T11:11:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d7b6d709a76a4f4ef3108ac41e1b39eb80f5c084'/>
<id>urn:sha1:d7b6d709a76a4f4ef3108ac41e1b39eb80f5c084</id>
<content type='text'>
Further extend struct pcpu_hot with the hard and soft irq stack
pointers.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220915111145.599170752@infradead.org
</content>
</entry>
</feed>
