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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.1802091326490.30746@pobox.suse.cz>
Date:   Fri, 9 Feb 2018 13:29:46 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Petr Mladek <pmladek@...e.com>
cc:     Jiri Kosina <jikos@...nel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Jason Baron <jbaron@...mai.com>,
        Joe Lawrence <joe.lawrence@...hat.com>,
        Jessica Yu <jeyu@...nel.org>,
        Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 4/7] livepatch: Allow to unpatch only functions of
 the given type


> +/*
> + * Remove ftrace handler for the given object and function type.

Isn't it imprecise? It does not necessarily remove ftrace handler. It 
removes a function of given ftype from func_stack. I'd remove the 
sentence.

> + *
> + * It keeps obj->patched flag true when any listed function is still patched.
> + * The caller is responsible for removing the unpatched functions to
> + * make the flag clean again.
> + */
> +void klp_unpatch_object(struct klp_object *obj, enum klp_func_type ftype)
>  {
>  	struct klp_func *func;
> +	bool patched = false;
>  
> -	klp_for_each_func(obj, func)
> -		if (func->patched)
> +	klp_for_each_func(obj, func) {
> +		if (!func->patched)
> +			continue;
> +
> +		if (klp_is_func_type(func, ftype))
>  			klp_unpatch_func(func);
> +		else
> +			patched = true;
> +	}
>  
> -	obj->patched = false;
> +	obj->patched = patched;
>  }
>  
>  int klp_patch_object(struct klp_object *obj)
> @@ -258,7 +272,7 @@ int klp_patch_object(struct klp_object *obj)
>  	klp_for_each_func(obj, func) {
>  		ret = klp_patch_func(func);
>  		if (ret) {
> -			klp_unpatch_object(obj);
> +			klp_unpatch_object(obj, KLP_FUNC_ANY);
>  			return ret;
>  		}
>  	}
> @@ -267,11 +281,12 @@ int klp_patch_object(struct klp_object *obj)
>  	return 0;
>  }
>  
> -void klp_unpatch_objects(struct klp_patch *patch)
> +/* Removes ftrace handler in all objects for the given function type. */

Same here.

> +void klp_unpatch_objects(struct klp_patch *patch, enum klp_func_type ftype)
>  {
>  	struct klp_object *obj;
>  
>  	klp_for_each_object(patch, obj)
>  		if (obj->patched)
> -			klp_unpatch_object(obj);
> +			klp_unpatch_object(obj, ftype);
>  }

Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ