Skip to content

Commit 7cfd310

Browse files
chleroygregkh
authored andcommitted
powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe()
[ Upstream commit a03b1a0 ] Looking at generated code for handle_signal32() shows calls to a function called __unsafe_save_user_regs.constprop.0 while user access is open. And that __unsafe_save_user_regs.constprop.0 function has two nops at the begining, allowing it to be traced, which is unexpected during user access open window. The solution could be to mark __unsafe_save_user_regs() no trace, but to be on the safe side the most efficient is to flag it __always_inline as already done for function __unsafe_restore_general_regs(). The function is relatively small and only called twice, so the size increase will remain in the noise. Do the same with save_tm_user_regs_unsafe() as it may suffer the same issue. Fixes: ef75e73 ("powerpc/signal32: Transform save_user_regs() and save_tm_user_regs() in 'unsafe' version") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/7e469c8f01860a69c1ada3ca6a5e2aa65f0f74b2.1685955220.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent af0c61c commit 7cfd310

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

arch/powerpc/kernel/signal_32.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,9 @@ static void prepare_save_user_regs(int ctx_has_vsx_region)
264264
#endif
265265
}
266266

267-
static int __unsafe_save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
268-
struct mcontext __user *tm_frame, int ctx_has_vsx_region)
267+
static __always_inline int
268+
__unsafe_save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
269+
struct mcontext __user *tm_frame, int ctx_has_vsx_region)
269270
{
270271
unsigned long msr = regs->msr;
271272

@@ -364,8 +365,9 @@ static void prepare_save_tm_user_regs(void)
364365
current->thread.ckvrsave = mfspr(SPRN_VRSAVE);
365366
}
366367

367-
static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame,
368-
struct mcontext __user *tm_frame, unsigned long msr)
368+
static __always_inline int
369+
save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame,
370+
struct mcontext __user *tm_frame, unsigned long msr)
369371
{
370372
/* Save both sets of general registers */
371373
unsafe_save_general_regs(&current->thread.ckpt_regs, frame, failed);
@@ -444,8 +446,9 @@ static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user
444446
#else
445447
static void prepare_save_tm_user_regs(void) { }
446448

447-
static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame,
448-
struct mcontext __user *tm_frame, unsigned long msr)
449+
static __always_inline int
450+
save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *frame,
451+
struct mcontext __user *tm_frame, unsigned long msr)
449452
{
450453
return 0;
451454
}

0 commit comments

Comments
 (0)