Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Revert previous.



details:   https://anonhg.NetBSD.org/src/rev/6ffc8ae2e332
branches:  trunk
changeset: 352384:6ffc8ae2e332
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Mar 29 22:48:03 2017 +0000

description:
Revert previous.

Pointed out by Christous Zoulas that ELF_AUX_ENTRIES * sizeof(AuxInfo)
assumption is incomplete. There is emulation code that can use different
values (smaller and larger).

diffstat:

 sys/kern/core_elf32.c        |  6 +++---
 sys/kern/sys_ptrace_common.c |  7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r b81d2a2144ad -r 6ffc8ae2e332 sys/kern/core_elf32.c
--- a/sys/kern/core_elf32.c     Wed Mar 29 20:08:40 2017 +0000
+++ b/sys/kern/core_elf32.c     Wed Mar 29 22:48:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: core_elf32.c,v 1.52 2017/03/29 19:52:30 kamil Exp $    */
+/*     $NetBSD: core_elf32.c,v 1.53 2017/03/29 22:48:03 kamil Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.52 2017/03/29 19:52:30 kamil Exp $");
+__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.53 2017/03/29 22:48:03 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_coredump.h"
@@ -416,7 +416,7 @@
 
        size_t ptrsz = PROC_PTRSZ(p);
        uauxv = (void *)((char *)pss.ps_envstr + (pss.ps_nenvstr + 1) * ptrsz);
-       size_t len = ELF_AUX_ENTRIES * sizeof(AuxInfo);
+       size_t len = p->p_execsw->es_arglen;
 
        kauxv = kmem_alloc(len, KM_SLEEP);
        error = copyin_proc(p, uauxv, kauxv, len);
diff -r b81d2a2144ad -r 6ffc8ae2e332 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Wed Mar 29 20:08:40 2017 +0000
+++ b/sys/kern/sys_ptrace_common.c      Wed Mar 29 22:48:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.19 2017/03/29 19:52:30 kamil Exp $     */
+/*     $NetBSD: sys_ptrace_common.c,v 1.20 2017/03/29 22:48:03 kamil Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.19 2017/03/29 19:52:30 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.20 2017/03/29 22:48:03 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -129,7 +129,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
-#include <sys/exec_elf.h>
 #include <sys/errno.h>
 #include <sys/exec.h>
 #include <sys/pax.h>
@@ -625,7 +624,7 @@
                case PIOD_READ_AUXV:
                        req = PT_READ_D;
                        uio.uio_rw = UIO_READ;
-                       tmp = ELF_AUX_ENTRIES * sizeof(AuxInfo);
+                       tmp = t->p_execsw->es_arglen;
                        if (uio.uio_offset > tmp)
                                return EIO;
                        if (uio.uio_resid > tmp - uio.uio_offset)



Home | Main Index | Thread Index | Old Index