powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
authorMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Wed, 21 Mar 2018 11:40:25 +0000 (17:10 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:43 +0000 (07:50 +0200)
commit0ebbbeb8c4651c3566028df308d8b53b09105e3e
treeabae9e0937f8d38e6b9b9c2822cba3bdb4515fd3
parent2a48e89c37bf60872a297cf584544826a44c29b7
powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer

[ Upstream commit bb19af816025d495376bd76bf6fbcf4244f9a06d ]

The current Branch History Rolling Buffer (BHRB) code does not check
for any privilege levels before updating the data from BHRB. This
could leak kernel addresses to userspace even when profiling only with
userspace privileges. Add proper checks to prevent it.

Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/perf/core-book3s.c