Hacker News new | ask | show | jobs
by aleden 984 days ago
The GLIBC_TUNABLES can be used to "choose" between different versions of e.g. memcpy at runtime. This can be really useful for debugging, if you want to allow/disallow AVX extensions, for example (even if your CPU supports them). This is what I use on x86_64 to make life easier for my "static" version of qemu usermode:

  GLIBC_TUNABLES=glibc.cpu.hwcaps=
              -AVX
              -AVX2
              -AVX_Usable
              -AVX2_Usable
              -AVX512F_Usable
              -SSE4_1
              -SSE4_2
              -SSSE3
              -Fast_Unaligned_Load
              -ERMS
              -AVX_Fast_Unaligned_Load
2 comments

Does removing ERMS actually make life easier? I thought it was the "do the simple thing" option, and an emulator could just turn it into a memcpy on the emulator's side.
rep movsb has stronger requirements than memcpy, in particular with regards to behavior when the source and destination overlap.
Sounds like a DoS vector at least, even if the filter worked correctly. Why should you be able to disable AVX extensions for another user's process? Why would you debug across SUID boundaries?