google / tcmalloc

Apache License 2.0
4.31k stars 463 forks source link

Possibly crash with kernel disabling CONFIG_PROC_PID_CPUSET #214

Open yuuzi41 opened 9 months ago

yuuzi41 commented 9 months ago

It assumes that /proc/self/cpuset exists here, https://github.com/google/tcmalloc/blob/537629b16a632bbaaba5f77f31ced7e5fdde30e6/tcmalloc/internal/percpu.cc#L238 but actually this file doesn't exist if kernel has been built with CONFIG_PROC_PID_CPUSET=n.

when /proc/self/cpuset doesn't exist, open() must be failed and variable fd become negative, then it will crash here. https://github.com/google/tcmalloc/blob/537629b16a632bbaaba5f77f31ced7e5fdde30e6/tcmalloc/internal/percpu.cc#L239

ckennelly commented 9 months ago

Does your kernel have support for membarrier with https://github.com/torvalds/linux/commit/2a36ab717e8fe678d98f81c14a0b124712719840 (5.10 or later)?

It should be fairly rare to need to use SlowFence (the procedure where the assertion is failing), but at the point it is needed, it's important for correctness that it complete successfully.

yuuzi41 commented 8 months ago

Thank you for your response.

Does your kernel have support for membarrier with torvalds/linux@2a36ab7 (5.10 or later)?

Yes, It is v5.19.2. Actually I'm about to use https://github.com/envoyproxy/envoy on https://github.com/kata-containers/kata-containers/tree/3.1.3