2020-01-16 15:35:31

by Petr Mladek

[permalink] [raw]
Subject: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling

Dan Carpenter reported suspicious allocations of shadow variables
in the sample module, see
https://lkml.kernel.org/r/[email protected]

The code did not cause a real problem. But it was indeed misleading
and semantically wrong. I got confused several times when cleaning it.
So I decided to split the change into few steps. I hope that
it will help reviewers and future readers.

The changes of the sample module are basically the same as in the RFC.
In addition, there is a clean up of the module used by the selftest.


Petr Mladek (4):
livepatch/sample: Use the right type for the leaking data pointer
livepatch/selftest: Clean up shadow variable names and type
livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
livepatch: Handle allocation failure in the sample of shadow variable
API

lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++-------------
samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++----
samples/livepatch/livepatch-shadow-fix2.c | 4 +-
samples/livepatch/livepatch-shadow-mod.c | 4 +-
4 files changed, 99 insertions(+), 67 deletions(-)

--
2.16.4


2020-01-16 19:31:53

by Joe Lawrence

[permalink] [raw]
Subject: Re: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling

On 1/16/20 10:31 AM, Petr Mladek wrote:
> Dan Carpenter reported suspicious allocations of shadow variables
> in the sample module, see
> https://lkml.kernel.org/r/[email protected]
>
> The code did not cause a real problem. But it was indeed misleading
> and semantically wrong. I got confused several times when cleaning it.
> So I decided to split the change into few steps. I hope that
> it will help reviewers and future readers.
>
> The changes of the sample module are basically the same as in the RFC.
> In addition, there is a clean up of the module used by the selftest.
>
>
> Petr Mladek (4):
> livepatch/sample: Use the right type for the leaking data pointer
> livepatch/selftest: Clean up shadow variable names and type
> livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
> livepatch: Handle allocation failure in the sample of shadow variable
> API
>
> lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++-------------
> samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++----
> samples/livepatch/livepatch-shadow-fix2.c | 4 +-
> samples/livepatch/livepatch-shadow-mod.c | 4 +-
> 4 files changed, 99 insertions(+), 67 deletions(-)
>

Hi Petr,

These are good cleanups, thanks for the fixes and tidying up all the
pointer/value indirections.

Reviewed-by: Joe Lawrence <[email protected]>

-- Joe

2020-01-17 08:46:16

by Miroslav Benes

[permalink] [raw]
Subject: Re: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling

On Thu, 16 Jan 2020, Petr Mladek wrote:

> Dan Carpenter reported suspicious allocations of shadow variables
> in the sample module, see
> https://lkml.kernel.org/r/[email protected]
>
> The code did not cause a real problem. But it was indeed misleading
> and semantically wrong. I got confused several times when cleaning it.
> So I decided to split the change into few steps. I hope that
> it will help reviewers and future readers.
>
> The changes of the sample module are basically the same as in the RFC.
> In addition, there is a clean up of the module used by the selftest.
>
>
> Petr Mladek (4):
> livepatch/sample: Use the right type for the leaking data pointer
> livepatch/selftest: Clean up shadow variable names and type
> livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
> livepatch: Handle allocation failure in the sample of shadow variable
> API
>
> lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++-------------
> samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++----
> samples/livepatch/livepatch-shadow-fix2.c | 4 +-
> samples/livepatch/livepatch-shadow-mod.c | 4 +-
> 4 files changed, 99 insertions(+), 67 deletions(-)

Acked-by: Miroslav Benes <[email protected]>

M

2020-01-17 09:42:52

by Kamalesh Babulal

[permalink] [raw]
Subject: Re: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling

On 1/16/20 9:01 PM, Petr Mladek wrote:
> Dan Carpenter reported suspicious allocations of shadow variables
> in the sample module, see
> https://lkml.kernel.org/r/[email protected]
>
> The code did not cause a real problem. But it was indeed misleading
> and semantically wrong. I got confused several times when cleaning it.
> So I decided to split the change into few steps. I hope that
> it will help reviewers and future readers.
>
> The changes of the sample module are basically the same as in the RFC.
> In addition, there is a clean up of the module used by the selftest.
>
>
> Petr Mladek (4):
> livepatch/sample: Use the right type for the leaking data pointer
> livepatch/selftest: Clean up shadow variable names and type
> livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
> livepatch: Handle allocation failure in the sample of shadow variable
> API
>
> lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++-------------
> samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++----
> samples/livepatch/livepatch-shadow-fix2.c | 4 +-
> samples/livepatch/livepatch-shadow-mod.c | 4 +-
> 4 files changed, 99 insertions(+), 67 deletions(-)
>

Reviewed-by: Kamalesh Babulal <[email protected]>

--
Kamalesh

2020-01-17 10:14:15

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling

On Thu, 16 Jan 2020, Petr Mladek wrote:

> Dan Carpenter reported suspicious allocations of shadow variables
> in the sample module, see
> https://lkml.kernel.org/r/[email protected]
>
> The code did not cause a real problem. But it was indeed misleading
> and semantically wrong. I got confused several times when cleaning it.
> So I decided to split the change into few steps. I hope that
> it will help reviewers and future readers.
>
> The changes of the sample module are basically the same as in the RFC.
> In addition, there is a clean up of the module used by the selftest.
>
>
> Petr Mladek (4):
> livepatch/sample: Use the right type for the leaking data pointer
> livepatch/selftest: Clean up shadow variable names and type
> livepatch/samples/selftest: Use klp_shadow_alloc() API correctly
> livepatch: Handle allocation failure in the sample of shadow variable
> API
>
> lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++-------------
> samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++----
> samples/livepatch/livepatch-shadow-fix2.c | 4 +-
> samples/livepatch/livepatch-shadow-mod.c | 4 +-
> 4 files changed, 99 insertions(+), 67 deletions(-)

I've pushed this to for-5.6/selftests. Thanks,

--
Jiri Kosina
SUSE Labs