Re: [PATCH] livepatch: add sysfs interface /sys/kernel/livepatch/state

From: Li Bin
Date: Wed Jun 17 2015 - 05:25:44 EST


On 2015/6/17 16:13, Miroslav Benes wrote:
> On Wed, 17 Jun 2015, Li Bin wrote:
>
>> The added sysfs interface /sys/kernel/livepatch/state is read-only,
>> it shows the patches that have been applied, incluing the stack index
>> and the state of each patch.
>>
>> $ cat /sys/kernel/livepatch/state
>> Index Patch State
>> -----------------------------------------------
>> 1 klp_test1 enabled
>> 2 klp_test2 enabled
>> 3 klp_test3 enabled
>> -----------------------------------------------
>>
>> $ echo 0 > /sys/kernel/livepatch/klp_test3/enabled
>> $ cat /sys/kernel/livepatch/state
>> Index Patch State
>> -----------------------------------------------
>> 1 klp_test1 enabled
>> 2 klp_test2 enabled
>> 3 klp_test3 disabled
>> -----------------------------------------------
>>
>> Signed-off-by: Li Bin <huawei.libin@xxxxxxxxxx>
>> ---
>
> Hi,
>
> I think we should comply with sysfs policy and keep 'one value per
> attribute' as mentioned in the Documentation/filesystems/sysfs.txt:
>
> "
> Attributes should be ASCII text files, preferably with only one value
> per file. It is noted that it may not be efficient to contain only one
> value per file, so it is socially acceptable to express an array of
> values of the same type.
>
> Mixing types, expressing multiple lines of data, and doing fancy
> formatting of data is heavily frowned upon. Doing these things may get
> you publicly humiliated and your code rewritten without notice.
> "

Hi Miroslav Benes,
Thanks for your comments.

> The list of applied patches can be obtained just by 'ls
> /sys/kernel/livepatch' and their state is in enabled attribute in each
> respective patch (no, you cannot obtain the order in the stack).

But why we cannot obtain it? I think We indeed need the stack order when we
will disable one patch, at least, we can find out whether it is on the top of
the stack if failed to disable one patch.

Thanks,
Li Bin
>
> Thanks,
>
> Miroslav Benes
> SUSE Labs
>
> .
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/