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: <20171024142723.l5e7v2f7ckrlkbrc@redhat.com>
Date:   Tue, 24 Oct 2017 10:27:23 -0400
From:   Joe Lawrence <joe.lawrence@...hat.com>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Jiri Kosina <jikos@...nel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Jessica Yu <jeyu@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
        Chris J Arges <chris.j.arges@...onical.com>,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] livepatch: __klp_disable_patch() should never be
 called for disabled patches

On Fri, Oct 20, 2017 at 04:56:51PM +0200, Petr Mladek wrote:
> __klp_disable_patch() should never be called when the patch is not
> enabled. Let's add the same warning that we have in __klp_enable_patch().
> 
> This allows to remove the check when calling klp_pre_unpatch_callback().
> It was strange anyway because it repeatedly checked per-patch flag
> for each patched object.
> 
> Signed-off-by: Petr Mladek <pmladek@...e.com>
> ---
>  kernel/livepatch/core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index eb134479c394..287f71e9dbfe 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -282,6 +282,9 @@ static int __klp_disable_patch(struct klp_patch *patch)
>  {
>  	struct klp_object *obj;
>  
> +	if (WARN_ON(!patch->enabled))
> +		return -EINVAL;
> +
>  	if (klp_transition_patch)
>  		return -EBUSY;
>  
> @@ -293,7 +296,7 @@ static int __klp_disable_patch(struct klp_patch *patch)
>  	klp_init_transition(patch, KLP_UNPATCHED);
>  
>  	klp_for_each_object(patch, obj)
> -		if (patch->enabled && obj->patched)
> +		if (obj->patched)
>  			klp_pre_unpatch_callback(obj);
>  
>  	/*
> -- 
> 1.8.5.6

Looks reasonable to me and cleans up the klp_pre_unpatch_callback()
calling condition.

Acked-by: Joe Lawrence <joe.lawrence@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ