runtest/fs: Don't read files in /dev indiscriminately
PATCH 1/1 runtest/fs: Don't read files in /dev indiscriminately
read_all_dev attempts to read 1024 bytes from all devices in /dev. As nodes in /dev represent devices, any access can have side-effects - sometimes fatally so, e.g., accessing /dev/port on Juno R2 and AMD Seattle lead to synchronous external abort or SError (system error) interrupt depending on the access pattern.
There isn't much the kernel can do about the aborts other than panic the system.
The side-effects problem is also highlighted by the recent exclusion added for watchdog devices. See commit 4a41aa6b48c134e ("runtest/fs:
filter /dev/watchdog* for read_all_dev by default").
It would be better to replace indiscriminate reading of /dev files with tests targeting specific files in /dev which have defined known behaviour, e.g., /dev/null, /dev/urandom, etc.
In the meanwhile, drop the indiscriminate reading of files in /dev.
---
Hi,
The test leads to panic during nightly ltp runs on internal systems. Looking at the crash report from Naresh[0], it looks likely that he's facing the same problem.
Please consider including in upcoming release.
Thanks,
Punit
[0] http://lists.linux.it/pipermail/ltp/2018-May/007954.html
--- runtest/fs | 1 - 1 file changed, 1 deletion(-)
runtest/fs +0 -1
@@ -69,7 +69,6 @@ fs_di fs_di -d $TMPDIR # Was not sure why it should reside in runtest/crashme and won´t get tested ever proc01 proc01 -m 128 -read_all_dev read_all -d /dev -e '/dev/watchdog?(0)' -q -r 10 read_all_proc read_all -d /proc -q -r 10 read_all_sys read_all -d /sys -q -r 10
Signature · 1 line
2.17.0
PATCH 1/1 runtest/fs: Don't read files in /dev indiscriminately
Hello,
Quoted 13 lines · Punit Agrawal
read_all_devattempts to read 1024 bytes from all devices in /dev. As nodes in /dev represent devices, any access can have side-effects - sometimes fatally so, e.g., accessing/dev/porton Juno R2 and AMD Seattle lead to synchronous external abort or SError (system error) interrupt depending on the access pattern.There isn't much the kernel can do about the aborts other than panic the system.
The side-effects problem is also highlighted by the recent exclusion added for watchdog devices. See commit
4a41aa6b48c134e("runtest/fs:
filter/dev/watchdog*forread_all_devby default").
Quoted 5 lines
It would be better to replace indiscriminate reading of /dev files with tests targeting specific files in /dev which have defined known behaviour, e.g.,
/dev/null,/dev/urandom, etc.In the meanwhile, drop the indiscriminate reading of files in /dev.
Another solution might be to add an option which drops privileges before running the test on /dev. An unprivileged user should not have access to files like /dev/port, but will for /dev/null and /dev/urandom.
Quoted 29 lines
Signed-off-by Punit Agrawal <[email protected]>---
Hi,The test leads to panic during nightly ltp runs on internal systems. Looking at the crash report from Naresh[0], it looks likely that he's facing the same problem.
Please consider including in upcoming release.
Thanks,
Punit[0] http://lists.linux.it/pipermail/ltp/2018-May/007954.html
--- runtest/fs | 1 - 1 file changed, 1 deletion(-)runtest/fs +0
-0
runtest/fs fs_di fs_di -d $TMPDIR · line 73
Quoted 6 lines
runtest/fs +0
-1@@ -69,7 +69,6 @@ fs_di fs_di -d $TMPDIR # Was not sure why it should reside in runtest/crashme and won´t get tested ever proc01 proc01 -m 128 -read_all_dev read_all -d /dev -e '/dev/watchdog?(0)' -q -r 10 read_all_proc read_all -d /proc -q -r 10 read_all_sys read_all -d /sys -q -r 10
--
Thank you,
Richard.
PATCH 1/1 runtest/fs: Don't read files in /dev indiscriminately
Hi!
Quoted 9 lines
Quoted 5 lines
It would be better to replace indiscriminate reading of /dev files with tests targeting specific files in /dev which have defined known behaviour, e.g.,
/dev/null,/dev/urandom, etc.In the meanwhile, drop the indiscriminate reading of files in /dev.
Another solution might be to add an option which drops privileges before running the test on /dev. An unprivileged user should not have access to files like
/dev/port, but will for/dev/nulland/dev/urandom.
That sounds like a better solution to me, can we get that in before the release?
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 runtest/fs: Don't read files in /dev indiscriminately
Hello,
Quoted 5 lines · Cyril Hrubis
Hi!
Quoted 4 lines
Quoted 4 lines
It would be better to replace indiscriminate reading of /dev files with tests targeting specific files in /dev which have defined known behaviour, e.g.,
/dev/null,/dev/urandom, etc.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
In the meanwhile, drop the indiscriminate reading of files in /dev.
Another solution might be to add an option which drops privileges before running the test on /dev. An unprivileged user should not have access to files like
/dev/port, but will for/dev/nulland/dev/urandom.That sounds like a better solution to me, can we get that in before the release?
Yes, I can give this priority.
Signature · 2 lines
Thank you, Richard.
PATCH 1/1 runtest/fs: Don't read files in /dev indiscriminately
In reply to Richard PalethorpeHi Richard,
Quoted 21 lines · Richard Palethorpe
Hello,
Quoted 17 lines · Punit Agrawal
read_all_devattempts to read 1024 bytes from all devices in /dev. As nodes in /dev represent devices, any access can have side-effects - sometimes fatally so, e.g., accessing/dev/porton Juno R2 and AMD Seattle lead to synchronous external abort or SError (system error) interrupt depending on the access pattern.There isn't much the kernel can do about the aborts other than panic the system.
The side-effects problem is also highlighted by the recent exclusion added for watchdog devices. See commit
4a41aa6b48c134e("runtest/fs:
filter/dev/watchdog*forread_all_devby default").It would be better to replace indiscriminate reading of /dev files with tests targeting specific files in /dev which have defined known behaviour, e.g.,
/dev/null,/dev/urandom, etc.
Quoted 5 lines
Quoted 1 line
In the meanwhile, drop the indiscriminate reading of files in /dev.
Another solution might be to add an option which drops privileges before running the test on /dev. An unprivileged user should not have access to files like
/dev/port, but will for/dev/nulland/dev/urandom.
The following files have unprivileged read permission in /dev -
vfio/vfio
net/tun
ptmx
tty
urandom
random
full
zero
null
which seems a reasonable set (this'll likely vary by system).
So dropping privileges should keep things ticking.
Thanks,
Punit
Quoted 41 lines
Quoted 30 lines
Signed-off-by Punit Agrawal <[email protected]>---
Hi,The test leads to panic during nightly ltp runs on internal systems. Looking at the crash report from Naresh[0], it looks likely that he's facing the same problem.
Please consider including in upcoming release.
Thanks,
Punit[0] http://lists.linux.it/pipermail/ltp/2018-May/007954.html
--- runtest/fs | 1 - 1 file changed, 1 deletion(-)runtest/fs +0
-0runtest/fs fs_di fs_di -d $TMPDIR · line 73
Quoted 6 lines
runtest/fs +0
-1@@ -69,7 +69,6 @@ fs_di fs_di -d $TMPDIR # Was not sure why it should reside in runtest/crashme and won´t get tested ever proc01 proc01 -m 128 -read_all_dev read_all -d /dev -e '/dev/watchdog?(0)' -q -r 10 read_all_proc read_all -d /proc -q -r 10 read_all_sys read_all -d /sys -q -r 10--
Thank you,
Richard.