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: <CAMj1kXEUTOpATv_jbimGktSXBBweyfVNPpqWWJaJNp0U-zvg+w@mail.gmail.com>
Date:   Wed, 27 Sep 2023 10:11:05 +0000
From:   Ard Biesheuvel <ardb@...nel.org>
To:     "Aiqun(Maria) Yu" <quic_aiquny@...cinc.com>
Cc:     linux@...linux.org.uk, mhiramat@...nel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        kernel@...cinc.com, quic_lijuang@...cinc.com,
        linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] ARM: kprobes: Explicitly assign register for local variables

On Wed, 27 Sept 2023 at 09:44, Aiqun(Maria) Yu <quic_aiquny@...cinc.com> wrote:
>
> On 9/27/2023 5:26 PM, Ard Biesheuvel wrote:
> > Hello Maria,
> >
> > On Wed, 27 Sept 2023 at 06:00, Maria Yu <quic_aiquny@...cinc.com> wrote:
> >>
> >> Registers r7 is removed in clobber list, so compiler may choose r7 for
> >> local variables usage, while r7 will be actually updated by the inline asm
> >> code.
> >
> > The inline asm does not update R7, it preserves and restores it.
> That is the asm is updating r7 purposely and compiler still choose r7
> for the asm local varialbe and use it inside the asm code.
> So the change is to fix the issue when "r7 is removed from the clobber
> list of current asm code while actually r7 shouldn't be choosed for the
> current asm local variables".
> The issue is only reproducible when ftrace is not enabled, and r7 is
> removed from the current clobber list.
>
> Let me have the assemble code that will make you understand better.
>
> --the original code:
> "mov    r11, r7                 \n\t"
> ...
> "ldmia  %[regs], {r0-r7}        \n\t"
> "blx    %[fn]                   \n\t"
> ...
> "mov    r7, r11                 \n\t"
>
> --After compile to choose register for [fn] and [regs].
> mov     r11, r7
> ldr  r7, [r1, #16] //r7 used for store asi->insn_fn
> ...
> ldmia.w  ip, {r0, r1, r2, r3, r4, r5, r6, r7}
> blx r7
> ...
> mov r7,r11
>
> The current change is to avoid by fix the registers for local variable
> usage and not choose r7 for [fn].
>

OK, I understand now, thanks.

Would it help if we just always enabled frame pointers for this source file?

--- a/arch/arm/probes/kprobes/Makefile
+++ b/arch/arm/probes/kprobes/Makefile
@@ -9,6 +9,7 @@ test-kprobes-objs               := test-core.o
 ifdef CONFIG_THUMB2_KERNEL
 obj-$(CONFIG_KPROBES)          += actions-thumb.o checkers-thumb.o
 test-kprobes-objs              += test-thumb.o
+KBUILD_CFLAGS                  += -fno-omit-frame-pointer
 else
 obj-$(CONFIG_KPROBES)          += actions-arm.o checkers-arm.o
 obj-$(CONFIG_OPTPROBES)                += opt-arm.o

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ