<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/amd64/include/asmacros.h, branch stable/13</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=stable%2F13</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=stable%2F13'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2023-08-23T17:43:20Z</updated>
<entry>
<title>sys: Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-23T17:43:20Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-22T01:31:02Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=f8167e0404dab9ffeaca95853dd237ab7c587f82'/>
<id>urn:sha1:f8167e0404dab9ffeaca95853dd237ab7c587f82</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

Similar commit in current:
(cherry picked from commit 95ee2897e98f)
</content>
</entry>
<entry>
<title>amd64: prevents speculations over swapgs reload of %gs base.</title>
<updated>2019-08-06T16:53:25Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2019-08-06T16:53:25Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=90e35b0a987f8e61ea5682b951c771b6f9dd5b63'/>
<id>urn:sha1:90e35b0a987f8e61ea5682b951c771b6f9dd5b63</id>
<content type='text'>
Such speculations could use user-controlled %gs base, esp. since
FreeBSD supports WRGSBASE instructions.

Place LFENCEs on entry for each basic block after the test for
previous kernel/user mode on the kernel entry, which prevents the
speculation.  Code accesses %gs-based PCPU before any serialization
instructions are executed, like %cr3 reload for KPTI.

With pti disabled, on haswell i7-4770S machine, "syscall_timings getppid"
shows when no lfence is added to syscall path:
test	loop	time	iterations	periteration
getppid	0	1.040918865	4643611	0.000000224
getppid	1	1.004985962	4481816	0.000000224
getppid	2	1.005196483	4482363	0.000000224
with lfence:
getppid	0	1.043701091	4554779	0.000000229
getppid	1	1.016930328	4438094	0.000000229
getppid	2	1.023223117	4466640	0.000000229
and ministat reports 'No difference proven at 95.0% confidence.'

Security:	CVE-2019-1125
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>amd64: Streamline exceptions and interrupts handlers.</title>
<updated>2019-08-03T17:07:04Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2019-08-03T17:07:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1947b29861d0187b59b0d665e6976b735fa868be'/>
<id>urn:sha1:1947b29861d0187b59b0d665e6976b735fa868be</id>
<content type='text'>
PTI-mode entry points were coded to set up the environment identical
to non-PTI entry and then fall-through to non-PTI handlers, mostly.
This has the drawback of requiring two more SWAPGS, first to access
PCPU, and then to return to the state expected by the non-PTI entry
point.

Eliminate the duplication by doing more in entry stubs both for PTI
and non-PTI, and adjusting the common code to expect that SWAPGS and
some minimal registers saving is done by entries.

Some less often used entries, in particular, #GP, #NP, and #SS, which
can fault on doreti, are left as is because there are basically four
variants of entrance, and they are not performance-critical,
esp. comparing with e.g. #PF or interrupts.

Reviewed by:	markj (previous version)
Tested by:	pho (previous version)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
</content>
</entry>
<entry>
<title>Use SMAP on amd64.</title>
<updated>2018-07-29T20:47:00Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2018-07-29T20:47:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b3a7db3b066386957607fe3e5db2a4c617d4f9bc'/>
<id>urn:sha1:b3a7db3b066386957607fe3e5db2a4c617d4f9bc</id>
<content type='text'>
Ifuncs selectors dispatch copyin(9) family to the suitable variant, to
set rflags.AC around userspace access.  Rflags.AC bit is cleared in
all kernel entry points unconditionally even on machines not
supporting SMAP.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D13838
</content>
</entry>
<entry>
<title>Do not leave stray qword on top of stack for interrupts and exceptions</title>
<updated>2018-06-25T11:29:04Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2018-06-25T11:29:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7f12ebe58305d37fd1f8fb5583bf046c1f0bf51f'/>
<id>urn:sha1:7f12ebe58305d37fd1f8fb5583bf046c1f0bf51f</id>
<content type='text'>
without error code.  Doing so it mis-aligned the stack.

Since the only consumer of the SSE instructions with the alignment
requirements is AES-NI module, and since the FPU context cannot be
accessed in interrupts, the only situation where the alignment matter
are the compat32 syscalls, as reported in the PR.

PR:	229222
Reported and tested by:	 dewayne@heuristicsystems.com.au
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>Enable IBRS when entering an interrupt handler from usermode.</title>
<updated>2018-05-22T13:25:15Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2018-05-22T13:25:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=14f7050dbab9c21ec7f18b3a015641e722ea6b9d'/>
<id>urn:sha1:14f7050dbab9c21ec7f18b3a015641e722ea6b9d</id>
<content type='text'>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>Make the common interrupt entry point labels local labels.</title>
<updated>2018-05-14T17:27:53Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2018-05-14T17:27:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0b3e6e4c50b2dc1301cb18cec14e0a0a88f13c54'/>
<id>urn:sha1:0b3e6e4c50b2dc1301cb18cec14e0a0a88f13c54</id>
<content type='text'>
Kernel debuggers depend on symbol names to find stack frames with a
trapframe rather than a normal stack frame.  The labels used for the
shared interrupt entry point for the PTI and non-PTI cases did not
match the existing patterns confusing debuggers.  Add the '.L' prefix
to mark these symbols as local so they are not visible in the symbol
table.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Chelsio Communications
</content>
</entry>
<entry>
<title>Expand the checks for UCR3 == PMAP_NO_CR3 to enable processes to be</title>
<updated>2018-04-27T12:44:20Z</updated>
<author>
<name>Tycho Nightingale</name>
<email>tychon@FreeBSD.org</email>
</author>
<published>2018-04-27T12:44:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=27275f8a5240f6c644cc3341b4efda3695d97620'/>
<id>urn:sha1:27275f8a5240f6c644cc3341b4efda3695d97620</id>
<content type='text'>
excluded from PTI.

Reviewed by:	kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D15100
</content>
</entry>
<entry>
<title>Use local symbol for offset.</title>
<updated>2018-02-16T13:32:46Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2018-02-16T13:32:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=13cad9af827b37c22d6bc0da4787aba0a005ca8d'/>
<id>urn:sha1:13cad9af827b37c22d6bc0da4787aba0a005ca8d</id>
<content type='text'>
Small global symbols confuse ddb which matches them against small
unrelated displacements and makes the disassembly ugly.

Reported by:	bde
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>PTI: Trap if we returned to userspace with kernel (full) page table</title>
<updated>2018-01-19T22:10:29Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2018-01-19T22:10:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b4dfc9d7ad9c54e990088f9abdb1a4f2f820feb1'/>
<id>urn:sha1:b4dfc9d7ad9c54e990088f9abdb1a4f2f820feb1</id>
<content type='text'>
still active.

Map userspace portion of VA in the PTI kernel-mode page table as
non-executable. This way, if we ever miss reloading ucr3 into %cr3 on
the return to usermode, the process traps instead of executing in
potentially vulnerable setup.  Catch the condition of such trap and
verify user-mode %cr3, which is saved by page fault handler.

I peek this trick in some article about Linux implementation.

Reviewed by:	alc, markj (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
DIfferential revision:	https://reviews.freebsd.org/D13956
</content>
</entry>
</feed>
