Skip to content
  • Chang S. Bae's avatar
    x86/fsgsbase/64: Fix the base write helper functions · 87ab4689
    Chang S. Bae authored
    Andy spotted a regression in the fs/gs base helpers after the patch series
    was committed. The helper functions which write fs/gs base are not just
    writing the base, they are also changing the index. That's wrong and needs
    to be separated because writing the base has not to modify the index.
    
    While the regression is not causing any harm right now because the only
    caller depends on that behaviour, it's a guarantee for subtle breakage down
    the road.
    
    Make the index explicitly changed from the caller, instead of including
    the code in the helpers.
    
    Subsequently, the task write helpers do not handle for the current task
    anymore. The range check for a base value is also factored out, to minimize
    code redundancy from the caller.
    
    Fixes: b1378a56
    
     ("x86/fsgsbase/64: Introduce FS/GS base helper functions")
    Suggested-by: default avatarAndy Lutomirski <luto@kernel.org>
    Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Reviewed-by: default avatarAndy Lutomirski <luto@kernel.org>
    Cc: "H . Peter Anvin" <hpa@zytor.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Ravi Shankar <ravi.v.shankar@intel.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Link: https://lkml.kernel.org/r/20181126195524.32179-1-chang.seok.bae@intel.com
    87ab4689