Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Fix SS_ONSTACK, which seems like broken sin...
details: https://anonhg.NetBSD.org/src/rev/6b74f26a5660
branches: trunk
changeset: 934958:6b74f26a5660
user: rin <rin%NetBSD.org@localhost>
date: Sun Jun 21 00:00:27 2020 +0000
description:
Fix SS_ONSTACK, which seems like broken since switched to siginfo.
Found by tests/lib/libc/sys/t_sigaltstack, which passes now, while
no other tests are not falling newly.
XXX
Shouldn't we turn _UC_{SET,CLR}STACK into MI?
diffstat:
sys/arch/powerpc/include/mcontext.h | 4 +++-
sys/arch/powerpc/powerpc/sig_machdep.c | 14 ++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diffs (67 lines):
diff -r 7fb9751cea3d -r 6b74f26a5660 sys/arch/powerpc/include/mcontext.h
--- a/sys/arch/powerpc/include/mcontext.h Sat Jun 20 21:58:17 2020 +0000
+++ b/sys/arch/powerpc/include/mcontext.h Sun Jun 21 00:00:27 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.18 2018/02/15 15:53:56 kamil Exp $ */
+/* $NetBSD: mcontext.h,v 1.19 2020/06/21 00:00:27 rin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -131,6 +131,8 @@
#define _UC_POWERPC_VEC 0x00010000 /* Vector Register File valid */
#define _UC_POWERPC_SPE 0x00020000 /* Vector Register File valid */
#define _UC_TLSBASE 0x00080000 /* thread context valid in R2 */
+#define _UC_SETSTACK 0x00100000
+#define _UC_CLRSTACK 0x00200000
#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_R1])
#define _UC_MACHINE_FP(uc) ((uc)->uc_mcontext.__gregs[_REG_R31])
diff -r 7fb9751cea3d -r 6b74f26a5660 sys/arch/powerpc/powerpc/sig_machdep.c
--- a/sys/arch/powerpc/powerpc/sig_machdep.c Sat Jun 20 21:58:17 2020 +0000
+++ b/sys/arch/powerpc/powerpc/sig_machdep.c Sun Jun 21 00:00:27 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.48 2020/04/11 09:15:23 rin Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.49 2020/06/21 00:00:27 rin Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.48 2020/04/11 09:15:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.49 2020/06/21 00:00:27 rin Exp $");
#include "opt_ppcarch.h"
#include "opt_altivec.h"
@@ -91,6 +91,8 @@
/* Save register context. */
memset(&uc, 0, sizeof(uc));
uc.uc_flags = _UC_SIGMASK;
+ uc.uc_flags |= (ss->ss_flags & SS_ONSTACK) ?
+ _UC_SETSTACK : _UC_CLRSTACK;
uc.uc_sigmask = *mask;
uc.uc_link = l->l_ctxlink;
sendsig_reset(l, ksi->ksi_signo);
@@ -199,6 +201,7 @@
{
struct trapframe * const tf = l->l_md.md_utf;
const __greg_t * const gr = mcp->__gregs;
+ struct proc * const p = l->l_proc;
int error;
/* Restore GPR context, if any. */
@@ -261,6 +264,13 @@
vec_restore_from_mcontext(l, mcp);
#endif
+ mutex_enter(p->p_lock);
+ if (flags & _UC_SETSTACK)
+ l->l_sigstk.ss_flags |= SS_ONSTACK;
+ if (flags & _UC_CLRSTACK)
+ l->l_sigstk.ss_flags &= ~SS_ONSTACK;
+ mutex_exit(p->p_lock);
+
return (0);
}
Home |
Main Index |
Thread Index |
Old Index