The verification of jammy (5.4.0-171.189) was conducted using a custom approach due to the absence of an InfiniBand environment for testing the patch.
The patch specifically altered the count of mm->mm_users within a function.
To ensure that this modification did not impact the original logic, a kernel module was developed.
The module replicated the content of ib_umem_odp_alloc_child but substituted InfiniBand-related functions with other unaffected custom functions for testing purposes.
===
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched/mm.h>
#include <linux/slab.h>
int test(void) {
int ret;
char *odp_data = kzalloc(8, GFP_KERNEL);
if (!odp_data)
return -ENOMEM;
if (!mmget_not_zero(current->mm)) {
ret = -EFAULT;
goto out_free;
}
ret = inner_test();
if (ret)
goto out_mmput;
mmput(current->mm);
return 0;
Executing this kernel module allows us to verify that the count of mm_users aligns with expectations, validated through the use of the atomic_read function.
The verification of jammy (5.4.0-171.189) was conducted using a custom approach due to the absence of an InfiniBand environment for testing the patch. odp_alloc_ child but substituted InfiniBand-related functions with other unaffected custom functions for testing purposes.
The patch specifically altered the count of mm->mm_users within a function.
To ensure that this modification did not impact the original logic, a kernel module was developed.
The module replicated the content of ib_umem_
===
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched/mm.h>
#include <linux/slab.h>
MODULE_ DESCRIPTION( "Test") ; LICENSE( "GPL");
MODULE_
int inner_test(void) {
return 0;
}
int test(void) { not_zero( current- >mm)) {
int ret;
char *odp_data = kzalloc(8, GFP_KERNEL);
if (!odp_data)
return -ENOMEM;
if (!mmget_
ret = -EFAULT;
goto out_free;
}
ret = inner_test(); current- >mm);
if (ret)
goto out_mmput;
mmput(
return 0;
out_mmput: current- >mm);
mmput(
out_free:
kfree(odp_data);
return ret;
}
static int test_init(void) { return test(); }
static void test_exit(void) {}
module_ init(test_ init); exit(test_ exit);
module_
===
Executing this kernel module allows us to verify that the count of mm_users aligns with expectations, validated through the use of the atomic_read function.