* [musl] [PATCH] riscv: correct symbol version of __vdso_flush_icache
@ 2024-01-25 16:55 Ignotas "gns" WANG
2024-01-25 19:05 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: Ignotas "gns" WANG @ 2024-01-25 16:55 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
Hi,
I'm porting LuaJIT to RISC-V, our binary built with musl would occasionally SIGILL at patched JIT insns. It looks that musl's __riscv_flush_icache is faulty, which may be the cause of this cache coherency issue.
For the patch, see the attachments.
Since I'm not a subscriber to the musl list, CC me please.
[-- Attachment #2: 0001-riscv-correct-symbol-version-of-__vdso_flush_icache.patch --]
[-- Type: application/octet-stream, Size: 901 bytes --]
From e427fd578a8de3220e72ab31b9eb18b412195a93 Mon Sep 17 00:00:00 2001
From: gns <infiwang@proton.me>
Date: Thu, 25 Jan 2024 23:59:52 +0800
Subject: [PATCH] riscv: correct symbol version of __vdso_flush_icache
Previously, __riscv_flush_icache would not work correctly as __vdso_flush_icache
had a wrong symbol version. Fix this by correcting symbol version.
Fixes: 0a48860c27a8 ("add riscv64 architecture support")
---
src/linux/cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/linux/cache.c b/src/linux/cache.c
index 0eb051c2..45024309 100644
--- a/src/linux/cache.c
+++ b/src/linux/cache.c
@@ -21,7 +21,7 @@ weak_alias(__cachectl, cachectl);
#ifdef SYS_riscv_flush_icache
#define VDSO_FLUSH_ICACHE_SYM "__vdso_flush_icache"
-#define VDSO_FLUSH_ICACHE_VER "LINUX_4.5"
+#define VDSO_FLUSH_ICACHE_VER "LINUX_4.15"
static void *volatile vdso_func;
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] riscv: correct symbol version of __vdso_flush_icache
2024-01-25 16:55 [musl] [PATCH] riscv: correct symbol version of __vdso_flush_icache Ignotas "gns" WANG
@ 2024-01-25 19:05 ` Rich Felker
2024-01-25 19:10 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2024-01-25 19:05 UTC (permalink / raw)
To: Ignotas "gns" WANG; +Cc: musl
On Thu, Jan 25, 2024 at 04:55:16PM +0000, Ignotas "gns" WANG wrote:
> Hi,
>
> I'm porting LuaJIT to RISC-V, our binary built with musl would
> occasionally SIGILL at patched JIT insns. It looks that musl's
> __riscv_flush_icache is faulty, which may be the cause of this cache
> coherency issue.
>
> For the patch, see the attachments.
>
> Since I'm not a subscriber to the musl list, CC me please.
Just to be clear, this was always wrong, not a change on the kernel
side where either symbol version might be seen depending on kernel
version, right?
Rich
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] riscv: correct symbol version of __vdso_flush_icache
2024-01-25 19:05 ` Rich Felker
@ 2024-01-25 19:10 ` Rich Felker
0 siblings, 0 replies; 3+ messages in thread
From: Rich Felker @ 2024-01-25 19:10 UTC (permalink / raw)
To: Ignotas "gns" WANG; +Cc: musl
On Thu, Jan 25, 2024 at 02:05:34PM -0500, Rich Felker wrote:
> On Thu, Jan 25, 2024 at 04:55:16PM +0000, Ignotas "gns" WANG wrote:
> > Hi,
> >
> > I'm porting LuaJIT to RISC-V, our binary built with musl would
> > occasionally SIGILL at patched JIT insns. It looks that musl's
> > __riscv_flush_icache is faulty, which may be the cause of this cache
> > coherency issue.
> >
> > For the patch, see the attachments.
> >
> > Since I'm not a subscriber to the musl list, CC me please.
>
> Just to be clear, this was always wrong, not a change on the kernel
> side where either symbol version might be seen depending on kernel
> version, right?
OK, answering my own question. The original Linux commit introducing
riscv vdso, e2c0cdfba7f69925afc92b20cd9835d81e11a4f1, has:
+VERSION
+{
+ LINUX_4.15 {
and 921ebd8f2c081b3cf6c3b29ef4103eef3ff26054 adds
__riscv_flush_icache under that. So apparently the version was just
miscopied/typo when added to musl.
I'll apply this right away and it'll be in the upcoming release.
Rich
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-25 19:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 16:55 [musl] [PATCH] riscv: correct symbol version of __vdso_flush_icache Ignotas "gns" WANG
2024-01-25 19:05 ` Rich Felker
2024-01-25 19:10 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).