I checked and the Landlock ptrace test failed because Yama is enabled,
which is expected. You can check that with
/proc/sys/kernel/yama/ptrace_scope
Jeff Xu sent a patch to fix this case but it is not ready yet:
https://lore.kernel.org/r/20220628222941.2642917-1-jeffxu@google.com
Could you please send a new patch Jeff, and add Limin in Cc?
On 29/11/2022 12:26, limin wrote:
> cat /proc/cmdline
> BOOT_IMAGE=/vmlinuz-6.1.0-next-20221116
> root=UUID=a65b3a79-dc02-4728-8a0c-5cf24f4ae08b ro
> systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all
>
>
> config
>
> #
> # Automatically generated file; DO NOT EDIT.
> # Linux/x86 6.1.0-rc6 Kernel Configuration
> #
[...]
> CONFIG_SECURITY_YAMA=y
[...]
> CONFIG_LSM="landlock,lockdown,yama,integrity,apparmor"
[...]
>
> On 2022/11/29 19:03, Mickaël Salaün wrote:
>> I tested with next-20221116 and all tests are OK. Could you share your
>> kernel configuration with a link? What is the content of /proc/cmdline?
>>
>> On 29/11/2022 02:42, limin wrote:
>>> I run test on Linux ubuntu2204 6.1.0-next-20221116
>>>
>>> I did't use yama.
>>>
>>> you can reproduce by this step:
>>>
>>> cd kernel_src
>>>
>>> cd tools/testing/selftests/landlock/
>>> make
>>> ./ptrace_test
>>>
>>>
>>>
>>>
>>> On 2022/11/29 3:44, Mickaël Salaün wrote:
>>>> This patch changes the test semantic and then cannot work on my test
>>>> environment. On which kernel did you run test? Do you use Yama or
>>>> something similar?
>>>>
>>>> On 28/11/2022 03:04, limin wrote:
>>>>> Tests PTRACE_ATTACH and PTRACE_MODE_READ on the parent,
>>>>> trace parent return -1 when child== 0
>>>>> How to reproduce warning:
>>>>> $ make -C tools/testing/selftests TARGETS=landlock run_tests
>>>>>
>>>>> Signed-off-by: limin <limin100(a)huawei.com>
>>>>> ---
>>>>> tools/testing/selftests/landlock/ptrace_test.c | 5 ++---
>>>>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/tools/testing/selftests/landlock/ptrace_test.c
>>>>> b/tools/testing/selftests/landlock/ptrace_test.c
>>>>> index c28ef98ff3ac..88c4dc63eea0 100644
>>>>> --- a/tools/testing/selftests/landlock/ptrace_test.c
>>>>> +++ b/tools/testing/selftests/landlock/ptrace_test.c
>>>>> @@ -267,12 +267,11 @@ TEST_F(hierarchy, trace)
>>>>> /* Tests PTRACE_ATTACH and PTRACE_MODE_READ on the
>>>>> parent. */
>>>>> err_proc_read = test_ptrace_read(parent);
>>>>> ret = ptrace(PTRACE_ATTACH, parent, NULL, 0);
>>>>> + EXPECT_EQ(-1, ret);
>>>>> + EXPECT_EQ(EPERM, errno);
>>>>> if (variant->domain_child) {
>>>>> - EXPECT_EQ(-1, ret);
>>>>> - EXPECT_EQ(EPERM, errno);
>>>>> EXPECT_EQ(EACCES, err_proc_read);
>>>>> } else {
>>>>> - EXPECT_EQ(0, ret);
>>>>> EXPECT_EQ(0, err_proc_read);
>>>>> }
>>>>> if (ret == 0) {
Add the definition of the '__weak' attribute since it is not available in
GCC 11.3.0 and newer:
rseq.c:41:1: error: unknown type name ‘__weak’
41 | __weak ptrdiff_t __rseq_offset;
Fixes: 3bcbc20942db ("selftests/rseq: Play nice with binaries statically linked against glibc 2.35+")
Signed-off-by: Anh Tuan Phan <tuananhlfc(a)gmail.com>
---
tools/testing/selftests/rseq/rseq.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c
index a723da253244..584eec9b0930 100644
--- a/tools/testing/selftests/rseq/rseq.c
+++ b/tools/testing/selftests/rseq/rseq.c
@@ -34,6 +34,10 @@
#include "../kselftest.h"
#include "rseq.h"
+#ifndef __weak
+#define __weak __attribute__((weak))
+#endif
+
/*
* Define weak versions to play nice with binaries that are statically linked
* against a libc that doesn't support registering its own rseq.
--
2.34.1
Hi,
Since v6.5-rc1, kunit gained a devm/drmm-like mechanism that makes tests
resources much easier to cleanup.
This series converts the existing tests to use those new actions where
relevant.
Let me know what you think,
Maxime
Signed-off-by: Maxime Ripard <mripard(a)kernel.org>
---
Changes in v3:
- Fixed the build cast warnings by switching to wrapper functions
- Link to v2: https://lore.kernel.org/r/20230720-kms-kunit-actions-rework-v2-0-175017bd56…
Changes in v2:
- Fix some typos
- Use plaltform_device_del instead of removing the call to
platform_device_put after calling platform_device_add
- Link to v1: https://lore.kernel.org/r/20230710-kms-kunit-actions-rework-v1-0-722c58d72c…
---
Maxime Ripard (11):
drm/tests: helpers: Switch to kunit actions
drm/tests: client-modeset: Remove call to drm_kunit_helper_free_device()
drm/tests: modes: Remove call to drm_kunit_helper_free_device()
drm/tests: probe-helper: Remove call to drm_kunit_helper_free_device()
drm/tests: helpers: Create a helper to allocate a locking ctx
drm/tests: helpers: Create a helper to allocate an atomic state
drm/vc4: tests: pv-muxing: Remove call to drm_kunit_helper_free_device()
drm/vc4: tests: mock: Use a kunit action to unregister DRM device
drm/vc4: tests: pv-muxing: Switch to managed locking init
drm/vc4: tests: Switch to atomic state allocation helper
drm/vc4: tests: pv-muxing: Document test scenario
drivers/gpu/drm/tests/drm_client_modeset_test.c | 8 --
drivers/gpu/drm/tests/drm_kunit_helpers.c | 141 +++++++++++++++++++++++-
drivers/gpu/drm/tests/drm_modes_test.c | 8 --
drivers/gpu/drm/tests/drm_probe_helper_test.c | 8 --
drivers/gpu/drm/vc4/tests/vc4_mock.c | 12 ++
drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 115 +++++++------------
include/drm/drm_kunit_helpers.h | 7 ++
7 files changed, 198 insertions(+), 101 deletions(-)
---
base-commit: d7b3af5a77e8d8da28f435f313e069aea5bcf172
change-id: 20230710-kms-kunit-actions-rework-5d163762c93b
Best regards,
--
Maxime Ripard <mripard(a)kernel.org>
Hi,
Since v6.5-rc1, kunit gained a devm/drmm-like mechanism that makes tests
resources much easier to cleanup.
This series converts the existing tests to use those new actions where
relevant.
Let me know what you think,
Maxime
Signed-off-by: Maxime Ripard <mripard(a)kernel.org>
---
Changes in v2:
- Fix some typos
- Use plaltform_device_del instead of removing the call to
platform_device_put after calling platform_device_add
- Link to v1: https://lore.kernel.org/r/20230710-kms-kunit-actions-rework-v1-0-722c58d72c…
---
Maxime Ripard (11):
drm/tests: helpers: Switch to kunit actions
drm/tests: client-modeset: Remove call to drm_kunit_helper_free_device()
drm/tests: modes: Remove call to drm_kunit_helper_free_device()
drm/tests: probe-helper: Remove call to drm_kunit_helper_free_device()
drm/tests: helpers: Create a helper to allocate a locking ctx
drm/tests: helpers: Create a helper to allocate an atomic state
drm/vc4: tests: pv-muxing: Remove call to drm_kunit_helper_free_device()
drm/vc4: tests: mock: Use a kunit action to unregister DRM device
drm/vc4: tests: pv-muxing: Switch to managed locking init
drm/vc4: tests: Switch to atomic state allocation helper
drm/vc4: tests: pv-muxing: Document test scenario
drivers/gpu/drm/tests/drm_client_modeset_test.c | 8 --
drivers/gpu/drm/tests/drm_kunit_helpers.c | 108 +++++++++++++++++++++-
drivers/gpu/drm/tests/drm_modes_test.c | 8 --
drivers/gpu/drm/tests/drm_probe_helper_test.c | 8 --
drivers/gpu/drm/vc4/tests/vc4_mock.c | 5 ++
drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 115 +++++++++---------------
include/drm/drm_kunit_helpers.h | 7 ++
7 files changed, 158 insertions(+), 101 deletions(-)
---
base-commit: c58c49dd89324b18a812762a2bfa5a0458e4f252
change-id: 20230710-kms-kunit-actions-rework-5d163762c93b
Best regards,
--
Maxime Ripard <mripard(a)kernel.org>
Submit the top-level headers also from the kunit test module notifier
initialization callback, so external tools that are parsing dmesg for
kunit test output are able to tell how many test suites should be expected
and whether to continue parsing after complete output from the first test
suite is collected.
Extend kunit module notifier initialization callback with a processing
path for only listing the tests provided by a module if the kunit action
parameter is set to "list", so external tools can obtain a list of test
cases to be executed in advance and can make a better job on assigning
kernel messages interleaved with kunit output to specific tests.
Use test filtering functions in kunit module notifier callback functions,
so external tools are able to execute individual test cases from kunit
test modules in order to still better isolate their potential impact on
kernel messages that appear interleaved with output from other tests.
v2: Fix new name of a structure moved to kunit namespace not updated
across all uses.
Janusz Krzysztofik (3):
kunit: Report the count of test suites in a module
kunit: Make 'list' action available to kunit test modules
kunit: Allow kunit test modules to use test filtering
include/kunit/test.h | 14 +++++++++++
lib/kunit/executor.c | 57 +++++++++++++++++++++++++-------------------
lib/kunit/test.c | 57 +++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 103 insertions(+), 25 deletions(-)
--
2.41.0