diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-09-24 11:18:38 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-09-24 11:18:38 +0000 |
commit | db229aeca27693b33b3422a1cb583e6c068c8876 (patch) | |
tree | b8b01b9cbc13e070f4dc602b6228fb17c74feb0e /sys/arch/i386/include | |
parent | 9dad4670ac02e309a821e43c8ad05853a2ded912 (diff) |
Make sure we fetch the CS limit of the CPU the trap happened on. It is
possible to switch CPUs when handling a trap since we need to lock the vm_map
of the process. In that case the CS limit would be wrong an we incorrectly
decide that there has been an execute privilige violation.
Also make sure we only modify the variables that keep track of the CS
limit and segment descriptor while holding the kernel lock.
Fixes builds of go ports on i386.
tested by sthen@
ok deraadt@
Diffstat (limited to 'sys/arch/i386/include')
-rw-r--r-- | sys/arch/i386/include/pmap.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/segments.h | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h index 1fdf5048130..31bac2eb9de 100644 --- a/sys/arch/i386/include/pmap.h +++ b/sys/arch/i386/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.87 2019/12/19 17:46:32 mpi Exp $ */ +/* $OpenBSD: pmap.h,v 1.88 2020/09/24 11:18:37 kettenis Exp $ */ /* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */ /* @@ -250,7 +250,7 @@ int pmap_test_attrs(struct vm_page *, int); void pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t); int pmap_exec_fixup(struct vm_map *, struct trapframe *, - struct pcb *); + vaddr_t, struct pcb *); void pmap_exec_account(struct pmap *, vaddr_t, u_int32_t, u_int32_t); struct pv_entry *pmap_remove_pv(struct vm_page *, struct pmap *, vaddr_t); diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h index 10a28f8a175..d74c27d307e 100644 --- a/sys/arch/i386/include/segments.h +++ b/sys/arch/i386/include/segments.h @@ -1,4 +1,4 @@ -/* $OpenBSD: segments.h,v 1.26 2018/07/09 19:20:30 guenther Exp $ */ +/* $OpenBSD: segments.h,v 1.27 2020/09/24 11:18:37 kettenis Exp $ */ /* $NetBSD: segments.h,v 1.23 1996/02/01 22:31:03 mycroft Exp $ */ /*- @@ -115,6 +115,8 @@ extern union descriptor *gdt; extern struct gate_descriptor idt_region[]; extern struct gate_descriptor *idt; +#define SEGDESC_LIMIT(sd) (ptoa(((sd).sd_hilimit << 16) | (sd).sd_lolimit)) + void setgate(struct gate_descriptor *, void *, int, int, int, int); void setregion(struct region_descriptor *, void *, size_t); void setsegment(struct segment_descriptor *, void *, size_t, int, int, |