Re: [RFC 3/5] livepatch: Allow to distinguish different version of system state changes

From: Miroslav Benes
Date: Fri Jun 21 2019 - 07:28:02 EST


> +/* Check if the patch is able to deal with the given system state. */
> +static bool klp_is_state_compatible(struct klp_patch *patch,
> + struct klp_state *state)
> +{
> + struct klp_state *new_state;
> +
> + new_state = klp_get_state(patch, state->id);
> +
> + if (new_state)
> + return new_state->version < state->version ? false : true;

return new_state->version >= state->version;

?

> + /* Cumulative livepatch must handle all already modified states.
*/
> + return patch->replace ? false : true;

return !patch->replace;

?

> + * Check if the new livepatch will not break the existing system states.
> + * Cumulative patches must handle all already modified states.
> + * Non-cumulative patches can touch already modified states.
> + */
> +bool klp_is_patch_compatible(struct klp_patch *patch)

make C=1 kernel/livepatch/state.o

kernel/livepatch/state.c:107:6: warning: symbol 'klp_is_patch_compatible' was not declared. Should it be static?

#include "state.h" in state.c would solve it.

Miroslav