blob: dda3a87dc00a267a365d1116c987423f3510a823 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
DBGFS=$(grep debugfs /proc/mounts --max-count 1 | awk '{print $2}')
if [ "$DBGFS" = "" ]
then
echo "debugfs not mounted"
exit $ksft_skip
fi
DBGFS+="/damon"
if [ $EUID -ne 0 ];
then
echo "Run as root"
exit $ksft_skip
fi
if [ ! -d "$DBGFS" ]
then
echo "$DBGFS not found"
exit $ksft_skip
fi
if [ -f "$DBGFS/monitor_on_DEPRECATED" ]
then
monitor_on_file="monitor_on_DEPRECATED"
else
monitor_on_file="monitor_on"
fi
for f in attrs target_ids "$monitor_on_file"
do
if [ ! -f "$DBGFS/$f" ]
then
echo "$f not found"
exit 1
fi
done
permission_error="Operation not permitted"
for f in attrs target_ids "$monitor_on_file"
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
|