]> git.baikalelectronics.ru Git - kernel.git/commit
s390/ftrace: fix arch_ftrace_get_regs implementation
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 22 Feb 2022 13:53:47 +0000 (14:53 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 1 Mar 2022 19:41:28 +0000 (20:41 +0100)
commitb2c5ade187e9e5b93d48f1333f6f3e0af7cd011b
tree5ab2532ac948879baad3422c400d3c70482cd0c5
parentf78101f57e8727eb8583e30aac9301507ce535a7
s390/ftrace: fix arch_ftrace_get_regs implementation

arch_ftrace_get_regs is supposed to return a struct pt_regs pointer
only if the pt_regs structure contains all register contents, which
means it must have been populated when created via ftrace_regs_caller.

If it was populated via ftrace_caller the contents are not complete
(the psw mask part is missing), and therefore a NULL pointer needs be
returned.

The current code incorrectly always returns a struct pt_regs pointer.

Fix this by adding another pt_regs flag which indicates if the
contents are complete, and fix arch_ftrace_get_regs accordingly.

Fixes: 65b88d4755f2 ("s390/ftrace: provide separate ftrace_caller/ftrace_regs_caller implementations")
Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reported-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/ftrace.h
arch/s390/include/asm/ptrace.h
arch/s390/kernel/ftrace.c
arch/s390/kernel/mcount.S