riscv: ifunc symbols don't link correctly in RTLD_NOW mode

Gilles Duboscq gilles.m.duboscq@gmail.com
Mon Dec 7 08:51:18 GMT 2020


While looking at some JIT compiler code on riscv, i noticed
__riscv_flush_icache doesn't always work.
It turns out that __riscv_flush_icache is an "ifunc" symbol and such
symbols don't link correctly when they are used from a library opened
with RTLD_NOW on riscv.

Some sample code and a patch are attached to this bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=24868

I ran a headless dev setup with the patch on physical hardware for about a year.
I was reminded of it when I got seemingly impossible SIGILLs due to
the silent failure of __riscv_flush_icache after I inadvertently
updated my glibc to an unpatched version.
I was able to confirm the bug still exists on master from ~1 week ago
(aa69f19) and that the patch still fixes it.

Maybe somebody with more knowledge in this area could take a look at my patch?

Thanks,
 Gilles


More information about the Libc-alpha mailing list