lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 19 Nov 2020 16:57:22 +0000
From:   Valentin Schneider <valentin.schneider@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Will Deacon <will@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Catalin Marinas <catalin.marinas@....com>,
        Marc Zyngier <maz@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Morten Rasmussen <morten.rasmussen@....com>,
        Qais Yousef <qais.yousef@....com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Quentin Perret <qperret@...gle.com>, Tejun Heo <tj@...nel.org>,
        Li Zefan <lizefan@...wei.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Ingo Molnar <mingo@...hat.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        kernel-team@...roid.com
Subject: Re: [PATCH v3 07/14] sched: Introduce restrict_cpus_allowed_ptr() to limit task CPU affinity


On 19/11/20 16:09, Peter Zijlstra wrote:
> On Thu, Nov 19, 2020 at 01:13:20PM +0000, Will Deacon wrote:
>
>> Sure, but I was talking about what userspace sees, and I don't think it ever
>> sees CPUs that have been hotplugged off, right? That is, sched_getaffinity()
>> masks its result with the active_mask.
>
> # for i in /sys/devices/system/cpu/cpu*/online; do echo -n $i ":"; cat $i; done
> /sys/devices/system/cpu/cpu1/online :0
> /sys/devices/system/cpu/cpu2/online :1
> /sys/devices/system/cpu/cpu3/online :1
> /sys/devices/system/cpu/cpu4/online :1
> /sys/devices/system/cpu/cpu5/online :1
> /sys/devices/system/cpu/cpu6/online :1
> /sys/devices/system/cpu/cpu7/online :1
>
> # grep Cpus_allowed /proc/self/status
> Cpus_allowed:   ff
> Cpus_allowed_list:      0-7
>
>
> :-)

Harumph, so there is that...

$ while true; do continue; done &
$ PID=$!
$ taskset -pc 0-1 $PID
  pid 849's current affinity list: 0-5
  pid 849's new affinity list: 0,1
$ echo 0 > /sys/devices/system/cpu/cpu1/online
  [12578.545726] CPU1: shutdown
  [12578.548454] psci: CPU1 killed (polled 0 ms)
$ taskset -pc $PID
  pid 849's current affinity list: 0
$ cat /proc/$PID/status | grep Cpus
  Cpus_allowed:   03
  Cpus_allowed_list:      0-1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ