Discussion in 'all things UNIX' started by amarildojr, Dec 24, 2015.

  1. amarildojr

    amarildojr Registered Member

    Aug 8, 2013
    Recently I've been unable to exit X-Plane because by doing so my entire system will freeze. No Ctrl+Alt+F1, no Ctrl+Alt+Del, nothing solves it. The worse part is that my X-Plane's Log.txt has no information of the problem as the last lines are always "shutting down".

    I suspect of three main causes: either Firejail's problem; grsecurity's problem; or X-Plane's problem. Or all together.

    Things to consider about Firejail:

    Firejail was my first suspicion (although not likely) because it has had a history or problems related to pulseaudio, in which applications would crash because of pulseaudio. This isn't a Firejail bug, but a pulseaudio bug.

    However, I already applied the fix, and X-Plane is the only program with problems.

    Things to consider about GRSecurity:

    I haven't had any problems with grsec and programs in the past. I always disable the "MPROTEC" Kernel protection that stops programs from injecting new executable code into the memory. This protection only works at START, when programs are opened, and NOT when they exit.

    However, even after disabling all kernel protections for X-Plane (PEMRS), the Sim still crashes my system at exit.

    However (2), there are these interesting lines at journalctl:

    Dec 24 15:36:26 amarildo kernel: RIP  [<ffffffff8b0b1238>] mutex_optimistic_spin+0x48/0x1c0
    Dec 24 15:36:26 amarildo kernel:  RSP <ffffc90007cab820>
    Dec 24 15:36:26 amarildo kernel: ---[ end trace ff9d409d9db085d8 ]---
    Dec 24 15:36:26 amarildo kernel: grsec: banning user with uid 1000 until system restart for suspicious kernel crash
    Dec 24 15:36:26 amarildo kernel: Fixing recursive fault but reboot is needed!
    -- Reboot --
    This could indicate that GRSecurity is picking illegal activities comming from X-Plane.

    Another thing to consider is that this could be a grsecurity problem, although not likely. I can't be 100% sure about this, but this problem started to happen after this recent GRSec Kernel. The older one, which I don't remember the number but is easy to track down, worked OK.
    However, why would only X-Plane have problems with it?

    Also, I'm not sure X-Plane is compatible with Kernel 4.3.3.

    Things to consider about X-Plane:

    I also noticed my firewall picking up UDP traffic trying to come in while I played X-Plane. This traffic is DENIED, only selected ports are allowed to function.

    Here's the journalctl lines (there are hundreds of these):

    15:35:38 amarildo kernel: RULE 21 -- DENY IN= OUT=enp0s7 SRC=187.XXX.XXX.XX DST= LEN=58 TOS=0x00 PREC=0x00 TTL=1 ID=48105
    Here is the Firewall line that says "after the allowed traffic, all other attempts are denied":

    # ALL UDP
    iptables -N RULE_21
    iptables -A OUTPUT -p udp -m udp  -j RULE_21
    iptables -A INPUT -p udp -m udp  -j RULE_21
    iptables -A RULE_21  -j LOG  --log-level info --log-prefix "RULE 21 -- DENY "
    iptables -A RULE_21  -j DROP

    My Setup:

    - Arch Linux, fully up-to-date;
    - X-Plane running from Steam, all files verified to be intact;
    - Radeon drivers. Using "--force_run" command. These drivers have better performance than proprietary Catalyst;
    - AMD R9 270X;
    - Kernel: Linux amarildo #1 SMP PREEMPT Wed Dec 23 02:03:09 EST 2015 x86_64 GNU/Linux;
    - MATE Desktop Environment;
    - KDE 5 is installed too, though I rarely use it;

    [root@amarildo ~]# pacman -Qs mesa
    local/glu 9.0.0-4
        Mesa OpenGL Utility library
    local/lib32-glu 9.0.0-3
        Mesa OpenGL utility library (32 bits)
    local/lib32-libtxc_dxtn 1.0.1-5
        S3 Texture Compression (S3TC) library for Mesa (32-bit)
    local/lib32-mesa 11.1.0-1
        an open-source implementation of the OpenGL specification (32-bit)
    local/lib32-mesa-libgl 11.1.0-1
        Mesa 3-D graphics library (32-bit)
    local/lib32-mesa-vdpau 11.1.0-1
        Mesa VDPAU drivers (32-bit)
    local/libtxc_dxtn 1.0.1-6
        S3 Texture Compression (S3TC) library for Mesa
    local/mesa 11.1.0-1
        an open-source implementation of the OpenGL specification
    local/mesa-libgl 11.1.0-1
        Mesa 3-D graphics library
    local/mesa-vdpau 11.1.0-1
        Mesa VDPAU drivers
    [root@amarildo ~]#
    I'm copying a few things ATM, but at the end I'll make my system crash again. Then, I'll post the Log.txt so you guys can look at it.

    The last thing to consider:

    This is my second system install since the problem. After re-installing the system once, I tried to reproduce the problem: Having multiple firejail sandboxes opened, grsec in place with only the MPROTEC disabled for X-Plane, etc. Didn't happen, the Sim ran fine. Somewhere, after re-installing the system again, something must have caused this to happen, either a program or a configuration, I don't know. I'll re-install everything again and try to see where the problem is. This will take several hours so I appreciate your help in the mean time.

  2. amarildojr

    amarildojr Registered Member

    Aug 8, 2013
    Interesting. I always do backups of my MBR's. After zeroing my drive a new partition table and label were created, different from the ones that were used when I made backups of X-Plane. I edited my disk label with fdisk to match the previous one, and now it's not crashing. I wouldn't think X-Plane has this kind of DRM, I mean, it should use Steam's DRM.

    I can't confirm that this is the fix.
  3. Gullible Jones

    Gullible Jones Registered Member

    May 16, 2013
    I'm guessing that X-Plane is doing something that causes a kernel oops, and GrSec is crashing things to prevent the "possible compromise." GrSec does that a lot, in my experience, when you try to use x86 virtualization/3D acceleration/anything else that works close to the hardware.

    But really, who even knows. 3D acceleration is widely known as a source of dangerous code, on Linux and probably on every platform. And I've yet to see 3D support that was stable enough for gaming on any Linux kernel, any Linux userland, or any Linux-supporting hardware. Seriously, 3D on Linux/X11 is a broken mess.

    I really do wish I could offer a solution. But if you're going to run 3D games on Linux, under a GrSec kernel, the fact is you will get crashes from time to time.
  4. amarildojr

    amarildojr Registered Member

    Aug 8, 2013
    Well, X-Plane is actually a 64 bit Simulator. And to be honest, it's the only program crashing, every other game/program is running perfectly fine under GRSecurity. For some I have to disable MPROTECT but that's fine, grsec automatically does that to some KDE stuff, VLC, etc. It's not the end of the world for non-Malicious software.

    About 3D. I can't complain, mesa is doing a really good job. It's performance on Linux is (for me) the same as on Windows, sometimes better.

    Merry Christmas ;)
  5. amarildojr

    amarildojr Registered Member

    Aug 8, 2013
    Yesterday I noticed X-Plane didn't crash, but Pulse did. So I guess this is a combo of the three after all: Firejail and Pulseaudio get in conflict, X-Plane might need something from Pulse and doesn't find it, so it makes an illegal action in the eyes of GRSecurity, and I get screwed.

    I'll re-install the system from scratch. I decided to ditch Firejail completely and will now use KVM for virtual machines/sandboxing (with qemu).

    I'm not sure this thread is solved so I'm not marking it as so at this moment. We'll see how it goes.
  6. driekus

    driekus Registered Member

    Nov 30, 2014
    I really should make it to the Unix section more often. Didnt even know about GRSecurity, X-Plane and Firejail.

    Where have I been living. :)
  7. amarildojr

    amarildojr Registered Member

    Aug 8, 2013

    The problem seem to be in the radeon code, according to grsecurity developers. I'm waiting to see if they'll release a fix soon. I REALLY don't want to go to Debian to use Catalyst.
Similar Threads
  1. aigle