lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Sep 2023 09:54:57 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Shuah Khan <shuah@...nel.org>, Mark Brown <broonie@...nel.org>,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [FIX PATCH] selftests: tracing: Fix to unmount tracefs for
 recovering environment

On Mon, 11 Sep 2023 13:09:09 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Sat,  9 Sep 2023 18:36:39 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> 
> > From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > 
> > Fix to unmount the tracefs if the ftracetest mounted it for recovering
> > system environment. If the tracefs is already mounted, this does nothing.
> > 
> > Suggested-by: Mark Brown <broonie@...nel.org>
> > Link: https://lore.kernel.org/all/29fce076-746c-4650-8358-b4e0fa215cf7@sirena.org.uk/
> > Fixes: cbd965bde74c ("ftrace/selftests: Return the skip code when tracing directory not configured in kernel")
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > ---
> >  tools/testing/selftests/ftrace/ftracetest |    8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
> > index cb5f18c06593..89c212d82256 100755
> > --- a/tools/testing/selftests/ftrace/ftracetest
> > +++ b/tools/testing/selftests/ftrace/ftracetest
> > @@ -31,6 +31,9 @@ err_ret=1
> >  # kselftest skip code is 4
> >  err_skip=4
> >  
> > +# umount required
> > +UMOUNT_DIR=""
> > +
> >  # cgroup RT scheduling prevents chrt commands from succeeding, which
> >  # induces failures in test wakeup tests.  Disable for the duration of
> >  # the tests.
> > @@ -45,6 +48,9 @@ setup() {
> >  
> >  cleanup() {
> >    echo $sched_rt_runtime_orig > $sched_rt_runtime
> > +  if [ "${UMOUNT_DIR}" ]; then
> 
> Shouldn't the above be:
> 
>      if [ ! -z "${UNMOUNT_DIR}" ]; then
> 
> ?

I think both are good.
What about using '-n' explictly?

[ -n "${UNMOUNT_DIR}" ]

Thanks,

> 
> -- Steve
> 
> > +    umount ${UMOUNT_DIR} ||:
> > +  fi
> >  }
> >  
> >  errexit() { # message
> > @@ -160,11 +166,13 @@ if [ -z "$TRACING_DIR" ]; then
> >  	    mount -t tracefs nodev /sys/kernel/tracing ||
> >  	      errexit "Failed to mount /sys/kernel/tracing"
> >  	    TRACING_DIR="/sys/kernel/tracing"
> > +	    UMOUNT_DIR=${TRACING_DIR}
> >  	# If debugfs exists, then so does /sys/kernel/debug
> >  	elif [ -d "/sys/kernel/debug" ]; then
> >  	    mount -t debugfs nodev /sys/kernel/debug ||
> >  	      errexit "Failed to mount /sys/kernel/debug"
> >  	    TRACING_DIR="/sys/kernel/debug/tracing"
> > +	    UMOUNT_DIR=${TRACING_DIR}
> >  	else
> >  	    err_ret=$err_skip
> >  	    errexit "debugfs and tracefs are not configured in this kernel"
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ