On Thu, 28 May 2020, Yannick Cote wrote:
This change makes the test feel more familiar with narrowing to a typical usage by operating on a number of identical structure instances and populating the same two new shadow variables symmetrically while keeping the same testing and verification criteria for the extra variables.
It changes the order of shadow vars allocation and freeing (now we allocate everything first, while previously the order was more complicated), but it does not matter, I think.
One nit below and I have to trust you with the output.
Signed-off-by: Yannick Cote ycote@redhat.com
lib/livepatch/test_klp_shadow_vars.c | 182 ++++++++---------- .../selftests/livepatch/test-shadow-vars.sh | 85 +++++--- 2 files changed, 135 insertions(+), 132 deletions(-)
diff --git a/lib/livepatch/test_klp_shadow_vars.c b/lib/livepatch/test_klp_shadow_vars.c index ec2635cff974..195309e1edf3 100644 --- a/lib/livepatch/test_klp_shadow_vars.c +++ b/lib/livepatch/test_klp_shadow_vars.c @@ -128,6 +128,11 @@ static int shadow_ctor(void *obj, void *shadow_data, void *ctor_data) return 0; } +/*
- With more than one item to free in the list, order is not determined and
- shadow_dtor will not be passed to shadow_free_all() which would make the
- test fail. (see pass 6)
- */
static void shadow_dtor(void *obj, void *shadow_data) { int **sv = shadow_data; @@ -136,6 +141,9 @@ static void shadow_dtor(void *obj, void *shadow_data) __func__, ptr_id(obj), ptr_id(sv)); } +/* number of objects we simulate that need kpatch-patch shadow vars */
s/kpatch-patch// ?
Miroslav