<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/tools/testing/selftests/rseq/rseq-x86.h, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-02-11T22:30:08Z</updated>
<entry>
<title>selftests/rseq: Change type of rseq_offset to ptrdiff_t</title>
<updated>2022-02-11T22:30:08Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-02-03T15:05:32Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=889c5d60fbcf332c8b6ab7054d45f2768914a375'/>
<id>urn:sha1:889c5d60fbcf332c8b6ab7054d45f2768914a375</id>
<content type='text'>
Just before the 2.35 release of glibc, the __rseq_offset userspace ABI
was changed from int to ptrdiff_t.

Adapt to this change in the kernel selftests.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://sourceware.org/pipermail/libc-alpha/2022-February/136024.html
</content>
</entry>
<entry>
<title>selftests/rseq: x86-32: use %gs segment selector for accessing rseq thread area</title>
<updated>2022-02-02T12:11:37Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:53Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=127b6429d235ab7c358223bbfd8a8b8d8cc799b6'/>
<id>urn:sha1:127b6429d235ab7c358223bbfd8a8b8d8cc799b6</id>
<content type='text'>
Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %gs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-16-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: x86-64: use %fs segment selector for accessing rseq thread area</title>
<updated>2022-02-02T12:11:37Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4e15bb766b6c6e963a4d33629034d0ec3b7637df'/>
<id>urn:sha1:4e15bb766b6c6e963a4d33629034d0ec3b7637df</id>
<content type='text'>
Rather than use rseq_get_abi() and pass its result through a register to
the inline assembler, directly access the per-thread rseq area through a
memory reference combining the %fs segment selector, the constant offset
of the field in struct rseq, and the rseq_offset value (in a register).

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-15-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix: work-around asm goto compiler bugs</title>
<updated>2022-02-02T12:11:37Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:51Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b53823fb2ef854222853be164f3b1e815f315144'/>
<id>urn:sha1:b53823fb2ef854222853be164f3b1e815f315144</id>
<content type='text'>
gcc and clang each have their own compiler bugs with respect to asm
goto. Implement a work-around for compiler versions known to have those
bugs.

gcc prior to 4.8.2 miscompiles asm goto.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670

gcc prior to 8.1.0 miscompiles asm goto at O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908

clang prior to version 13.0.1 miscompiles asm goto at O2.
https://github.com/llvm/llvm-project/issues/52735

Work around these issues by adding a volatile inline asm with
memory clobber in the fallthrough after the asm goto and at each
label target.  Emit this for all compilers in case other similar
issues are found in the future.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-14-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix warnings about #if checks of undefined tokens</title>
<updated>2022-02-02T12:11:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:49Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d7ed99ade3e62b755584eea07b4e499e79240527'/>
<id>urn:sha1:d7ed99ade3e62b755584eea07b4e499e79240527</id>
<content type='text'>
Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-12-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix ppc32 offsets by using long rather than off_t</title>
<updated>2022-02-02T12:11:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:48Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=26dc8a6d8e11552f3b797b5aafe01071ca32d692'/>
<id>urn:sha1:26dc8a6d8e11552f3b797b5aafe01071ca32d692</id>
<content type='text'>
The semantic of off_t is for file offsets. We mean to use it as an
offset from a pointer. We really expect it to fit in a single register,
and not use a 64-bit type on 32-bit architectures.

Fix runtime issues on ppc32 where the offset is always 0 due to
inconsistency between the argument type (off_t -&gt; 64-bit) and type
expected by the inline assembler (32-bit).

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-11-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Introduce rseq_get_abi() helper</title>
<updated>2022-02-02T12:11:35Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e546cd48ccc456074ddb8920732aef4af65d7ca7'/>
<id>urn:sha1:e546cd48ccc456074ddb8920732aef4af65d7ca7</id>
<content type='text'>
This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

glibc-2.35 exposes the rseq per-thread data in the TCB, accessible
at an offset from the thread pointer, rather than through an actual
Thread-Local Storage (TLS) variable, as the kernel selftests initially
expected.

Introduce a rseq_get_abi() helper, initially using the __rseq_abi
TLS variable, in preparation for changing this userspace ABI for one
which is compatible with glibc-2.35.

Note that the __rseq_abi TLS and glibc-2.35's ABI for per-thread data
cannot actively coexist in a process, because the kernel supports only
a single rseq registration per thread.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-6-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>rseq/selftests,x86_64: Add rseq_offset_deref_addv()</title>
<updated>2020-09-25T12:23:27Z</updated>
<author>
<name>Peter Oskolkov</name>
<email>posk@google.com</email>
</author>
<published>2020-09-23T23:36:17Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ea366dd79c05fcd4cf5e225d2de8a3a7c293160c'/>
<id>urn:sha1:ea366dd79c05fcd4cf5e225d2de8a3a7c293160c</id>
<content type='text'>
This patch adds rseq_offset_deref_addv() function to
tools/testing/selftests/rseq/rseq-x86.h, to be used in a selftest in
the next patch in the patchset.

Once an architecture adds support for this function they should define
"RSEQ_ARCH_HAS_OFFSET_DEREF_ADDV".

Signed-off-by: Peter Oskolkov &lt;posk@google.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://lkml.kernel.org/r/20200923233618.2572849-2-posk@google.com
</content>
</entry>
<entry>
<title>rseq/selftests: x86: use ud1 instruction as RSEQ_SIG opcode</title>
<updated>2019-05-07T21:32:05Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2019-04-29T15:27:57Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=24fa5d1efe98bc09a96ba41fdba96ef715aede77'/>
<id>urn:sha1:24fa5d1efe98bc09a96ba41fdba96ef715aede77</id>
<content type='text'>
Use ud1 as the guard instruction for the restartable sequence abort
handler. Its benefit compared to nopl is to trap execution if the
program ends up trying to execute it by mistake, which makes debugging
easier.

The 4-byte signature per se is unchanged (it is the instruction
operand). Only the opcode is changed from nopl to ud1.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
CC: Peter Zijlstra &lt;peterz@infradead.org&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
CC: Joel Fernandes &lt;joelaf@google.com&gt;
CC: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
CC: Dave Watson &lt;davejwatson@fb.com&gt;
CC: Will Deacon &lt;will.deacon@arm.com&gt;
CC: Shuah Khan &lt;shuah@kernel.org&gt;
CC: Andi Kleen &lt;andi@firstfloor.org&gt;
CC: linux-kselftest@vger.kernel.org
CC: "H . Peter Anvin" &lt;hpa@zytor.com&gt;
CC: Chris Lameter &lt;cl@linux.com&gt;
CC: Russell King &lt;linux@arm.linux.org.uk&gt;
CC: Michael Kerrisk &lt;mtk.manpages@gmail.com&gt;
CC: "Paul E . McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
CC: Paul Turner &lt;pjt@google.com&gt;
CC: Boqun Feng &lt;boqun.feng@gmail.com&gt;
CC: Josh Triplett &lt;josh@joshtriplett.org&gt;
CC: Steven Rostedt &lt;rostedt@goodmis.org&gt;
CC: Ben Maurer &lt;bmaurer@fb.com&gt;
CC: linux-api@vger.kernel.org
CC: Andy Lutomirski &lt;luto@amacapital.net&gt;
CC: Andrew Morton &lt;akpm@linux-foundation.org&gt;
CC: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>rseq/selftests: Introduce __rseq_cs_ptr_array, rename __rseq_table to __rseq_cs</title>
<updated>2019-05-07T21:31:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2019-04-29T15:27:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a3e3131f94aa1daeb978ed66d0b4e61156ef2c2a'/>
<id>urn:sha1:a3e3131f94aa1daeb978ed66d0b4e61156ef2c2a</id>
<content type='text'>
The entries within __rseq_table are aligned on 32 bytes due to
linux/rseq.h struct rseq_cs uapi requirements, but the start of the
__rseq_table section is not guaranteed to be 32-byte aligned. It can
cause padding to be added at the start of the section, which makes it
hard to use as an array of items by debuggers.

Considering that __rseq_table does not really consist of a table due to
the presence of padding, rename this section to __rseq_cs.

Create a new __rseq_cs_ptr_array section which contains 64-bit packed
pointers to entries within the __rseq_cs section.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
CC: Joel Fernandes &lt;joelaf@google.com&gt;
CC: Peter Zijlstra &lt;peterz@infradead.org&gt;
CC: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
CC: Dave Watson &lt;davejwatson@fb.com&gt;
CC: Will Deacon &lt;will.deacon@arm.com&gt;
CC: Shuah Khan &lt;shuah@kernel.org&gt;
CC: Andi Kleen &lt;andi@firstfloor.org&gt;
CC: linux-kselftest@vger.kernel.org
CC: "H . Peter Anvin" &lt;hpa@zytor.com&gt;
CC: Chris Lameter &lt;cl@linux.com&gt;
CC: Russell King &lt;linux@arm.linux.org.uk&gt;
CC: Michael Kerrisk &lt;mtk.manpages@gmail.com&gt;
CC: "Paul E . McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
CC: Paul Turner &lt;pjt@google.com&gt;
CC: Boqun Feng &lt;boqun.feng@gmail.com&gt;
CC: Josh Triplett &lt;josh@joshtriplett.org&gt;
CC: Steven Rostedt &lt;rostedt@goodmis.org&gt;
CC: Ben Maurer &lt;bmaurer@fb.com&gt;
CC: linux-api@vger.kernel.org
CC: Andy Lutomirski &lt;luto@amacapital.net&gt;
CC: Andrew Morton &lt;akpm@linux-foundation.org&gt;
CC: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
