[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171114073408.tir3raeas7ouvyzp@gmail.com>
Date: Tue, 14 Nov 2017 08:34:08 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
Andy Lutomirski <luto@...nel.org>,
Tony Luck <tony.luck@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>, x86@...nel.org,
ricardo.neri@...el.com, linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v2 4/4] x86/umip: Warn if UMIP-protected
instructions are used
* Ricardo Neri <ricardo.neri-calderon@...ux.intel.com> wrote:
> +const char * const umip_insns[5] = {
> + [UMIP_INST_SGDT] = "sgdt",
> + [UMIP_INST_SIDT] = "sidt",
> + [UMIP_INST_SMSW] = "smsw",
> + [UMIP_INST_SLDT] = "sldt",
> + [UMIP_INST_STR] = "str",
> +};
Sigh ...
> +/*
> + * If you change these strings, ensure that buffers using them are sufficiently
> + * large.
> + */
> +static const char umip_warn_use[] = "cannot be used by applications.";
> +static const char umip_warn_emu[] = "For now, expensive software emulation returns result.";
Please use the string literals directly, don't add an extra obfuscation layer.
Plus:
> + unsigned char buf[MAX_INSN_SIZE], warn[128];
> + snprintf(warn, sizeof(warn), "%s %s", umip_insns[umip_inst],
> + umip_warn_use);
This is incredibly fragile against future buffer overflows, and warning about it
in comments does not make it less fragile!
Thanks,
Ingo
Powered by blists - more mailing lists