• Anthony Steinhauser's avatar
    x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches. · 4d8df8cb
    Anthony Steinhauser authored
    Currently, it is possible to enable indirect branch speculation even after
    it was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the
    PR_GET_SPECULATION_CTRL command gives afterwards an incorrect result
    (force-disabled when it is in fact enabled). This also is inconsistent
    vs. STIBP and the documention which cleary states that
    PR_SPEC_FORCE_DISABLE cannot be undone.
    
    Fix this by actually enforcing force-disabled indirect branch
    speculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails
    with -EPERM as described in the documentation.
    
    Fixes: 9137bb27 ("x86/speculation: Add prctl() control for indirect branch speculation")
    Signed-off-by: default avatarAnthony Steinhauser <asteinhauser@google.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: stable@vger.kernel.org
    4d8df8cb
bugs.c 46.1 KB