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: <CAMj1kXE4stcFikmxBMY19CR4J0+EpaNW8J=xVyFVY3A7F7BpRQ@mail.gmail.com>
Date:   Fri, 17 Nov 2023 03:36:17 +1000
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     Maria Yu <quic_aiquny@...cinc.com>, linux@...linux.org.uk,
        mhiramat@...nel.org, kernel@...cinc.com,
        linux-arm-kernel@...ts.infradead.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        quic_lijuang@...cinc.com, stable@...r.kernel.org
Subject: Re: [PATCH v2 1/1] ARM: kprobes: Explicitly reserve r7 for local variables

On Fri, 17 Nov 2023 at 03:24, Nathan Chancellor <nathan@...nel.org> wrote:
>
> On Wed, Nov 15, 2023 at 05:58:30PM +0800, Maria Yu 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. This caused the runtime behavior wrong.
> > While those kind of reserved registers cannot be set to clobber list
> > because of error like "inline asm clobber list contains reserved
> > registers".
> > Explicitly reserve r7 by adding attribute no-omit-frame-pointer for needed
> > function, then in T32 asm code r7 is used as a frame pointer and is not
> > available for use as a general-purpose register.
> > Note that "no-omit-frame-pointer" will make the code size a little bigger
> > to store the stack frame pointer. So limited to needed functions can have
> > the less impact than the full source file.
> >
> > Fixes: dd12e97f3c72 ("ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds")
> > Signed-off-by: Maria Yu <quic_aiquny@...cinc.com>
> > Cc: stable@...r.kernel.org
>
> This causes warnings with clang:
>
>   arch/arm/probes/kprobes/actions-thumb.c:441:47: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
>     441 | static unsigned long __kprobes __attribute__((optimize("no-omit-frame-pointer")))
>         |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/arm/probes/kprobes/actions-thumb.c:524:38: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
>     524 | static void __kprobes __attribute__((optimize("no-omit-frame-pointer")))
>         |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/arm/probes/kprobes/actions-thumb.c:560:38: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
>     560 | static void __kprobes __attribute__((optimize("no-omit-frame-pointer")))
>         |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/arm/probes/kprobes/actions-thumb.c:579:38: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
>     579 | static void __kprobes __attribute__((optimize("no-omit-frame-pointer")))
>         |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   4 warnings generated.
>
> Furthermore, as far as I am aware, the optimize attribute has other issues so
> its use is discouraged, see commits 080b6f407635 ("bpf: Don't rely on GCC
> __attribute__((optimize)) to disable GCSE") and a7223f5bfcae ("powerpc: Avoid
> broken GCC __attribute__((optimize))").
>

Ah yes, apalogies for missing that. I did a test build with Clang but
I did not spot the errors. So

Unreviewed-by: ....

Maria, please use the Makefile based per-file CFLAGS override that I
suggested before. There is really no reason to make this per-function.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ