Arch Linux - Fixing segfaults with Skylake in glibc

There have been some problems with Skylake processors segfaulting (usually with media applications). On my i7 6700k, for example, I get this when trying to start VLC:

VLC media player 2.2.1 Terry Pratchett (Weatherwax) (revision 2.2.1-0-ga425c42)
Segmentation fault (core dumped)

Tracking down the segfault leads to somewhere in glibc. At first I thought it was the NVIDIA driver since it crashes there, but it's actually more likely an issue with the microcode in the cpu. See:

Fixing it

Just recompile glibc with lock elision disabled. Whenever there is a glibc update I just run this script to rebuild it. It'll take awhile if you haven't setup makepkg to use multiple cores.

sh
#!/bin/sh

sudo abs
rm -rf /tmp/glibc
mkdir /tmp/glibc
pushd /tmp/glibc
cp -r /var/abs/core/glibc .
sed -i '/--enable-lock-elision/d' glibc/PKGBUILD
cd glibc
makepkg -ci
popd

As usual you may need to import missing keys into your keyring to build.