Skip to contentSkip to conversation

read_all_sys: skip debugfs

PATCH New Jan Stancek 2 participants 6 messages Nov 4, 2019 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 read_all_sys: skip debugfs

debugfs is meant for debugging, it exposes also device registers and can pretty much do anything:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
https://lore.kernel.org/stable/[email protected]/

---
 runtest/fs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
runtest/fs +1 -1
index 07d6e2b67964..fba19cae03e8 100644
@@ -71,7 +71,7 @@ proc01 proc01 -m 128
 
 read_all_dev read_all -d /dev -p -q -r 10
 read_all_proc read_all -d /proc -q -r 10
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count -e '/sys/kernel/debug/*'
 
 #Run the File System Race Condition Check tests as well
 fs_racer fs_racer.sh -t 5
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 read_all_sys: skip debugfs

Hi!

Quoted 15 lines

debugfs is meant for debugging, it exposes also device registers and can pretty much do anything:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
https://lore.kernel.org/stable/[email protected]/

---
 runtest/fs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
runtest/fs +0 -0
index 07d6e2b67964..fba19cae03e8 100644

runtest/fs proc01 proc01 -m 128 · line 74

Quoted 5 lines
runtest/fs +1 -1
@@ -71,7 +71,7 @@ proc01 proc01 -m 128
 
 read_all_dev read_all -d /dev -p -q -r 10
 read_all_proc read_all -d /proc -q -r 10
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count -e '/sys/kernel/debug/*'

Do we even support multiple parameters for the same option?

I looked that the library code and I would say that we will replace the value with each iteration which means that we will effectively use the last one.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 read_all_sys: skip debugfs

----- Original Message -----

Quoted 25 lines

Hi!

Quoted 20 lines

debugfs is meant for debugging, it exposes also device registers and can pretty much do anything:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
https://lore.kernel.org/stable/[email protected]/

---
 runtest/fs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
runtest/fs +1 -1
index 07d6e2b67964..fba19cae03e8 100644
@@ -71,7 +71,7 @@ proc01 proc01 -m 128
 
 read_all_dev read_all -d /dev -p -q -r 10
 read_all_proc read_all -d /proc -q -r 10
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count -e
Quoted 1 line

'/sys/kernel/debug/*'

Do we even support multiple parameters for the same option?

Quoted 3 lines

I looked that the library code and I would say that we will replace the value with each iteration which means that we will effectively use the last one.

That is good point. Do we actually need to store blacklist as cmdline parameters?

#3 lore raw

PATCH 1/1 read_all_sys: skip debugfs

Hi!

Quoted 7 lines
Quoted 5 lines

Do we even support multiple parameters for the same option?

I looked that the library code and I would say that we will replace the value with each iteration which means that we will effectively use the last one.

That is good point. Do we actually need to store blacklist as cmdline parameters?

I guess that we can put the well known ones to the source as well.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 read_all_sys: skip debugfs

In reply to Cyril Hrubis

Hi!

Quoted 10 lines

Review

Quoted 4 lines

read_all_dev read_all -d /dev -p -q -r 10
read_all_proc read_all -d /proc -q -r 10

(quoted diff) +1 -1
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count -e '/sys/kernel/debug/*'

Do we even support multiple parameters for the same option?

I looked that the library code and I would say that we will replace the value with each iteration which means that we will effectively use the last one.

Maybe we should even catch the case where user passed one option twice with:

lib/tst_test.c +3 -0
index c7b46d0d5..e1c841585 100644
@@ -468,6 +468,9 @@ static void parse_topt(unsigned int topts_len, int opt, char *optarg)
        if (i >= topts_len)
                tst_brk(TBROK, "Invalid option '%c' (should not happen)", opt);
 
+       if (*(toptions[i].arg))
+               tst_brk(TBROK, "Option already set!");
+
        *(toptions[i].arg) = optarg ? optarg : "";
 }
 
Signature · 2 lines
Cyril Hrubis
[email protected]
#5 lore raw

PATCH 1/1 read_all_sys: skip debugfs

----- Original Message -----

Quoted 9 lines

Hi!

Quoted 8 lines
Quoted 5 lines

read_all_dev read_all -d /dev -p -q -r 10
read_all_proc read_all -d /proc -q -r 10

(quoted diff) +1 -1
-read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count
+read_all_sys read_all -d /sys -q -r 10 -e /sys/power/wakeup_count -e

'/sys/kernel/debug/*'

Do we even support multiple parameters for the same option?

Quoted 5 lines
Quoted 3 lines

I looked that the library code and I would say that we will replace the value with each iteration which means that we will effectively use the last one.

Maybe we should even catch the case where user passed one option twice with:

Or WARN that option might be overwritten. Anyway, it sounds like good idea.

Quoted 22 lines
lib/tst_test.c +3 -0
index c7b46d0d5..e1c841585 100644
@@ -468,6 +468,9 @@ static void parse_topt(unsigned int topts_len, int opt,
 char *optarg)
        if (i >= topts_len)
                tst_brk(TBROK, "Invalid option '%c' (should not happen)",
                opt);
 
+       if (*(toptions[i].arg))
+               tst_brk(TBROK, "Option already set!");
+
        *(toptions[i].arg) = optarg ? optarg : "";

}

--
Cyril Hrubis
[email protected]