On 2023/10/17 4:35, Marco Pagani wrote:
> Commit 2810c1e99867 ("kunit: Fix wild-memory-access bug in
> kunit_free_suite_set()") is causing all test suites to run (when
> built as modules) while still in MODULE_STATE_COMING. In that state,
> test modules are not fully initialized and lack sysfs k
Fixes: 2810c1e99867 ("kunit: Fix wild-memory-access bug in
kunit_free_suite_set()")
Reported-by: Marco Pagani
Signed-off-by: Jinjie Ruan
---
lib/kunit/test.c | 25 -
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
in
code behind it is dead code. so return err if
it fails.
Signed-off-by: Jinjie Ruan
---
lib/kunit/test.c | 12 +++-
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 29a5f5ea8112..145f70219f46 100644
--- a/lib/kunit/test.c
+++ b/lib/
The module has a normal sequence from MODULE_STATE_COMING to
MODULE_STATE_LIVE and to MODULE_STATE_GOING, and eventually
MODULE_STATE_UNFORMED. The original order of cases is confusing
and misleading.
Signed-off-by: Jinjie Ruan
---
lib/kunit/test.c | 6 +++---
1 file changed, 3 insertions(+), 3
The original order of cases in kunit_module_notify() is confusing and
misleading.
And the best practice is return the err code from
MODULE_STATE_COMING func.
And the test suits should be executed when notify MODULE_STATE_LIVE.
Jinjie Ruan (3):
kunit: Make the cases sequence more reasonable
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the copy pointer has been moved. So it should free
the original copy's backup copy_start.
Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-
87e304>] el0_svc_common.constprop.1+0x68/0xe0
[<9d8ad866>] do_el0_svc+0x1c/0x28
[<5b83c607>] el0_svc+0x3c/0xc4
Fixes: a127b154a8f2 ("kunit: tool: allow filtering test cases via glob")
Signed-off-by: Jinjie Ruan
Reviewed-by: Rae Moar
Reviewed-b
t_test_suites")
Fixes: 76066f93f1df ("kunit: add tests for filtering attributes")
Signed-off-by: Jinjie Ruan
Suggested-by: Rae Moar
Reviewed-by: David Gow
Suggested-by: David Gow
Reported-by: kernel test robot
Closes:
https://lore.kernel.org/oe-kbuild-all/202309142251.uj8saazv-..
to use kunit_free_suite_set() for 4th patch.
- Update the commit message for the 4th patch.
Changes in v2:
- Add Reviewed-by.
- Add the memory leak backtrace for the 4th patch.
- Remove the unused func kernel test robot noticed for the 4th patch.
- Update the commit message for the 4th patch.
Jinjie R
the filtered_suite
and filtered_suite->test_cases so far. And change kmalloc_array of copy
to kcalloc to Clear the copy to make the kfree safe.
Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes")
Signed-off-by: Jinjie Ruan
Reviewed-by: Rae Moar
Reviewed-by: David Gow
---
v4:
- Cor
860
[] kunit_filter_suites+0x82f/0xcc0
[] filter_attr_skip_test+0x133/0x6e0
[] kunit_generic_run_threadfn_adapter+0x4a/0x90
[] kthread+0x2b6/0x380
[] ret_from_fork+0x2d/0x70
[] ret_from_fork_asm+0x11/0x20
Fixes: e5857d396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kun
the filtered_suite
and filtered_suite->test_cases so far. And change kmalloc_array of copy
to kcalloc to Clear the copy to make the kfree safe.
Fixes: 5d31f71efcb6 ("kunit: add kunit.filter_glob cmdline option to filter
suites")
Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes&qu
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the copy pointer has been moved. So it should free
the original copy's backup copy_start.
Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-
y leak backtrace for the 4th patch.
- Remove the unused func kernel test robot noticed for the 4th patch.
- Update the commit message for the 4th patch.
Jinjie Ruan (4):
kunit: Fix missed memory release in kunit_free_suite_set()
kunit: Fix the wrong kfree of copy for kunit_filter_suites()
87e304>] el0_svc_common.constprop.1+0x68/0xe0
[<9d8ad866>] do_el0_svc+0x1c/0x28
[<5b83c607>] el0_svc+0x3c/0xc4
Fixes: e5857d396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kunit_test_suites")
Fixes: b67abaad4d25 ("kunit: Allo
the filtered_suite
and filtered_suite->test_cases so far. And change kmalloc_array of copy
to kcalloc to Clear the copy to make the kfree safe.
Fixes: 5d31f71efcb6 ("kunit: add kunit.filter_glob cmdline option to filter
suites")
Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes&qu
fork_asm+0x11/0x20
Fixes: e5857d396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kunit_test_suites")
Signed-off-by: Jinjie Ruan
Reported-by: kernel test robot
Closes:
https://lore.kernel.org/oe-kbuild-all/202309142251.uj8saazv-...@intel.com/
---
v2:
- Add the memory leak b
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the copy pointer has been moved. So it should free
the original copy's backup copy_start.
Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-
87e304>] el0_svc_common.constprop.1+0x68/0xe0
[<9d8ad866>] do_el0_svc+0x1c/0x28
[<5b83c607>] el0_svc+0x3c/0xc4
Fixes: e5857d396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kunit_test_suites")
Fixes: b67abaad4d25 ("kunit: Allo
or the 4th patch.
Jinjie Ruan (4):
kunit: Fix missed memory release in kunit_free_suite_set()
kunit: Fix the wrong kfree of copy for kunit_filter_suites()
kunit: Fix possible memory leak in kunit_filter_suites()
kunit: test: Fix the possible memory leak in executor_test
lib/kunit/exec
readfn_adapter+0x20/0x2c
[<3c3e9211>] kthread+0x124/0x130
[<28f85bdd>] ret_from_fork+0x10/0x20
Fixes: d1836a3b2a9a ("mm/damon/core-test: initialise context before test in
damon_test_set_attrs()")
Fixes: 4f540f5ab4f2 ("mm/damon/core-test: ad
uot;mm/damon: add kunit tests")
Fixes: f4c978b6594b ("mm/damon/core-test: add a test for
damon_update_monitoring_results()")
Signed-off-by: Jinjie Ruan
Reviewed-by: SeongJae Park
---
v3:
- Update the commit message to be more accurate.
- Add Reviewed-by.
v2:
- Replace the damon_del_re
e the damon_del_region() with damon_destroy_region() rather than
calling damon_free_region().
- Update the commit message.
Jinjie Ruan (2):
mm/damon/core-test: Fix memory leak in damon_new_region()
mm/damon/core-test: Fix memory leak in damon_new_ctx()
mm/damon/core-test.h | 8 +++-
1
message.
Jinjie Ruan (2):
mm/damon/core-test: Fix memory leak in damon_new_region()
mm/damon/core-test: Fix memory leak in damon_new_ctx()
mm/damon/core-test.h | 8 +++-
1 file changed, 7 insertions(+), 1 deletion(-)
--
2.34.1
85bdd>] ret_from_fork+0x10/0x20
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Fixes: f4c978b6594b ("mm/damon/core-test: add a test for
damon_update_monitoring_results()")
Signed-off-by: Jinjie Ruan
---
v2:
- Replace the damon_del_region() with damon_destroy_region()
readfn_adapter+0x20/0x2c
[<3c3e9211>] kthread+0x124/0x130
[<28f85bdd>] ret_from_fork+0x10/0x20
Fixes: d1836a3b2a9a ("mm/damon/core-test: initialise context before test in
damon_test_set_attrs()")
Fixes: 4f540f5ab4f2 ("mm/damon/core-tes
00028f85bdd>] ret_from_fork+0x10/0x20
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Fixes: f4c978b6594b ("mm/damon/core-test: add a test for
damon_update_monitoring_results()")
Signed-off-by: Jinjie Ruan
---
mm/damon/core-test.h | 3 +++
1 file changed, 3 insertions(
c_run_threadfn_adapter+0x20/0x2c
[<3c3e9211>] kthread+0x124/0x130
[<28f85bdd>] ret_from_fork+0x10/0x20
Fixes: d1836a3b2a9a ("mm/damon/core-test: initialise context before test in
damon_test_set_attrs()")
Fixes: 4f540f5ab4f2 ("mm/damon/core-t
There are a few memory leak in core-test which is detected by kmemleak,
the patch set fix the above issue.
Jinjie Ruan (2):
mm/damon/core-test: Fix memory leak in damon_new_region()
mm/damon/core-test: Fix memory leak in damon_new_ctx()
mm/damon/core-test.h | 7 +++
1 file changed, 7
600
Kernel panic - not syncing: Fatal exception
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 1 seconds..
Fixes: 55e8c1b49ac5 ("kunit: Always run cleanup from a test kthread")
Signed-off-by: Jinjie Ruan
---
include/kunit/try-catch.h | 2 +-
lib
396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kunit_test_suites")
Signed-off-by: Jinjie Ruan
---
lib/kunit/executor_test.c | 24 ++--
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c
in
the filtered_suite
and filtered_suite->test_cases so far. And change kmalloc_array of copy
to kcalloc to Clear the copy to make the kfree safe.
Fixes: 5d31f71efcb6 ("kunit: add kunit.filter_glob cmdline option to filter
suites")
Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes&qu
If the outer layer for loop is iterated more than once and it fails not
in the first iteration, the copy pointer has been moved. So it should free
the original copy's backup copy_start.
Fixes: abbf73816b6f ("kunit: fix possible memory leak in kunit_filter_suites()")
Signed-off-
87e304>] el0_svc_common.constprop.1+0x68/0xe0
[<9d8ad866>] do_el0_svc+0x1c/0x28
[<5b83c607>] el0_svc+0x3c/0xc4
Fixes: e5857d396f35 ("kunit: flatten kunit_suite*** to kunit_suite** in
.kunit_test_suites")
Fixes: b67abaad4d25 ("kunit: Allow kun
If kunit_filter_suites() succeeds, not only copy but also filtered_suite
and filtered_suite->test_cases should be freed.
Jinjie Ruan (4):
kunit: Fix missed memory release in kunit_free_suite_set()
kunit: Fix the wrong kfree of copy for kunit_filter_suites()
kunit: Fix possible memory l
35 matches
Mail list logo