mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: x86@kernel.org, bp@alien8.de, tglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/cpu/amd: Report zenbleed in sysfs
Date: Sat, 29 Jul 2023 10:24:54 +0300	[thread overview]
Message-ID: <58bde8b7-018c-5f4c-282d-629cfb42515f@suse.com> (raw)
In-Reply-To: <20230728231425.mku5wnsgfzx2kyeo@desk>



On 29.07.23 г. 2:14 ч., Pawan Gupta wrote:
> On Thu, Jul 27, 2023 at 10:54:46AM +0300, Nikolay Borisov wrote:
>> Initial submission of Zenbleed fix omitted reporting the bug in sysfs.
>> There's no reason why it shouldn't be reported so let's add it among
>> the other vulnerabilities.
>>
>> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
>> ---
>>   .../ABI/testing/sysfs-devices-system-cpu          |  1 +
>>   arch/x86/kernel/cpu/amd.c                         | 15 +++++++++++++++
>>   drivers/base/cpu.c                                |  8 ++++++++
>>   include/linux/cpu.h                               |  2 ++
>>   4 files changed, 26 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
>> index ecd585ca2d50..30bb4196e451 100644
>> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
>> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
>> @@ -524,6 +524,7 @@ What:		/sys/devices/system/cpu/vulnerabilities
>>   		/sys/devices/system/cpu/vulnerabilities/itlb_multihit
>>   		/sys/devices/system/cpu/vulnerabilities/mmio_stale_data
>>   		/sys/devices/system/cpu/vulnerabilities/retbleed
>> +		/sys/devices/system/cpu/vulnerabilities/zenbleed
>>   Date:		January 2018
>>   Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
>>   Description:	Information about CPU vulnerabilities
>> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
>> index 26ad7ca423e7..3ab9745eafc5 100644
>> --- a/arch/x86/kernel/cpu/amd.c
>> +++ b/arch/x86/kernel/cpu/amd.c
>> @@ -1279,6 +1279,21 @@ u32 amd_get_highest_perf(void)
>>   }
>>   EXPORT_SYMBOL_GPL(amd_get_highest_perf);
>>   
>> +ssize_t cpu_show_zenbleed(struct device *dev, struct device_attribute *attr, char *buf)
>> +{
>> +
> 
> Extra newline.
> 
>> +	if (!cpu_has_amd_erratum(&boot_cpu_data, amd_zenbleed) ||
>> +	    !boot_cpu_has(X86_FEATURE_AVX) ||
>> +	    boot_cpu_has(X86_FEATURE_HYPERVISOR))
>> +		return sysfs_emit(buf, "Not affected\n");
>> +
>> +	if (!cpu_has_zenbleed_microcode()) {
> 
> For readability this can check of microcode present case, and drop the
> NOT operator.
> 
>> +		return sysfs_emit(buf, "Mitigation: Chickenbit\n");
> 
> Shouldn't this be checking if the chicken bit is set? And if its not set
> then report "Vulnerable".
> 
> But, looking at zenbleed_check() it appear that the chicken bit for
> zenbleed will always be present, and it will always be set if microcode
> is not present.

Yeah, but based on feedback I got from Boris it seems this is not going 
to be merged so it doesn't matter.

> 
>> +	} else {
>> +		return sysfs_emit(buf, "Mitigation: Microcode\n");
>> +	}
>> +}

      reply	other threads:[~2023-07-29  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:54 Nikolay Borisov
2023-07-27  8:00 ` Borislav Petkov
2023-07-28 23:14 ` Pawan Gupta
2023-07-29  7:24   ` Nikolay Borisov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58bde8b7-018c-5f4c-282d-629cfb42515f@suse.com \
    --to=nik.borisov@suse.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®