Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Fix sysctl(3):vm.minaddress in compat_ne...



details:   https://anonhg.NetBSD.org/src/rev/c6c57895e220
branches:  trunk
changeset: 322980:c6c57895e220
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat May 26 21:07:47 2018 +0000

description:
Fix sysctl(3):vm.minaddress in compat_netbsd32(8)

Cast minaddress from LP64-specific long (64-bit) to 32-bit long (int).

This value is usually 0 or 0+PAGE_SIZE. There is need to change type in
order to keep original code functional, without prompting the value with
'long long' or a similar approach.


There are more CTLTYPE_LONG with a need for fixes in the compat code:

uipc_usrreq.c
1975 CTLTYPE_LONG, "sendspace",
1981 CTLTYPE_LONG, "recvspace",
1987 CTLTYPE_LONG, "sendspace",
1993 CTLTYPE_LONG, "recvspace",
vfs_bio.c
1921 CTLTYPE_LONG, "bufmem",
1928 CTLTYPE_LONG, "bufmem_lowater",
1935 CTLTYPE_LONG, "bufmem_hiwater",

Sponsored by <The NetBSD Foundation>

diffstat:

 sys/compat/netbsd32/netbsd32_sysctl.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 78a20bca5e42 -r c6c57895e220 sys/compat/netbsd32/netbsd32_sysctl.c
--- a/sys/compat/netbsd32/netbsd32_sysctl.c     Sat May 26 20:27:48 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_sysctl.c     Sat May 26 21:07:47 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $       */
+/*     $NetBSD: netbsd32_sysctl.c,v 1.40 2018/05/26 21:07:47 kamil Exp $       */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.40 2018/05/26 21:07:47 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -153,6 +153,12 @@
                       SYSCTL_DESCR("Maximum user address"),
                       NULL, VM_MAXUSER_ADDRESS32, NULL, 0,
                       CTL_VM, VM_MAXADDRESS, CTL_EOL);
+       sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLTYPE_INT, "minaddress",
+                      SYSCTL_DESCR("Minimum user address"),
+                      NULL, VM_MIN_ADDRESS, NULL, 0,
+                      CTL_VM, VM_MINADDRESS, CTL_EOL);
 
        sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
                       CTLFLAG_PERMANENT,



Home | Main Index | Thread Index | Old Index