From: "Michał Pecio" <michal.pecio@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: cacheflush completely broken, suspecting PAN+LPAE
Date: Tue, 12 Nov 2024 18:10:17 +0100 [thread overview]
Message-ID: <20241112181017.03992d1f@foxbook> (raw)
In-Reply-To: <ZzMsMFNSHLOKEeEW@shell.armlinux.org.uk>
On Tue, 12 Nov 2024 10:21:36 +0000, Russell King (Oracle) wrote:
> From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> Subject: [PATCH] ARM: fix cacheflush with PAN
>
> It seems that the cacheflush syscall got broken when PAN was
> implemented. User access was not enabled around the cache maintenance
> instructions, causing them to fault.
>
> Fixes: a5e090acbf54 ("ARM: software-based priviledged-no-access support")
For the record, non-LPAE seems to be OK, so for me it was 7af5b901e847.
> Reported-by: From: Michał Pecio <michal.pecio@gmail.com>
"From:" perhaps not strictly necessary ;)
Tested-by: Michał Pecio <michal.pecio@gmail.com>
That was it. With this patch gdb starts normally, does 295 cacheflush
calls and all of them succeed, with ARM_LPAE and ARM_PAN enabled.
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> arch/arm/kernel/traps.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
> index 54dcdcde3f77..6518771c1496 100644
> --- a/arch/arm/kernel/traps.c
> +++ b/arch/arm/kernel/traps.c
> @@ -574,6 +574,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
> static inline int
> __do_cache_op(unsigned long start, unsigned long end)
> {
> + unsigned int ua_flags;
> int ret;
>
> do {
> @@ -582,7 +583,9 @@ __do_cache_op(unsigned long start, unsigned long end)
> if (fatal_signal_pending(current))
> return 0;
>
> + ua_flags = uaccess_save_and_enable();
> ret = flush_icache_user_range(start, start + chunk);
> + uaccess_restore(ua_flags);
> if (ret)
> return ret;
>
> --
> 2.30.2
prev parent reply other threads:[~2024-11-12 17:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 22:38 cacheflush completely broken, suspecting PAN+LPAE Michał Pecio
2024-11-12 1:15 ` Linus Walleij
2024-11-12 6:41 ` Arnd Bergmann
2024-11-12 9:46 ` Michał Pecio
2024-11-12 9:32 ` Michał Pecio
2024-11-12 10:16 ` Michał Pecio
2024-11-12 10:21 ` Russell King (Oracle)
2024-11-12 10:45 ` Michał Pecio
2024-11-12 13:58 ` Linus Walleij
2024-11-12 17:10 ` Michał Pecio [this message]
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=20241112181017.03992d1f@foxbook \
--to=michal.pecio@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.