Re: [PATCH 1/1] selftests: livepatch: add test cases of stack_order sysfs interface

From: zhang warden
Date: Thu Oct 10 2024 - 11:12:21 EST



Hi, Marcos!
> On Oct 10, 2024, at 20:31, Marcos Paulo de Souza <mpdesouza@xxxxxxxx> wrote:
>
> On Tue, 2024-10-08 at 15:52 +0800, Wardenjohn wrote:
>> Add selftest test cases to sysfs attribute 'stack_order'.
>>
>> Signed-off-by: Wardenjohn <zhangwarden@xxxxxxxxx>
>> ---
>> .../testing/selftests/livepatch/test-sysfs.sh | 71
>> +++++++++++++++++++
>> .../selftests/livepatch/test_modules/Makefile | 5 +-
>> .../test_klp_livepatch_noreplace.c | 53 ++++++++++++++
>> .../test_klp_livepatch_noreplace2.c | 53 ++++++++++++++
>> .../test_klp_livepatch_noreplace3.c | 53 ++++++++++++++
>> 5 files changed, 234 insertions(+), 1 deletion(-)
>> create mode 100644
>> tools/testing/selftests/livepatch/test_modules/test_klp_livepatch_nor
>> eplace.c
>> create mode 100644
>> tools/testing/selftests/livepatch/test_modules/test_klp_livepatch_nor
>> eplace2.c
>> create mode 100644
>> tools/testing/selftests/livepatch/test_modules/test_klp_livepatch_nor
>> eplace3.c
>
> IIUC, you only need to test the stack order by loading LP modules. In
> this case you could use our currently existing LP testing module for
> that, right? That's what we currently do when testing different sysfs
> attributes.
>

Yes, in fact, those three module I submitted is reuse the existing LP
testing module of 'test_klp_livepatch'. Because I found some module
in test module set "klp_replace" attribute true. If a module set this
attribute true, it will disable the previous module.

What's more, testing this 'stack_order' attribute need more than one
module, hoping to change the same function. And breaking the '.replace'
value of existing module may not be a good way. So I decided to copy
more test module with '.replace=false' and this module is changing
the same function.

Regards.
Wardenjohn.