Tuesday, July 25, 2023

Re: arm64 BTI support for mpg123

Christian Weisgerber <naddy@mips.inka.de> wrote:

> Mark Kettenis:
>
> > This port has some infrastructure to use an optimized function that
> > uses a function pointer. Not sure why for arm64 it actually uses that
> > infrastructure, since the only alternative is the generic C
> > implementation. But adding a BTI instruction is the easiest fix.
>
> ok naddy@
>
> The question is whether there are any others hiding in there. How
> did you find this in the first place? It broke on the M2?
>
> Because amd64 should suffer from the same problem:
>
> fr->cpu_opts.the_dct36 = dct36_avx;
> ...
> fr->cpu_opts.the_dct36 = dct36_x86_64;
>
> dct36_avx and dct36_x86_64 are assembly routines that lack the
> endbr64 landing pad. And yet, on my IBT-enabled amd64 laptop,
> mpg123 plays just fine with both the avx and x86_64 decoders.

Maybe it requires specific files to go via those code paths?

Ayways, how will we know all the locations? I think we will eventually
know based upon user reports.

It feels like there is a compilers or linker option missing to proactively
identify these problems. Please don't bring up LTO.

No comments:

Post a Comment