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]
Message-ID: <20191016150741.vrnwik5kkzcxubr2@pathway.suse.cz>
Date:   Wed, 16 Oct 2019 17:07:41 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Miroslav Benes <mbenes@...e.cz>
Cc:     rostedt@...dmis.org, jikos@...nel.org, joe.lawrence@...hat.com,
        jpoimboe@...hat.com, mingo@...hat.com, shuah@...nel.org,
        kamalesh@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org, live-patching@...r.kernel.org
Subject: Re: [PATCH v3 3/3] selftests/livepatch: Test interaction with
 ftrace_enabled

On Wed 2019-10-16 13:33:15, Miroslav Benes wrote:
> From: Joe Lawrence <joe.lawrence@...hat.com>
> 
> Since livepatching depends upon ftrace handlers to implement "patched"
> code functionality, verify that the ftrace_enabled sysctl value
> interacts with livepatch registration as expected.  At the same time,
> ensure that ftrace_enabled is set and part of the test environment
> configuration that is saved and restored when running the selftests.
> 
> Signed-off-by: Joe Lawrence <joe.lawrence@...hat.com>
> Signed-off-by: Miroslav Benes <mbenes@...e.cz>
> ---
>  tools/testing/selftests/livepatch/Makefile    |  3 +-
>  .../testing/selftests/livepatch/functions.sh  | 14 +++-
>  .../selftests/livepatch/test-ftrace.sh        | 65 +++++++++++++++++++
>  3 files changed, 80 insertions(+), 2 deletions(-)
>  create mode 100755 tools/testing/selftests/livepatch/test-ftrace.sh
> 
> diff --git a/tools/testing/selftests/livepatch/Makefile b/tools/testing/selftests/livepatch/Makefile
> index fd405402c3ff..1886d9d94b88 100644
> --- a/tools/testing/selftests/livepatch/Makefile
> +++ b/tools/testing/selftests/livepatch/Makefile
> @@ -4,6 +4,7 @@ TEST_PROGS_EXTENDED := functions.sh
>  TEST_PROGS := \
>  	test-livepatch.sh \
>  	test-callbacks.sh \
> -	test-shadow-vars.sh
> +	test-shadow-vars.sh \
> +	test-ftrace.sh
>  
>  include ../lib.mk
> diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
> index b7e5a67ae434..31eb09e38729 100644
> --- a/tools/testing/selftests/livepatch/functions.sh
> +++ b/tools/testing/selftests/livepatch/functions.sh
> @@ -32,12 +32,16 @@ function die() {
>  function push_config() {
>  	DYNAMIC_DEBUG=$(grep '^kernel/livepatch' /sys/kernel/debug/dynamic_debug/control | \
>  			awk -F'[: ]' '{print "file " $1 " line " $2 " " $4}')
> +	FTRACE_ENABLED=$(sysctl --values kernel.ftrace_enabled)
>  }
>  
>  function pop_config() {
>  	if [[ -n "$DYNAMIC_DEBUG" ]]; then
>  		echo -n "$DYNAMIC_DEBUG" > /sys/kernel/debug/dynamic_debug/control
>  	fi
> +	if [[ -n "$FTRACE_ENABLED" ]]; then
> +		sysctl kernel.ftrace_enabled="$FTRACE_ENABLED" &> /dev/null
> +	fi
>  }
>  
>  function set_dynamic_debug() {
> @@ -47,12 +51,20 @@ function set_dynamic_debug() {
>  		EOF
>  }
>  
> +function set_ftrace_enabled() {
> +	local sysctl="$1"

The variable is not later used.

> +	result=$(sysctl kernel.ftrace_enabled="$1" 2>&1 | paste --serial --delimiters=' ')
> +	echo "livepatch: $result" > /dev/kmsg
> +}

Otherwise, the patch looks good to me. After removing or using the
variable:

Reviewed-by: Petr Mladek <pmladek@...e.com>

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ