Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/d0a05dc608f6
branches:  netbsd-8
changeset: 461218:d0a05dc608f6
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 19 10:50:25 2019 +0000

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

        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 29c1f07f0fce -r d0a05dc608f6 sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c      Tue Nov 19 10:48:15 2019 +0000
+++ b/sys/kern/sys_ptrace_common.c      Tue Nov 19 10:50:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace_common.c,v 1.22.2.6 2019/08/04 11:05:29 martin Exp $        */
+/*     $NetBSD: sys_ptrace_common.c,v 1.22.2.7 2019/11/19 10:50:25 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.22.2.6 2019/08/04 11:05:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.22.2.7 2019/11/19 10:50:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -1506,7 +1506,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