Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/arch/sparc/sparc Pull up following revision(s) (reque...
details: https://anonhg.NetBSD.org/src/rev/5a135afbfddd
branches: netbsd-9
changeset: 963910:5a135afbfddd
user: martin <martin%NetBSD.org@localhost>
date: Mon May 25 17:12:26 2020 +0000
description:
Pull up following revision(s) (requested by kamil in ticket #926):
sys/arch/sparc/sparc/process_machdep.c: revision 1.20
Reject setting unaligned Program Counter
Patch taken from OpenBSD.
Tested in qemu.
Fixes PR port-sparc/54734 by Andreas Gustafsson
diffstat:
sys/arch/sparc/sparc/process_machdep.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (38 lines):
diff -r e4809709cd83 -r 5a135afbfddd sys/arch/sparc/sparc/process_machdep.c
--- a/sys/arch/sparc/sparc/process_machdep.c Mon May 25 17:06:52 2020 +0000
+++ b/sys/arch/sparc/sparc/process_machdep.c Mon May 25 17:12:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.19 2016/12/30 17:54:43 christos Exp $ */
+/* $NetBSD: process_machdep.c,v 1.19.20.1 2020/05/25 17:12:26 martin Exp $ */
/*
* Copyright (c) 1993 The Regents of the University of California.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.19 2016/12/30 17:54:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.19.20.1 2020/05/25 17:12:26 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -122,6 +122,9 @@
{
int psr = l->l_md.md_tf->tf_psr & ~PSR_ICC;
+ if (((regs->r_pc | regs->r_npc) & 0x03) != 0)
+ return EINVAL;
+
memcpy(l->l_md.md_tf, regs, sizeof(*regs));
l->l_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC);
return 0;
@@ -140,6 +143,9 @@
process_set_pc(struct lwp *l, void *addr)
{
+ if (((u_int)addr & 0x03) != 0)
+ return EINVAL;
+
l->l_md.md_tf->tf_pc = (u_int)addr;
l->l_md.md_tf->tf_npc = (u_int)addr + 4;
return 0;
Home |
Main Index |
Thread Index |
Old Index