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: <706832c5-dab4-f806-96d6-2cdc37203d9d@infradead.org>
Date:   Tue, 19 Jun 2018 09:31:49 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Masami Hiramatsu <mhiramat@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>
Cc:     Ingo Molnar <mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>,
        linux-kernel@...r.kernel.org,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-arch@...r.kernel.org, Jonathan Corbet <corbet@....net>,
        linux-doc@...r.kernel.org
Subject: Re: [PATCH -tip v6 26/27] Documentation: kprobes: Add how to change
 the execution path

On 06/19/2018 09:16 AM, Masami Hiramatsu wrote:
> Add a section that explaining how to change the execution
> path with kprobes and warnings for some arch.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: linux-doc@...r.kernel.org
> ---
>  Documentation/kprobes.txt |   20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
> index 3e9e99ea751b..8a98eed1521b 100644
> --- a/Documentation/kprobes.txt
> +++ b/Documentation/kprobes.txt
> @@ -80,6 +80,26 @@ After the instruction is single-stepped, Kprobes executes the
>  "post_handler," if any, that is associated with the kprobe.
>  Execution then continues with the instruction following the probepoint.
>  

Hi,
I have a few small suggestions...


> +Changing Execution Path
> +-----------------------
> +
> +Since the kprobes can probe into a running kernel code, it can change

   Since kprobes can probe into running kernel code, it can change

> +the register set, including instruction pointer. This operation
> +requires maximum attention, such as keeping the stack frame, recovering
> +execution path etc. Since it is operated on running kernel and need deep

                       Since it operates on a running kernel and needs deep

> +knowladge of the archtecture and concurrent computing, you can easily

   knowledge of the architecture

> +shot your foot.

   shoot

> +
> +If you change the instruction pointer (and set up other related
> +registers) in pre_handler, you must return !0 so that the kprobes

                                                 so that kprobes

> +stops single stepping and just returns to given address.

                                          to the given address.

> +This also means post_handler should not be called anymore.
> +
> +Note that this operation may be harder on some architectures which
> +use TOC (Table of Contents) for function call, since you have to
> +setup new TOC for your function in your module, and recover old

   setup a new TOC for your function in your module, and recover the old

> +one after back from it.

   one after returning from it.

> +
>  Return Probes
>  -------------


-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ