[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v5] xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself



>>> On 02.09.16 at 10:20, <he.chen@xxxxxxxxxxxxxxx> wrote:
> +/* smep: Enable/disable Supervisor Mode Execution Protection (default on). */
> +#define SMEP_HVM_ONLY (-1)
> +static s8 __initdata opt_smep = 1;
> +static void __init parse_smep_param(char *s)
> +{
> +    if ( !parse_bool(s) )
> +    {
> +        opt_smep = 0;
> +    }
> +    else if ( !strcmp(s, "hvm") )
> +    {
> +        opt_smep = SMEP_HVM_ONLY;
> +    }
> +
> +    if ( opt_smep == 1 )
> +        __set_bit(X86_FEATURE_XEN_SMEP, boot_cpu_data.x86_capability);
> +}
> +custom_param("smep", parse_smep_param);

The pointless braces are still there, and it still doesn't look like e.g.
"smep=0 smep=1" would work. Did you take the time to look at
other callers of parse_bool()?

And then - I'm sorry for not having noticed before - setting the
feature flag here means it won't get set if no "smep=" was given.
I.e. you rather want to move that ...

> @@ -1403,12 +1433,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>  
>      if ( !opt_smep )
>          setup_clear_cpu_cap(X86_FEATURE_SMEP);

... around here.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.