/sys/devices/system/cpu/possible is immutable?

Junyeong Jeong esrse.jeong at gmail.com
Thu Mar 18 11:45:07 EDT 2021


>
> That sysfs value itself will not change for the single system while the
> kernel is running, but your program could be moved from a system with
> one value for that file, to another system with a different value while
> it is running without knowing that you were migrated.
>

Running process migration to another system? Wow, I never knew that.
If migration happens between the time of reading
/sys/devices/system/cpu/possible and the time of calling
`bpf_lookup_elem`, TOCTOU(Time of check to Time of Use) problem would
arise. HaHa.

> So be careful here, and use the "normal" api to deal with cpu values and
> numbers, never assume that once you start, that the number of cpus your
> program has access to will not change.

Thank you Kroah-Hartman for your advice.

regards,
Junyeong



More information about the Kernelnewbies mailing list