Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 21 Jun 2018 14:50:49 +0200
From: Solar Designer <>
Subject: Re: Intel hyper-threading security issues

On Thu, Jun 21, 2018 at 01:54:16PM +0200, Sven Schwedas wrote:
> On 2018-06-21 12:28, Lukas Odzioba wrote:
> > Or use cpu hotplug mechanism, which should be way more convenient:
> >
> Hotplug doesn't seem differentiate between HT threads and physical
> cores,

This isn't exactly the question to ask: first vs. second thread in a
core aren't any different, neither of them is "the physical core" unless
you choose not to use the other.

And you can obtain the needed information from /proc/cpuinfo or
/sys/devices/system/cpu/cpu*/topology/* to choose which logical CPUs you
disable (so that you leave only one per physical core).

On a related note, attached is a generic Linux /proc/cpuinfo parser I
wrote a couple of years ago for SMT-aware thread affinity settings in a
userspace program.  This can be used e.g. by a program not wanting to
run trusted vs. untrusted threads on the same physical core, or on the
same physical CPU chip if there's more than one.  It can also be used
for performance optimization.  Please feel free to reuse.

> will setting maxcpus=2 on a 2 cores+HT machine reliably disable
> HT, or can it disable one core and keep HT active on the other?

The latter.  It's not reliable, except maybe on a specific machine with
a specific kernel version.


View attachment "cpuinfo.h" of type "text/x-c" (1303 bytes)

View attachment "cpuinfo.c" of type "text/x-c" (3804 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.