lkml.org 
[lkml]   [2014]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.16.y-ckt 028/168] x86: Require exact match for 'noxsave' command line option
    Date
    3.16.7-ckt3 -stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Dave Hansen <dave.hansen@linux.intel.com>

    commit 2cd3949f702692cf4c5d05b463f19cd706a92dd3 upstream.

    We have some very similarly named command-line options:

    arch/x86/kernel/cpu/common.c:__setup("noxsave", x86_xsave_setup);
    arch/x86/kernel/cpu/common.c:__setup("noxsaveopt", x86_xsaveopt_setup);
    arch/x86/kernel/cpu/common.c:__setup("noxsaves", x86_xsaves_setup);

    __setup() is designed to match options that take arguments, like
    "foo=bar" where you would have:

    __setup("foo", x86_foo_func...);

    The problem is that "noxsave" actually _matches_ "noxsaves" in
    the same way that "foo" matches "foo=bar". If you boot an old
    kernel that does not know about "noxsaves" with "noxsaves" on the
    command line, it will interpret the argument as "noxsave", which
    is not what you want at all.

    This makes the "noxsave" handler only return success when it finds
    an *exact* match.

    [ tglx: We really need to make __setup() more robust. ]

    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Dave Hansen <dave@sr71.net>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/20141111220133.FE053984@viggo.jf.intel.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
    ---
    arch/x86/kernel/cpu/common.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
    index ae52a082a01c..1f3a8885f836 100644
    --- a/arch/x86/kernel/cpu/common.c
    +++ b/arch/x86/kernel/cpu/common.c
    @@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);

    static int __init x86_xsave_setup(char *s)
    {
    + if (strlen(s))
    + return 0;
    setup_clear_cpu_cap(X86_FEATURE_XSAVE);
    setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
    setup_clear_cpu_cap(X86_FEATURE_AVX);
    --
    2.1.3


    \
     
     \ /
      Last update: 2014-12-15 16:41    [W:4.029 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site