lkml.org 
[lkml]   [2019]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V4 5/9] x86/alternative: Split text_poke_bp() into tree steps
On Mon,  4 Feb 2019 20:58:58 +0100
Daniel Bristot de Oliveira <bristot@redhat.com> wrote:

> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index d458c7973c56..202af29c43c0 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -767,6 +767,29 @@ int poke_int3_handler(struct pt_regs *regs)
>
> }
>
> +static void text_poke_bp_set_handler(void *addr, void *handler,
> + unsigned char int3)
> +{
> + bp_int3_handler = handler;
> + bp_int3_addr = (u8 *)addr + sizeof(int3);

Why add the above update to the handler in this function? It looks
strange in this patch. Then I thought, "hmm, maybe it has a reason to
be here in other patches". Then I see in patch 7, you *REMOVE* these
awkward lines from this function! Let's not move them here to begin
with.

We then don't even need to pass in "handler". And perhaps rename it to
just "text_poke_bp_add_int3()"?

-- Steve


> + text_poke(addr, &int3, sizeof(int3));
> +}
> +
> +static void patch_all_but_first_byte(void *addr, const void *opcode,
> + size_t len, unsigned char int3)
> +{
> + /* patch all but the first byte */
> + text_poke((char *)addr + sizeof(int3),
> + (const char *) opcode + sizeof(int3),
> + len - sizeof(int3));
> +}
> +

\
 
 \ /
  Last update: 2019-02-08 01:13    [W:0.246 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site