Skip to content

Commit 5566051

Browse files
committed
Merge tag 'm68k-for-v6.4-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k fix from Geert Uytterhoeven: - Fix signal frame issue causing user-space crashes on 68020/68030 * tag 'm68k-for-v6.4-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Move signal frame following exception on 68020/030
2 parents 933174a + b845b57 commit 5566051

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

arch/m68k/kernel/signal.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,17 @@ static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *
858858
}
859859

860860
static inline void __user *
861-
get_sigframe(struct ksignal *ksig, size_t frame_size)
861+
get_sigframe(struct ksignal *ksig, struct pt_regs *tregs, size_t frame_size)
862862
{
863863
unsigned long usp = sigsp(rdusp(), ksig);
864+
unsigned long gap = 0;
864865

865-
return (void __user *)((usp - frame_size) & -8UL);
866+
if (CPU_IS_020_OR_030 && tregs->format == 0xb) {
867+
/* USP is unreliable so use worst-case value */
868+
gap = 256;
869+
}
870+
871+
return (void __user *)((usp - gap - frame_size) & -8UL);
866872
}
867873

868874
static int setup_frame(struct ksignal *ksig, sigset_t *set,
@@ -880,7 +886,7 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
880886
return -EFAULT;
881887
}
882888

883-
frame = get_sigframe(ksig, sizeof(*frame) + fsize);
889+
frame = get_sigframe(ksig, tregs, sizeof(*frame) + fsize);
884890

885891
if (fsize)
886892
err |= copy_to_user (frame + 1, regs + 1, fsize);
@@ -952,7 +958,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
952958
return -EFAULT;
953959
}
954960

955-
frame = get_sigframe(ksig, sizeof(*frame));
961+
frame = get_sigframe(ksig, tregs, sizeof(*frame));
956962

957963
if (fsize)
958964
err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);

0 commit comments

Comments
 (0)