From 2e3294cd04ba8ce186472fcad21465d1c7143f2a Mon Sep 17 00:00:00 2001 From: Michal Meloun Date: Sun, 27 Sep 2020 11:37:17 +0000 Subject: [PATCH] Don't send a signal with uninitialized 'sig' and 'code' fields. We have a few shortcuts in the arm trap code to speed up obvious "must fail" cases. In these situations, make sure that we fill in the "sig" and "code" fields of the generated signal. MFC after: 3 weeks --- sys/arm/arm/trap-v6.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c index 7ade224f949..e35187da6d0 100644 --- a/sys/arm/arm/trap-v6.c +++ b/sys/arm/arm/trap-v6.c @@ -464,8 +464,11 @@ abort_handler(struct trapframe *tf, int prefetch) /* * Don't allow user-mode faults in kernel address space. */ - if (usermode) + if (usermode) { + ksig.sig = SIGSEGV; + ksig.code = SEGV_ACCERR; goto nogo; + } map = kernel_map; } else { @@ -474,8 +477,11 @@ abort_handler(struct trapframe *tf, int prefetch) * is NULL or curproc->p_vmspace is NULL the fault is fatal. */ vm = (p != NULL) ? p->p_vmspace : NULL; - if (vm == NULL) + if (vm == NULL) { + ksig.sig = SIGSEGV; + ksig.code = 0; goto nogo; + } map = &vm->vm_map; if (!usermode && (td->td_intr_nesting_level != 0 || -- 2.45.0