Re: [PATCH v3 5/5] livepatch: Selftests of the API for tracking system state changes

From: Petr Mladek
Date: Wed Oct 09 2019 - 10:19:07 EST


On Fri 2019-10-04 10:47:42, Joe Lawrence wrote:
> On Thu, Oct 03, 2019 at 11:01:37AM +0200, Petr Mladek wrote:
> > Four selftests for the new API.
> >
> > --- /dev/null
> > +++ b/tools/testing/selftests/livepatch/test-state.sh
> > @@ -0,0 +1,180 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (C) 2018 Joe Lawrence <joe.lawrence@xxxxxxxxxx>
> > +
>
> nit: this should probably read as:
> # Copyright (C) 2019 Petr Mladek <pmladek@xxxxxxxx>
>
> > +
> > +load_lp $MOD_LIVEPATCH
> > +disable_lp $MOD_LIVEPATCH
> > +unload_lp $MOD_LIVEPATCH
> > +
> > +check_result "% modprobe test_klp_state
> > +livepatch: enabling patch 'test_klp_state'
> > +livepatch: 'test_klp_state': initializing patching transition
> > +test_klp_state: pre_patch_callback: vmlinux
> > +test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel
> > +livepatch: 'test_klp_state': starting patching transition
> > +livepatch: 'test_klp_state': completing patching transition
> > +test_klp_state: post_patch_callback: vmlinux
> > +test_klp_state: fix_console_loglevel: fixing console_loglevel
> > +livepatch: 'test_klp_state': patching complete
> > +% echo 0 > /sys/kernel/livepatch/test_klp_state/enabled
> > +livepatch: 'test_klp_state': initializing unpatching transition
> > +test_klp_state: pre_unpatch_callback: vmlinux
> > +test_klp_state: restore_console_loglevel: restoring console_loglevel
> > +livepatch: 'test_klp_state': starting unpatching transition
> > +livepatch: 'test_klp_state': completing unpatching transition
> > +test_klp_state: post_unpatch_callback: vmlinux
> > +test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel
> > +livepatch: 'test_klp_state': unpatching complete
> > +% rmmod test_klp_state"
> > +
>
> nit: a matter of style, and I don't mind either, but the other test
> scripts used $MOD_LIVEPATCH{2,3} variable replacement in the
> check_result string. I think I originally did that when we were
> reviewing the first self-test patchset and the filenames may or may not
> have changed. Those names are stable now, so I don't have a strong
> opinion either way.

Please, find below and updated version of the patch that fixes
the two above problems and also the kbuild robot failure.

The build failure was fixed by #include <linux/slab.h>

Here we go: