Re: [PATCH v3 tip:perf/core] perf/amd/ibs: Prevent leaking sensitive data to userspace
From: Ravi Bangoria
Date: Sat Mar 22 2025 - 06:16:57 EST
Hi Ingo,
>> Although IBS "swfilt" can prevent leaking samples with kernel RIP to the
>> userspace, there are few subtle cases where a 'data' address and/or a
>> 'branch target' address can fall under kernel address range although RIP
>> is from userspace. Prevent leaking kernel 'data' addresses by discarding
>> such samples when {exclude_kernel=1,swfilt=1}.
>>
>> IBS can now be invoked by unprivileged user with the introduction of
>> "swfilt". However, this creates a loophole in the interface where an
>> unprivileged user can get physical address of the userspace virtual
>> addresses through IBS register raw dump (PERF_SAMPLE_RAW). Prevent this
>> as well.
>>
>> Fixes: d29e744c7167 ("perf/x86: Relax privilege filter restriction on AMD IBS")
>> Suggested-by: Matteo Rizzo <matteorizzo@xxxxxxxxxx>
>> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
>> Co-developed-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
>> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
>> ---
>> v2: https://lore.kernel.org/r/20250317163755.1842589-1-namhyung@xxxxxxxxxx
>>
>> arch/x86/events/amd/ibs.c | 76 ++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 75 insertions(+), 1 deletion(-)
>
> Since the initial fix is already upstream, I created a delta fix below
> for the PERF_SAMPLE_RAW fixes in -v3.
Thanks! The delta looks good.
> How well was this tested? v6.14 will be released tomorrow most likely,
> so it's a bit risky to apply such a large patch so late. Applying the
> -v1 fix was a bit risky already.
I understand. Although I've done a fair bit of testing and ran perf-
fuzzer for few hours before posting, I'm also not in favor of rushing.
I think it's safe to defer it to 6.15.
Thanks,
Ravi