tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++ 1 file changed, 10 insertions(+)
The kernel is in lockdown mode when secureboot is enabled and hence
debugfs cannot be used. Add support for this and other general cases
where debugfs cannot be read and communicate the same to the user before
running tests.
Signed-off-by: Gautam <gautammenghani201@gmail.com>
---
Changes in v2:
1. Modify the error message to account for general cases.
2. Change the return code so that the test is skipped.
Changes in v3:
1. Change the name of variable holding the error message.
Changes in v4:
1. Correct the mode of the source file.
tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh
index 0189db81550b..0328ac0b5a5e 100644
--- a/tools/testing/selftests/damon/_chk_dependency.sh
+++ b/tools/testing/selftests/damon/_chk_dependency.sh
@@ -26,3 +26,13 @@ do
exit 1
fi
done
+
+permission_error="Operation not permitted"
+for f in attrs target_ids monitor_on
+do
+ status=$( cat "$DBGFS/$f" 2>&1 )
+ if [ "${status#*$permission_error}" != "$status" ]; then
+ echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
+ exit $ksft_skip
+ fi
+done
--
2.36.1
Hi Gautam,
On Sun, 26 Jun 2022 01:22:45 +0530 Gautam <gautammenghani201@gmail.com> wrote:
> The kernel is in lockdown mode when secureboot is enabled and hence
> debugfs cannot be used. Add support for this and other general cases
> where debugfs cannot be read and communicate the same to the user before
> running tests.
>
> Signed-off-by: Gautam <gautammenghani201@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> Changes in v2:
> 1. Modify the error message to account for general cases.
> 2. Change the return code so that the test is skipped.
>
> Changes in v3:
> 1. Change the name of variable holding the error message.
>
> Changes in v4:
> 1. Correct the mode of the source file.
>
> tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh
> index 0189db81550b..0328ac0b5a5e 100644
> --- a/tools/testing/selftests/damon/_chk_dependency.sh
> +++ b/tools/testing/selftests/damon/_chk_dependency.sh
> @@ -26,3 +26,13 @@ do
> exit 1
> fi
> done
> +
> +permission_error="Operation not permitted"
> +for f in attrs target_ids monitor_on
> +do
> + status=$( cat "$DBGFS/$f" 2>&1 )
> + if [ "${status#*$permission_error}" != "$status" ]; then
> + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
> + exit $ksft_skip
> + fi
> +done
> --
> 2.36.1
On 6/25/22 2:03 PM, SeongJae Park wrote:
> Hi Gautam,
>
> On Sun, 26 Jun 2022 01:22:45 +0530 Gautam <gautammenghani201@gmail.com> wrote:
>
>> The kernel is in lockdown mode when secureboot is enabled and hence
>> debugfs cannot be used. Add support for this and other general cases
>> where debugfs cannot be read and communicate the same to the user before
>> running tests.
>>
>> Signed-off-by: Gautam <gautammenghani201@gmail.com>
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
>
>
> Thanks,
> SJ
>
>> ---
>> Changes in v2:
>> 1. Modify the error message to account for general cases.
>> 2. Change the return code so that the test is skipped.
>>
>> Changes in v3:
>> 1. Change the name of variable holding the error message.
>>
>> Changes in v4:
>> 1. Correct the mode of the source file.
>>
>> tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh
>> index 0189db81550b..0328ac0b5a5e 100644
>> --- a/tools/testing/selftests/damon/_chk_dependency.sh
>> +++ b/tools/testing/selftests/damon/_chk_dependency.sh
>> @@ -26,3 +26,13 @@ do
>> exit 1
>> fi
>> done
>> +
>> +permission_error="Operation not permitted"
>> +for f in attrs target_ids monitor_on
>> +do
>> + status=$( cat "$DBGFS/$f" 2>&1 )
>> + if [ "${status#*$permission_error}" != "$status" ]; then
>> + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
btw - does this run as a regular user or does it need root privilege?
If so add a test for that and skip with a message.
>> + exit $ksft_skip
>> + fi
>> +done
>> --
>> 2.36.1
>
thanks,
-- Shuah
From: SeongJae Park <sj@kernel.org>
Hi Shuah,
On Mon, 27 Jun 2022 11:00:18 -0600 Shuah Khan <skhan@linuxfoundation.org> wrote:
[...]
> >> --- a/tools/testing/selftests/damon/_chk_dependency.sh
> >> +++ b/tools/testing/selftests/damon/_chk_dependency.sh
> >> @@ -26,3 +26,13 @@ do
> >> exit 1
> >> fi
> >> done
> >> +
> >> +permission_error="Operation not permitted"
> >> +for f in attrs target_ids monitor_on
> >> +do
> >> + status=$( cat "$DBGFS/$f" 2>&1 )
> >> + if [ "${status#*$permission_error}" != "$status" ]; then
> >> + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
>
> btw - does this run as a regular user or does it need root privilege?
> If so add a test for that and skip with a message.
It needs the root permission, and does the check at the beginning[1].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/damon/_chk_dependency.sh?h=v5.19-rc4#n9
Thanks,
SJ
> >> + exit $ksft_skip
> >> + fi
> >> +done
> >> --
> >> 2.36.1
> >
> thanks,
> -- Shuah
On 6/27/22 12:57 PM, SeongJae Park wrote:
> From: SeongJae Park <sj@kernel.org>
>
> Hi Shuah,
>
> On Mon, 27 Jun 2022 11:00:18 -0600 Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> [...]
>>>> --- a/tools/testing/selftests/damon/_chk_dependency.sh
>>>> +++ b/tools/testing/selftests/damon/_chk_dependency.sh
>>>> @@ -26,3 +26,13 @@ do
>>>> exit 1
>>>> fi
>>>> done
>>>> +
>>>> +permission_error="Operation not permitted"
>>>> +for f in attrs target_ids monitor_on
>>>> +do
>>>> + status=$( cat "$DBGFS/$f" 2>&1 )
>>>> + if [ "${status#*$permission_error}" != "$status" ]; then
>>>> + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?"
>>
>> btw - does this run as a regular user or does it need root privilege?
>> If so add a test for that and skip with a message.
>
> It needs the root permission, and does the check at the beginning[1].
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/damon/_chk_dependency.sh?h=v5.19-rc4#n9
>
>
Great. Thank you. I will pull this one in for linux-kselftest next
for Linux 5.20-rc1
thanks,
-- Shuah
© 2016 - 2026 Red Hat, Inc.