<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/testing/selftests/livepatch/test-syscall.sh, branch v6.18.21</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>selftests: livepatch: save and restore kprobe state</title>
<updated>2024-10-22T15:13:11+00:00</updated>
<author>
<name>Michael Vetter</name>
<email>mvetter@suse.com</email>
</author>
<published>2024-10-17T20:01:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=59766286b6e54f8ad334dcef7d2e743b7550df0e'/>
<id>59766286b6e54f8ad334dcef7d2e743b7550df0e</id>
<content type='text'>
Save the state of /sys/kernel/debug/kprobes/enabled
during setup_config() and restore it during cleanup().

This is in preparation for a future commit that will add a test
that should confirm that we cannot livepatch a kprobed function
if that kprobe has a post handler.

Signed-off-by: Michael Vetter &lt;mvetter@suse.com&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20241017200132.21946-3-mvetter@suse.com
[pmladek@suse.com: Added few more substitutions in test-syscall.sh]
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Save the state of /sys/kernel/debug/kprobes/enabled
during setup_config() and restore it during cleanup().

This is in preparation for a future commit that will add a test
that should confirm that we cannot livepatch a kprobed function
if that kprobe has a post handler.

Signed-off-by: Michael Vetter &lt;mvetter@suse.com&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20241017200132.21946-3-mvetter@suse.com
[pmladek@suse.com: Added few more substitutions in test-syscall.sh]
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR</title>
<updated>2024-10-22T15:12:46+00:00</updated>
<author>
<name>Michael Vetter</name>
<email>mvetter@suse.com</email>
</author>
<published>2024-10-17T20:01:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=637c730998b8f440dc5d0c6bae254fbf19143ea4'/>
<id>637c730998b8f440dc5d0c6bae254fbf19143ea4</id>
<content type='text'>
This naming makes more sense according to the directory structure.
Especially when we later add more paths.

Addtionally replace `/sys/kernel/livepatch` with `$SYSFS_KLP_DIR` in
the livepatch test files.

Signed-off-by: Michael Vetter &lt;mvetter@suse.com&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20241017200132.21946-2-mvetter@suse.com
[pmladek@suse.com: Fix corrupted substitution]
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This naming makes more sense according to the directory structure.
Especially when we later add more paths.

Addtionally replace `/sys/kernel/livepatch` with `$SYSFS_KLP_DIR` in
the livepatch test files.

Signed-off-by: Michael Vetter &lt;mvetter@suse.com&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Tested-by: Petr Mladek &lt;pmladek@suse.com&gt;
Link: https://lore.kernel.org/r/20241017200132.21946-2-mvetter@suse.com
[pmladek@suse.com: Fix corrupted substitution]
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests/livepatch: define max test-syscall processes</title>
<updated>2024-06-12T14:56:30+00:00</updated>
<author>
<name>Ryan Sullivan</name>
<email>rysulliv@redhat.com</email>
</author>
<published>2024-06-06T13:53:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=46edf5d7aed5438078a8b4b1ab4230a41a032dd0'/>
<id>46edf5d7aed5438078a8b4b1ab4230a41a032dd0</id>
<content type='text'>
Define a maximum allowable number of pids that can be livepatched in
test-syscall.sh as with extremely large machines the output from a
large number of processes overflows the dev/kmsg "expect" buffer in
the "check_result" function and causes a false error.

Reported-by: CKI Project &lt;cki-project@redhat.com&gt;
Signed-off-by: Ryan Sullivan &lt;rysulliv@redhat.com&gt;
Acked-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Acked-by: Joel Savitz &lt;jsavitz@redhat.com&gt;
Link: https://lore.kernel.org/r/20240606135348.4708-1-rysulliv@redhat.com
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Define a maximum allowable number of pids that can be livepatched in
test-syscall.sh as with extremely large machines the output from a
large number of processes overflows the dev/kmsg "expect" buffer in
the "check_result" function and causes a false error.

Reported-by: CKI Project &lt;cki-project@redhat.com&gt;
Signed-off-by: Ryan Sullivan &lt;rysulliv@redhat.com&gt;
Acked-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Tested-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Acked-by: Joel Savitz &lt;jsavitz@redhat.com&gt;
Link: https://lore.kernel.org/r/20240606135348.4708-1-rysulliv@redhat.com
Signed-off-by: Petr Mladek &lt;pmladek@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>selftests: livepatch: Test livepatching a heavily called syscall</title>
<updated>2024-01-22T17:29:53+00:00</updated>
<author>
<name>Marcos Paulo de Souza</name>
<email>mpdesouza@suse.com</email>
</author>
<published>2024-01-12T17:43:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=6a71770442b5b7cf8f880ca1c0a72456c918c757'/>
<id>6a71770442b5b7cf8f880ca1c0a72456c918c757</id>
<content type='text'>
The test proves that a syscall can be livepatched. It is interesting
because syscalls are called a tricky way. Also the process gets
livepatched either when sleeping in the userspace or when entering
or leaving the kernel space.

The livepatch is a bit tricky:
  1. The syscall function name is architecture specific. Also
     ARCH_HAS_SYSCALL_WRAPPER must be taken in account.

  2. The syscall must stay working the same way for other processes
     on the system. It is solved by decrementing a counter only
     for PIDs of the test processes. It means that the test processes
     has to call the livepatched syscall at least once.

The test creates one userspace process per online cpu. The processes
are calling getpid in a busy loop. The intention is to create random
locations when the livepatch gets enabled. Nothing is guarantted.
The magic is in the randomness.

Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test proves that a syscall can be livepatched. It is interesting
because syscalls are called a tricky way. Also the process gets
livepatched either when sleeping in the userspace or when entering
or leaving the kernel space.

The livepatch is a bit tricky:
  1. The syscall function name is architecture specific. Also
     ARCH_HAS_SYSCALL_WRAPPER must be taken in account.

  2. The syscall must stay working the same way for other processes
     on the system. It is solved by decrementing a counter only
     for PIDs of the test processes. It means that the test processes
     has to call the livepatched syscall at least once.

The test creates one userspace process per online cpu. The processes
are calling getpid in a busy loop. The intention is to create random
locations when the livepatch gets enabled. Nothing is guarantted.
The magic is in the randomness.

Reviewed-by: Joe Lawrence &lt;joe.lawrence@redhat.com&gt;
Reviewed-by: Petr Mladek &lt;pmladek@suse.com&gt;
Signed-off-by: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
