Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by rin ...



details:   https://anonhg.NetBSD.org/src/rev/053c4808f6a9
branches:  netbsd-9
changeset: 963288:053c4808f6a9
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 19 13:22:01 2019 +0000

description:
Pull up following revision(s) (requested by rin in ticket #455):

        sys/kern/sys_ptrace_common.c: revision 1.72

Fix pointer arithmetic for 32-bit process on LP64 kernel in
process_auxv_offset().

Now, PIOD_READ_AUXV works fine with COMPAT_NETBSD32.

XXX
pullup to netbsd-9 and netbsd-8

diffstat:

 sys/kern/sys_ptrace_common.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r a19d18aa5796 -r 053c4808f6a9 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Tue Nov 19 13:20:07 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c      Tue Nov 19 13:22:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.58.2.10 2019/11/11 17:11:07 martin Exp $       */
+/*     $NetBSD: sys_ptrace_common.c,v 1.58.2.11 2019/11/19 13:22:01 martin 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.58.2.10 2019/11/11 17:11:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.11 2019/11/19 13:22:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -1635,7 +1635,15 @@
        if (pss.ps_envstr == NULL)
                return EIO;
 
-       uio->uio_offset += (off_t)(vaddr_t)(pss.ps_envstr + pss.ps_nenvstr + 1);
+#ifdef COMPAT_NETBSD32
+       if (p->p_flag & PK_32)
+               uio->uio_offset += (off_t)((vaddr_t)pss.ps_envstr +
+                   sizeof(uint32_t) * (pss.ps_nenvstr + 1));
+       else
+#endif
+               uio->uio_offset += (off_t)(vaddr_t)(pss.ps_envstr +
+                   pss.ps_nenvstr + 1);
+
 #ifdef __MACHINE_STACK_GROWS_UP
        if (uio->uio_offset < off)
                return EIO;



Home | Main Index | Thread Index | Old Index