Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 22 Jun 2018 12:26:07 -0700
From: Seth Arnold <seth.arnold@...onical.com>
To: oss-security@...ts.openwall.com
Subject: Re: Intel hyper-threading security issues

On Fri, Jun 22, 2018 at 02:08:03PM +1000, Michael Ellerman wrote:
> See the script below for example, which shows CPUs grouped by core.

> #!/usr/bin/python3
> 
> import os
> import glob
> 
> by_core = {}
> 
> for path in glob.iglob('/sys/devices/system/cpu/cpu*/topology/core_id'):
>     num = int(path.split('/')[5].replace('cpu', ''))
>     core_id = int(open(path).read(), 10)
>     by_core.setdefault(core_id, []).append(num)
> 
> for core in sorted(by_core.keys()):
>     print('%d: %s' % (core, ', '.join([str(s) for s in sorted(by_core[core])])))
> 

Note that this gives misleading results on multi-socket systems:

0: 0, 8, 16, 24
1: 1, 9, 17, 25
2: 2, 10, 18, 26
3: 3, 11, 19, 27
4: 4, 12, 20, 28
5: 5, 13, 21, 29
6: 6, 14, 22, 30
7: 7, 15, 23, 31

This system has two sockets, eight cores per socket, two threads per core.

Solar's cpuinfo reports;
$ ./cpuinfo
Found 32 logical processors across 16 physical cores

Thanks

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

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.