Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern PR/51277: Fix compat32 coredumping that broke with ...
details: https://anonhg.NetBSD.org/src/rev/5e43d66b1b6b
branches: trunk
changeset: 346116:5e43d66b1b6b
user: christos <christos%NetBSD.org@localhost>
date: Mon Jun 27 01:46:04 2016 +0000
description:
PR/51277: Fix compat32 coredumping that broke with the aux vector note
addition.
diffstat:
sys/kern/core_elf32.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diffs (60 lines):
diff -r e787a8625d16 -r 5e43d66b1b6b sys/kern/core_elf32.c
--- a/sys/kern/core_elf32.c Sun Jun 26 22:50:46 2016 +0000
+++ b/sys/kern/core_elf32.c Mon Jun 27 01:46:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: core_elf32.c,v 1.46 2016/05/24 00:49:56 christos Exp $ */
+/* $NetBSD: core_elf32.c,v 1.47 2016/06/27 01:46:04 christos Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,10 +40,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.46 2016/05/24 00:49:56 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.47 2016/06/27 01:46:04 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_coredump.h"
+#include "opt_compat_netbsd32.h"
#endif
#ifndef ELFSIZE
@@ -405,7 +406,6 @@
struct ps_strings pss;
int error;
struct proc *p = l->l_proc;
- struct vmspace *vm;
void *uauxv, *kauxv;
size_t len;
@@ -415,16 +415,21 @@
if (pss.ps_envstr == NULL)
return EIO;
- vm = p->p_vmspace;
- uvmspace_addref(vm);
+ len = p->p_execsw->es_arglen;
+#ifdef COMPAT_NETBSD32
+ if (p->p_flag & PK_32) {
+ uauxv = (void *)((char *)pss.ps_envstr
+ + (pss.ps_nenvstr + 1) * sizeof(int32_t));
+ len *= sizeof(int32_t);
+ } else
+#endif
+ {
+ uauxv = (void *)(pss.ps_envstr + pss.ps_nenvstr + 1);
+ len *= sizeof(char *);
+ }
- len = p->p_execsw->es_arglen * sizeof(char *);
- uauxv = (void *)(pss.ps_envstr + pss.ps_nenvstr + 1);
kauxv = kmem_alloc(len, KM_SLEEP);
- error = copyin_vmspace(vm, uauxv, kauxv, len);
-
- uvmspace_free(vm);
-
+ error = copyin_proc(p, uauxv, kauxv, len);
if (error == 0) {
ELFNAMEEND(coredump_savenote)(ns, ELF_NOTE_NETBSD_CORE_AUXV,
ELF_NOTE_NETBSD_CORE_NAME, kauxv, len);
Home |
Main Index |
Thread Index |
Old Index