<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/entry/calling.h, branch linux-5.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-07-23T10:56:56Z</updated>
<entry>
<title>x86/retbleed: Add fine grained Kconfig knobs</title>
<updated>2022-07-23T10:56:56Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2022-06-27T22:21:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=813423f90f0553c81c5fb4d531fc688a5d506b24'/>
<id>urn:sha1:813423f90f0553c81c5fb4d531fc688a5d506b24</id>
<content type='text'>
commit f43b9876e857c739d407bc56df288b0ebe1a9164 upstream.

Do fine-grained Kconfig for all the various retbleed parts.

NOTE: if your compiler doesn't support return thunks this will
silently 'upgrade' your mitigation to IBPB, you might not like this.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
[cascardo: there is no CONFIG_OBJTOOL]
[cascardo: objtool calling and option parsing has changed]
Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/entry: Add kernel IBRS implementation</title>
<updated>2022-07-23T10:56:48Z</updated>
<author>
<name>Thadeu Lima de Souza Cascardo</name>
</author>
<published>2022-07-08T16:50:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=47e51d66d93d70d60e478cc81504deb0f4ff67ad'/>
<id>urn:sha1:47e51d66d93d70d60e478cc81504deb0f4ff67ad</id>
<content type='text'>
commit 2dbb887e875b1de3ca8f40ddf26bcfe55798c609 upstream.

Implement Kernel IBRS - currently the only known option to mitigate RSB
underflow speculation issues on Skylake hardware.

Note: since IBRS_ENTER requires fuller context established than
UNTRAIN_RET, it must be placed after it. However, since UNTRAIN_RET
itself implies a RET, it must come after IBRS_ENTER. This means
IBRS_ENTER needs to also move UNTRAIN_RET.

Note 2: KERNEL_IBRS is sub-optimal for XenPV.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Josh Poimboeuf &lt;jpoimboe@kernel.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
[cascardo: conflict at arch/x86/entry/entry_64_compat.S]
Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/entry: Remove skip_r11rcx</title>
<updated>2022-07-23T10:56:41Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2022-05-06T12:14:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c29a2229f5a70c8916c6abefb98aea8a38d763d4'/>
<id>urn:sha1:c29a2229f5a70c8916c6abefb98aea8a38d763d4</id>
<content type='text'>
commit 1b331eeea7b8676fc5dbdf80d0a07e41be226177 upstream.

Yes, r11 and rcx have been restored previously, but since they're being
popped anyway (into rsi) might as well pop them into their own regs --
setting them to the value they already are.

Less magical code.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lore.kernel.org/r/20220506121631.365070674@infradead.org
Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/entry: Split PUSH_AND_CLEAR_REGS into two submacros</title>
<updated>2021-05-12T08:49:15Z</updated>
<author>
<name>H. Peter Anvin (Intel)</name>
</author>
<published>2021-05-10T18:53:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=29e9758966f47004bd7245e6adadcb708386f36a'/>
<id>urn:sha1:29e9758966f47004bd7245e6adadcb708386f36a</id>
<content type='text'>
PUSH_AND_CLEAR_REGS, as the name implies, performs two functions:
pushing registers and clearing registers. They don't necessarily have
to be performed in immediate sequence, although all current users
do. Split it into two macros for the case where that isn't desired;
the FRED enabling patchset will eventually make use of this.

Signed-off-by: H. Peter Anvin (Intel) &lt;hpa@zytor.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210510185316.3307264-6-hpa@zytor.com
</content>
</entry>
<entry>
<title>x86/entry: Unify definitions from &lt;asm/calling.h&gt; and &lt;asm/ptrace-abi.h&gt;</title>
<updated>2021-05-12T08:49:13Z</updated>
<author>
<name>H. Peter Anvin (Intel)</name>
</author>
<published>2021-05-10T18:53:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6627eb25e40cc8d135d3f8d5391851d18ac497d7'/>
<id>urn:sha1:6627eb25e40cc8d135d3f8d5391851d18ac497d7</id>
<content type='text'>
The register offsets in &lt;asm/ptrace-abi.h&gt; are duplicated in
entry/calling.h, but are formatted differently and therefore not
compatible. Use the version from &lt;asm/ptrace-abi.h&gt; consistently.

Signed-off-by: H. Peter Anvin (Intel) &lt;hpa@zytor.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20210510185316.3307264-2-hpa@zytor.com
</content>
</entry>
<entry>
<title>x86/entry/64: Do not include inst.h in calling.h</title>
<updated>2020-09-04T08:59:21Z</updated>
<author>
<name>Uros Bizjak</name>
</author>
<published>2020-08-27T17:17:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb3621798bcdd34ba480109bac357ba6a784d3e2'/>
<id>urn:sha1:eb3621798bcdd34ba480109bac357ba6a784d3e2</id>
<content type='text'>
inst.h was included in calling.h solely to instantiate the RDPID macro.
The usage of RDPID was removed in

  6a3ea3e68b8a ("x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM")

so remove the include.

Fixes: 6a3ea3e68b8a ("x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM")
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200827171735.93825-1-ubizjak@gmail.com
</content>
</entry>
<entry>
<title>x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM</title>
<updated>2020-08-21T14:15:27Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2020-08-21T10:52:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6a3ea3e68b8a8a26c4aaac03432ed92269c9a14e'/>
<id>urn:sha1:6a3ea3e68b8a8a26c4aaac03432ed92269c9a14e</id>
<content type='text'>
KVM has an optmization to avoid expensive MRS read/writes on
VMENTER/EXIT. It caches the MSR values and restores them either when
leaving the run loop, on preemption or when going out to user space.

The affected MSRs are not required for kernel context operations. This
changed with the recently introduced mechanism to handle FSGSBASE in the
paranoid entry code which has to retrieve the kernel GSBASE value by
accessing per CPU memory. The mechanism needs to retrieve the CPU number
and uses either LSL or RDPID if the processor supports it.

Unfortunately RDPID uses MSR_TSC_AUX which is in the list of cached and
lazily restored MSRs, which means between the point where the guest value
is written and the point of restore, MSR_TSC_AUX contains a random number.

If an NMI or any other exception which uses the paranoid entry path happens
in such a context, then RDPID returns the random guest MSR_TSC_AUX value.

As a consequence this reads from the wrong memory location to retrieve the
kernel GSBASE value. Kernel GS is used to for all regular this_cpu_*()
operations. If the GSBASE in the exception handler points to the per CPU
memory of a different CPU then this has the obvious consequences of data
corruption and crashes.

As the paranoid entry path is the only place which accesses MSR_TSX_AUX
(via RDPID) and the fallback via LSL is not significantly slower, remove
the RDPID alternative from the entry path and always use LSL.

The alternative would be to write MSR_TSC_AUX on every VMENTER and VMEXIT
which would be inflicting massive overhead on that code path.

[ tglx: Rewrote changelog ]

Fixes: eaad981291ee3 ("x86/entry/64: Introduce the FIND_PERCPU_BASE macro")
Reported-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Debugged-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Suggested-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20200821105229.18938-1-pbonzini@redhat.com
</content>
</entry>
<entry>
<title>x86/entry/64: Handle FSGSBASE enabled paranoid entry/exit</title>
<updated>2020-06-18T13:47:04Z</updated>
<author>
<name>Chang S. Bae</name>
</author>
<published>2020-05-28T20:13:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c82965f9e53005c1c62632c468968293262056cb'/>
<id>urn:sha1:c82965f9e53005c1c62632c468968293262056cb</id>
<content type='text'>
Without FSGSBASE, user space cannot change GSBASE other than through a
PRCTL. The kernel enforces that the user space GSBASE value is postive as
negative values are used for detecting the kernel space GSBASE value in the
paranoid entry code.

If FSGSBASE is enabled, user space can set arbitrary GSBASE values without
kernel intervention, including negative ones, which breaks the paranoid
entry assumptions.

To avoid this, paranoid entry needs to unconditionally save the current
GSBASE value independent of the interrupted context, retrieve and write the
kernel GSBASE and unconditionally restore the saved value on exit. The
restore happens either in paranoid_exit or in the special exit path of the
NMI low level code.

All other entry code pathes which use unconditional SWAPGS are not affected
as they do not depend on the actual content.

[ tglx: Massaged changelogs and comments ]

Suggested-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Suggested-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Chang S. Bae &lt;chang.seok.bae@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/1557309753-24073-13-git-send-email-chang.seok.bae@intel.com
Link: https://lkml.kernel.org/r/20200528201402.1708239-12-sashal@kernel.org


</content>
</entry>
<entry>
<title>x86/entry/64: Introduce the FIND_PERCPU_BASE macro</title>
<updated>2020-06-18T13:47:04Z</updated>
<author>
<name>Chang S. Bae</name>
</author>
<published>2020-05-28T20:13:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eaad981291ee36efee15a5e515d4598ae94ace07'/>
<id>urn:sha1:eaad981291ee36efee15a5e515d4598ae94ace07</id>
<content type='text'>
GSBASE is used to find per-CPU data in the kernel. But when GSBASE is
unknown, the per-CPU base can be found from the per_cpu_offset table with a
CPU NR.  The CPU NR is extracted from the limit field of the CPUNODE entry
in GDT, or by the RDPID instruction. This is a prerequisite for using
FSGSBASE in the low level entry code.

Also, add the GAS-compatible RDPID macro as binutils 2.23 do not support
it. Support is added in version 2.27.

[ tglx: Massaged changelog ]

Suggested-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Chang S. Bae &lt;chang.seok.bae@intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/1557309753-24073-12-git-send-email-chang.seok.bae@intel.com
Link: https://lkml.kernel.org/r/20200528201402.1708239-11-sashal@kernel.org


</content>
</entry>
<entry>
<title>x86/entry: Remove the apic/BUILD interrupt leftovers</title>
<updated>2020-06-11T13:15:16Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2020-05-21T20:05:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=75da04f7f3cb416a68475e040175dc013da32de2'/>
<id>urn:sha1:75da04f7f3cb416a68475e040175dc013da32de2</id>
<content type='text'>
Remove all the code which was there to emit the system vector stubs. All
users are gone.

Move the now unused GET_CR2_INTO macro muck to head_64.S where the last
user is. Fixup the eye hurting comment there while at it.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Link: https://lore.kernel.org/r/20200521202119.927433002@linutronix.de


</content>
</entry>
</feed>
