From: "Chatradhi, Naveen Krishna" <NaveenKrishna.Chatradhi@amd.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Salvatore Bonaccorso <carnil@debian.org>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
"naveenkrishna.ch@gmail.com" <naveenkrishna.ch@gmail.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] hwmon: amd_energy: modify the visibility of the counters
Date: Sun, 22 Nov 2020 16:42:47 +0000 [thread overview]
Message-ID: <DM6PR12MB438839666CD2BA3524D80E24E8FD0@DM6PR12MB4388.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20201122133011.GA48943@roeck-us.net>
[AMD Official Use Only - Approved for External Use]
Hi Guenter,
> A much better fix would have been to cache RAPL data for a short period of time. To avoid any possibility of attacks, maybe add some random interval. Something like this:
Thanks for the tip, I will check this out.
> In accumulate_delta():
> accums->next_update = jiffies + HZ / 2 + get_random_int % HZ;
> In amd_energy_read():
> accum = &data->accums[channel];
> if (time_after(accum->next_update))
Do you mean if (time_after(jiffies, accum->next_update))
> accumulate_delta(data, channel, cpu, reg);
> *val = div64_ul(accum->energy_ctr * 1000000UL, BIT(data->energy_units));
> and drop amd_add_delta().
Regards,
Naveenk
-----Original Message-----
From: Guenter Roeck <linux@roeck-us.net>
Sent: Sunday, November 22, 2020 7:00 PM
To: Chatradhi, Naveen Krishna <NaveenKrishna.Chatradhi@amd.com>
Cc: Salvatore Bonaccorso <carnil@debian.org>; linux-hwmon@vger.kernel.org; naveenkrishna.ch@gmail.com; stable@vger.kernel.org
Subject: Re: [PATCH] hwmon: amd_energy: modify the visibility of the counters
[CAUTION: External Email]
On Sun, Nov 22, 2020 at 06:56:24AM +0000, Chatradhi, Naveen Krishna wrote:
> [AMD Official Use Only - Approved for External Use]
>
> Hi Guenter, Salvatore
>
> > This is very unusual, and may mess up the "sensors" command.
> > What problem is this trying to solve ?
> Guenter, sorry for the delayed response.
> This fix is required to address the possible side channel attack reported in CVE-2020-12912.
>
[ ... ]
>
> >> ?
> Yes, Salvatore, thanks for bringing the links.
>
A much better fix would have been to cache RAPL data for a short period of time. To avoid any possibility of attacks, maybe add some random interval. Something like this:
In accumulate_delta():
accums->next_update = jiffies + HZ / 2 + get_random_int % HZ;
In amd_energy_read():
accum = &data->accums[channel];
if (time_after(accum->next_update))
accumulate_delta(data, channel, cpu, reg);
*val = div64_ul(accum->energy_ctr * 1000000UL, BIT(data->energy_units));
and drop amd_add_delta().
Guenter
next prev parent reply other threads:[~2020-11-22 16:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 17:21 [PATCH] hwmon: amd_energy: modify the visibility of the counters Naveen Krishna Chatradhi
2020-11-12 17:24 ` Guenter Roeck
2020-11-13 13:58 ` Salvatore Bonaccorso
2020-11-13 14:47 ` Guenter Roeck
2020-11-22 6:56 ` Chatradhi, Naveen Krishna
2020-11-22 13:30 ` Guenter Roeck
2020-11-22 16:42 ` Chatradhi, Naveen Krishna [this message]
2020-11-22 18:09 ` Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2020-11-09 9:07 Naveen Krishna Chatradhi
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=DM6PR12MB438839666CD2BA3524D80E24E8FD0@DM6PR12MB4388.namprd12.prod.outlook.com \
--to=naveenkrishna.chatradhi@amd.com \
--cc=carnil@debian.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=naveenkrishna.ch@gmail.com \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).