# Re: \[PATCH v8 9/9\] selftests/livepatch: Add function test for provides/obsoletes

- From: Yafang Shao \<hidden\>
- Date: 2026-09-09 07:02:11 
- List: live-patching
- Page: https://ratatoskr.run/live-patching/2026/09/17535782
- Thread: https://ratatoskr.run/sashiko-reviews/2026/09/17535782/t.md

```text
On Wed, Sep 9, 2026 at 10:56 AM [ref] wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The test fails to verify its own claim that a function is functionally unpatched after an atomic replacement.
> --
>
> commit abfccb0026870ac46d37d3802586498b0874cba2
> Author: Yafang Shao [ref]
>
> selftests/livepatch: Add function test for provides/obsoletes
>
> This commit adds selftest scenarios for livepatches using the provides
> and obsoletes features to ensure patches with different provides IDs do
> not modify the same function. It verifies replacement and coexistence
> behaviors for different function combinations. Tests are skipped on legacy
> kernels.
>
> > diff --git a/tools/testing/selftests/livepatch/test-provides-obsoletes.sh b/tools/testing/selftests/livepatch/test-provides-obsoletes.sh
> > --- a/tools/testing/selftests/livepatch/test-provides-obsoletes.sh
> > +++ b/tools/testing/selftests/livepatch/test-provides-obsoletes.sh
> [ ... ]
> > +# - after the replacement /proc/meminfo is no longer patched, while
> > +#   /proc/cmdline is patched
> > +# - unload the replacing livepatch, then the replaced one
> > +
> > +start_test "different functions, atomic replace works (nops)"
> > +
> > +load_lp $MOD_MEMINFO provides=1
> > +
> > +grep 'live patched' /proc/meminfo > /dev/kmsg
> > +
> > +load_lp $MOD_CMDLINE provides=1
> > +
> > +grep 'live patched' /proc/cmdline > /dev/kmsg
> > +
> > +disable_lp $MOD_CMDLINE
>
> [Severity: Medium]
> The test documentation explicitly claims that after the replacement,
> /proc/meminfo is no longer patched while /proc/cmdline is patched.
> However, only /proc/cmdline is checked during this sequence.
>
> Should there be an additional step to grep /proc/meminfo and verify it
> is functionally unpatched before disabling the livepatch? If the atomic
> replace logic had a flaw that accidentally left /proc/meminfo patched,
> it appears this verification would be missed and the test would still pass.
>

Nice catch.

I will update it with the following change

--- a/tools/testing/selftests/livepatch/test-provides-obsoletes.sh
+++ b/tools/testing/selftests/livepatch/test-provides-obsoletes.sh
@@ -545,6 +545,7 @@ grep 'live patched' /proc/meminfo > /dev/kmsg

 load_lp $MOD_CMDLINE provides=1

+grep 'live patched' /proc/meminfo > /dev/kmsg
 grep 'live patched' /proc/cmdline > /dev/kmsg

 disable_lp $MOD_CMDLINE

-- 
Regards
Yafang
```
