]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/vdso: Fix vdso cpu truncation
authorMilton Miller <miltonm@us.ibm.com>
Wed, 15 Jul 2020 23:37:04 +0000 (09:37 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 16 Jul 2020 03:12:47 +0000 (13:12 +1000)
commit98b93f432d06ba4152094370bb12eaf27bdba728
tree4bc45d6637669d6ae3aa689cb2e347ea12782336
parenteb46b93700ada0843b4dc0c0c00f9d0cabd3c951
powerpc/vdso: Fix vdso cpu truncation

The code in vdso_cpu_init that exposes the cpu and numa node to
userspace via SPRG_VDSO incorrctly masks the cpu to 12 bits. This means
that any kernel running on a box with more than 4096 threads (NR_CPUS
advertises a limit of of 8192 cpus) would expose userspace to two cpu
contexts running at the same time with the same cpu number.

Note: I'm not aware of any distro shipping a kernel with support for more
than 4096 threads today, nor of any system image that currently exceeds
4096 threads. Found via code browsing.

Fixes: 97cb735f45ba0c97538083a377eb8749c84499d9 ("powerpc: Add VDSO version of getcpu")
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200715233704.1352257-1-anton@ozlabs.org
arch/powerpc/kernel/vdso.c