]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390: Initialize psw mask in perf_arch_fetch_caller_regs()
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 10 Oct 2024 15:52:39 +0000 (17:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Nov 2024 01:02:30 +0000 (02:02 +0100)
[ Upstream commit 223e7fb979fa06934f1595b6ad0ae1d4ead1147f ]

Also initialize regs->psw.mask in perf_arch_fetch_caller_regs().
This way user_mode(regs) will return false, like it should.

It looks like all current users initialize regs to zero, so that this
doesn't fix a bug currently. However it is better to not rely on callers
to do this.

Fixes: 914d52e46490 ("s390: implement perf_arch_fetch_caller_regs")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/include/asm/perf_event.h

index 9917e2717b2b42378aa25bc29ff8d0ebc82cc7d7..66aff768f8151da0595318251637490c519ffe56 100644 (file)
@@ -73,6 +73,7 @@ struct perf_sf_sde_regs {
 #define SAMPLE_FREQ_MODE(hwc)  (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FREQ_MODE)
 
 #define perf_arch_fetch_caller_regs(regs, __ip) do {                   \
+       (regs)->psw.mask = 0;                                           \
        (regs)->psw.addr = (__ip);                                      \
        (regs)->gprs[15] = (unsigned long)__builtin_frame_address(0) -  \
                offsetof(struct stack_frame, back_chain);               \