linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Ard Biesheuvel" <ardb@kernel.org>,
	"Russell King" <linux@armlinux.org.uk>
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Stefan Wahren" <wahrenst@gmx.net>,
	"Kees Cook" <keescook@chromium.org>,
	linux-arm-kernel@lists.infradead.org,
	"Catalin Marinas" <catalin.marinas@arm.com>
Subject: Re: [PATCH v3 4/4] ARM: Implement PAN for LPAE by TTBR0 page table walks disablement
Date: Wed, 15 May 2024 21:51:45 +0000	[thread overview]
Message-ID: <addc678d-8804-46c8-bcd3-c5dfa645fcd8@app.fastmail.com> (raw)
In-Reply-To: <CAMj1kXG-iTrGn7vbqusroKeYQRFkEnmGjMdgXVP+rSJvaC61RA@mail.gmail.com>

On Wed, May 15, 2024, at 16:36, Ard Biesheuvel wrote:
> On Wed, 15 May 2024 at 18:18, Russell King (Oracle) <linux@armlinux.org.uk> wrote:
>> > and so R0 is preserved, and the issue does not happen.
>> >
>> > Not sure how to reduce this to a reproducer that can be used to report
>> > the issue to the GCC folks, but it is most definitely a compiler
>> > problem, as far as I can tell.
>>
>> Well this has come up before...
>>
>> commit 851140ab0d083c78e5723a8b1cbd258f567a7aff
>> Author: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Date:   Wed Oct 2 11:28:02 2019 +0100
>>
>>     ARM: 8908/1: add __always_inline to functions called from __get_user_check()
>>
>> I assume it's a wontfix on the GCC side.
>>
>
> Yes, that is the exact same issue.
>
> Not sure whether it has been reported - the GCC side might not even be aware.
>
> I managed to reproduce this in godbolt - it happens even with -O2 not
> just with -Os
>
> https://godbolt.org/z/do56voKsa
>
> As far as I can tell, functions that use asm("r#") cannot safely call
> other functions at all unless those are __always_inline. The fact that
> it triggers with -Os first is just because it inlines much less
> aggressively than other optimization levels.

I remember that one now, and I also think this was a wontfix,
since the compiler has no way of doing the right thing here when
a variable is forced into an argument register and then used
after a function call. Spilling the contents on the stack or another
register would break the 'asm("%r0") annotation.

It would be nice to get a compiler warning for code like this, but
I don't know what legitimate use cases that would warn for, e.g. it
may be indistinguishable from the global 'register unsigned long
current_stack_pointer asm("r1");' construct we have on a couple
of architectures.

     Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-15 21:53 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 12:52 [PATCH v3 0/4] PAN for ARM32 using LPAE Linus Walleij
2024-03-12 12:52 ` [PATCH v3 1/4] ARM: Add TTBCR_* definitions to pgtable-3level-hwdef.h Linus Walleij
2024-03-12 12:52 ` [PATCH v3 2/4] ARM: Move asm statements accessing TTBCR into C functions Linus Walleij
2024-03-12 12:52 ` [PATCH v3 3/4] ARM: Reduce the number of #ifdef CONFIG_CPU_SW_DOMAIN_PAN Linus Walleij
2024-03-12 12:52 ` [PATCH v3 4/4] ARM: Implement PAN for LPAE by TTBR0 page table walks disablement Linus Walleij
2024-05-07 13:10   ` Geert Uytterhoeven
2024-05-13 19:23     ` Linus Walleij
2024-05-13 19:58       ` Geert Uytterhoeven
2024-05-13 20:29         ` Linus Walleij
2024-05-14  3:56           ` Florian Fainelli
2024-05-14  8:14             ` Russell King (Oracle)
2024-05-14 11:22               ` Geert Uytterhoeven
2024-05-14 11:33                 ` Russell King (Oracle)
2024-05-14 12:32                   ` Geert Uytterhoeven
2024-05-14 12:38                     ` Russell King (Oracle)
2024-05-14 15:03                       ` Catalin Marinas
2024-05-14  6:41           ` Geert Uytterhoeven
2024-05-14  7:46             ` Linus Walleij
2024-05-14  7:59               ` Ard Biesheuvel
2024-05-14  8:04                 ` Geert Uytterhoeven
2024-05-14  8:25                   ` Ard Biesheuvel
2024-05-14  9:22                     ` Russell King (Oracle)
2024-05-14 11:40                       ` Linus Walleij
2024-05-14 11:28                     ` Geert Uytterhoeven
2024-05-14 16:06                       ` Geert Uytterhoeven
2024-05-14 16:54                         ` Florian Fainelli
2024-05-14 17:03                           ` Russell King (Oracle)
2024-05-14 18:26                             ` Florian Fainelli
2024-05-14 20:33                               ` Linus Walleij
2024-05-14 20:34                                 ` Florian Fainelli
2024-05-15  8:36                                   ` Ard Biesheuvel
2024-05-15  8:45                                     ` Geert Uytterhoeven
2024-05-15  8:49                                       ` Ard Biesheuvel
2024-05-15  9:21                                         ` Geert Uytterhoeven
2024-05-15  9:39                                           ` Ard Biesheuvel
2024-05-15 11:58                                           ` Linus Walleij
2024-05-15 14:05                                             ` Geert Uytterhoeven
2024-05-15  8:48                                     ` Russell King (Oracle)
2024-05-15  8:53                                       ` Ard Biesheuvel
2024-05-15 12:27                                         ` Russell King (Oracle)
2024-05-15 15:41                                           ` Ard Biesheuvel
2024-05-15 16:18                                             ` Russell King (Oracle)
2024-05-15 16:36                                               ` Ard Biesheuvel
2024-05-15 21:51                                                 ` Arnd Bergmann [this message]
2024-05-15  8:10                               ` Geert Uytterhoeven
2024-05-14  7:37           ` Linus Walleij
2024-05-14 14:39             ` Catalin Marinas
2024-03-12 17:45 ` [PATCH v3 0/4] PAN for ARM32 using LPAE Florian Fainelli
2024-03-13  8:13   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=addc678d-8804-46c8-bcd3-c5dfa645fcd8@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=keescook@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=wahrenst@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).