CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: christos Date: Sat Oct 6 00:17:06 UTC 2018 Modified Files: src/sys/rump/librump/rumpkern: emul.c Log Message: add get_expose_address() To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/emul.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.187 src/sys/rump/librump/rumpkern/emul.c:1.188 --- src/sys/rump/librump/rumpkern/emul.c:1.187 Fri Oct 5 05:51:55 2018 +++ src/sys/rump/librump/rumpkern/emul.c Fri Oct 5 20:17:06 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.187 2018/10/05 09:51:55 hannken Exp $ */ +/* $NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.187 2018/10/05 09:51:55 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $"); #include #include @@ -402,3 +402,9 @@ cpu_getmodel(void) return "rumpcore (virtual)"; } + +bool +get_expose_address(struct proc *p) +{ + return 1; +}
CVS commit: src/share/man/man7
Module Name:src Committed By: christos Date: Fri Oct 5 22:16:51 UTC 2018 Modified Files: src/share/man/man7: sysctl.7 Log Message: document kern.expose_address To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/share/man/man7/sysctl.7 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.131 src/share/man/man7/sysctl.7:1.132 --- src/share/man/man7/sysctl.7:1.131 Thu Sep 6 06:09:29 2018 +++ src/share/man/man7/sysctl.7 Fri Oct 5 18:16:50 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: sysctl.7,v 1.131 2018/09/06 10:09:29 maxv Exp $ +.\" $NetBSD: sysctl.7,v 1.132 2018/10/05 22:16:50 christos Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" -.Dd September 6, 2018 +.Dd October 5, 2018 .Dt SYSCTL 7 .Os .Sh NAME @@ -293,6 +293,7 @@ privilege may change the value. .It kern.domainname string yes .It kern.drivers struct kinfo_drivers no .It kern.dump_on_panic integer yes +.It kern.expose_address integer yes .It kern.file struct file no .It kern.forkfsleep integer yes .It kern.fscale integer no @@ -513,6 +514,16 @@ field is always a NUL terminated string. The .Va d_bmajor field will be set to \-1 if the driver doesn't have a block device. +.It Li kern.expose_address +Expose kernel addresses in +.Xr sysctl 3 +calls used by +.Xr fstat 1 +and +.Xr sockstat 1 . +Defaults to +.Dv 0 . +Turning it on renders KASLR ineffective. .It Li kern.dump_on_panic ( Dv KERN_DUMP_ON_PANIC ) Perform a crash dump on system .Xr panic 9 .
CVS commit: src/sys
Module Name:src Committed By: christos Date: Fri Oct 5 22:12:38 UTC 2018 Modified Files: src/sys/kern: init_sysctl.c kern_descrip.c kern_proc.c src/sys/secmodel/suser: secmodel_suser.c src/sys/sys: kauth.h systm.h Log Message: Provide a sysctl kern.expose_address to expose kernel addresses in sysctl structure returns for non-root. Defaults to off. Turning it on will restore sockstat/fstat and friends for regular users. To generate a diff of this commit: cvs rdiff -u -r1.217 -r1.218 src/sys/kern/init_sysctl.c \ src/sys/kern/kern_proc.c cvs rdiff -u -r1.237 -r1.238 src/sys/kern/kern_descrip.c cvs rdiff -u -r1.48 -r1.49 src/sys/secmodel/suser/secmodel_suser.c cvs rdiff -u -r1.80 -r1.81 src/sys/sys/kauth.h cvs rdiff -u -r1.278 -r1.279 src/sys/sys/systm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.217 src/sys/kern/init_sysctl.c:1.218 --- src/sys/kern/init_sysctl.c:1.217 Sun Sep 16 16:39:04 2018 +++ src/sys/kern/init_sysctl.c Fri Oct 5 18:12:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.217 2018/09/16 20:39:04 mrg Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.218 2018/10/05 22:12:38 christos Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.217 2018/09/16 20:39:04 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.218 2018/10/05 22:12:38 christos Exp $"); #include "opt_sysv.h" #include "opt_compat_netbsd.h" @@ -85,6 +85,8 @@ int kern_has_sysvmsg = 0; int kern_has_sysvshm = 0; int kern_has_sysvsem = 0; +int kern_expose_address = 0; + static const u_int sysctl_lwpprflagmap[] = { LPR_DETACHED, L_DETACHED, 0 @@ -127,6 +129,7 @@ static int sysctl_kern_root_partition(SY static int sysctl_kern_drivers(SYSCTLFN_PROTO); static int sysctl_security_setidcore(SYSCTLFN_PROTO); static int sysctl_security_setidcorename(SYSCTLFN_PROTO); +static int sysctl_security_expose_address(SYSCTLFN_PROTO); static int sysctl_kern_cpid(SYSCTLFN_PROTO); static int sysctl_hw_usermem(SYSCTLFN_PROTO); static int sysctl_hw_cnmagic(SYSCTLFN_PROTO); @@ -599,6 +602,12 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl SYSCTL_DESCR("Kernel message verbosity"), sysctl_kern_messages, 0, NULL, 0, CTL_KERN, CTL_CREATE, CTL_EOL); + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_INT, "expose_address", + SYSCTL_DESCR("Expose kernel addresses to userland"), + sysctl_security_expose_address, 0, &kern_expose_address, + 0, CTL_KERN, CTL_CREATE, CTL_EOL); } SYSCTL_SETUP(sysctl_hw_misc_setup, "sysctl hw subtree misc setup") @@ -798,7 +807,7 @@ sysctl_kern_messages(SYSCTLFN_ARGS) case AB_NORMAL: default: messageverbose = 2; -} + } node = *rnode; node.sysctl_data = &messageverbose; @@ -1340,6 +1349,37 @@ sysctl_security_setidcore(SYSCTLFN_ARGS) } static int +sysctl_security_expose_address(SYSCTLFN_ARGS) +{ + int expose_address, error; + struct sysctlnode node; + + node = *rnode; + node.sysctl_data = &expose_address; + expose_address = *(int *)rnode->sysctl_data; + error = sysctl_lookup(SYSCTLFN_CALL(&node)); + if (error || newp == NULL) + return error; + + if (kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_KERNADDR, + 0, NULL, NULL, NULL)) + return (EPERM); + + *(int *)rnode->sysctl_data = expose_address; + + return 0; +} + +bool +get_expose_address(struct proc *p) +{ + /* allow only if sysctl variable is set or privileged */ + return kern_expose_address || kauth_authorize_process(kauth_cred_get(), + KAUTH_PROCESS_CANSEE, p, + KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_KPTR), NULL, NULL) == 0; +} + +static int sysctl_security_setidcorename(SYSCTLFN_ARGS) { int error; Index: src/sys/kern/kern_proc.c diff -u src/sys/kern/kern_proc.c:1.217 src/sys/kern/kern_proc.c:1.218 --- src/sys/kern/kern_proc.c:1.217 Tue Sep 4 12:03:56 2018 +++ src/sys/kern/kern_proc.c Fri Oct 5 18:12:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_proc.c,v 1.217 2018/09/04 16:03:56 maxv Exp $ */ +/* $NetBSD: kern_proc.c,v 1.218 2018/10/05 22:12:38 christos Exp $ */ /*- * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.217 2018/09/04 16:03:56 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.218 2018/10/05 22:12:38 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_kstack.h" @@ -2160,35 +2160,24 @@ done: return error; } -#define SET_KERN_ADDR(dst, src, allow) \ - do {\ - if (allow) \ - dst = src; \ - } while (0); - /* * Fill in an eproc structure for the specified process. */ void fill_eproc(struct proc *p, struct eproc *ep, bool zombie) { - bool allowaddr; struct tty *tp; struct lwp *l; - int error; KASSERT(mutex_owned(proc_
CVS commit: src/crypto/dist/ipsec-tools/src/racoon
Module Name:src Committed By: christos Date: Fri Oct 5 20:12:37 UTC 2018 Modified Files: src/crypto/dist/ipsec-tools/src/racoon: isakmp_frag.c Log Message: >From Thomas Reim: Current racoon code cannot detect duplicate last fragments as it uses the fragment flag instead of the fragment number. The code does not consider that the IKE payload fragments might not be received in the correct order. In this case, packet complete detection will again fail and VPN clients abandoned from VPN service. Nevertheless, clients still can add fragments to the fragment queue and fill it up to the possible 255 fragments. Only duplicates are detected, but not the fragments with a number greater than the last fragment number. The last fragment number is kept in the Phase 1 handler after fragment queue deletion, which may lead to error notifications after succesful reassembly of the IKE phase 1 message. In general, the 2017's CVE fix added laconic and difficult to understand failure notifications, which do not much help for analysis, why a VPN client was blocked by racoon server. This patch fixes the code and aligns it to Microsoft/Cisco IKE fragmentation specification. It provides error logging which is in line with above specification and adds some debug info to the logs to better support analysis VPN client blackballing. XXX: pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.9 src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.10 --- src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c:1.9 Tue Oct 2 14:49:24 2018 +++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_frag.c Fri Oct 5 16:12:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: isakmp_frag.c,v 1.9 2018/10/02 18:49:24 christos Exp $ */ +/* $NetBSD: isakmp_frag.c,v 1.10 2018/10/05 20:12:37 christos Exp $ */ /* Id: isakmp_frag.c,v 1.4 2004/11/13 17:31:36 manubsd Exp */ @@ -219,10 +219,15 @@ isakmp_frag_extract(iph1, msg) struct isakmp_frag *frag; struct isakmp_frag_item *item; vchar_t *buf; - int last_frag = 0; + const char *m; char *data; int i; + if (iph1->frag_chain == NULL) { + plog(LLV_DEBUG, LOCATION, NULL, + "fragmented IKE phase 1 message payload detected\n"); + } + if (msg->l < sizeof(*isakmp) + sizeof(*frag)) { plog(LLV_ERROR, LOCATION, NULL, "Message too short\n"); return -1; @@ -260,47 +265,66 @@ isakmp_frag_extract(iph1, msg) item->frag_next = NULL; item->frag_packet = buf; - /* Check for the last frag before inserting the new item in the chain */ - if (item->frag_last) { - /* if we have the last fragment, indices must match */ - if (iph1->frag_last_index != 0 && - item->frag_last != iph1->frag_last_index) { - plog(LLV_ERROR, LOCATION, NULL, - "Repeated last fragment index mismatch\n"); - racoon_free(item); - vfree(buf); - return -1; + + /* Perform required last frag checks before inserting the new item in + the chain */ + if (iph1->frag_last_index != 0) { + /* Only one fragment payload allowed with last frag flag set */ + if (item->frag_last) { + m = "Message has multiple tail fragments\n"; + goto out; } - last_frag = iph1->frag_last_index = item->frag_num; + /* Fragment payload with fragment number greater than the + fragment number of the last fragment is not allowed*/ + if (item->frag_num > iph1->frag_last_index) { + m = "Fragment number greater than tail fragment number\n"; + goto out; + } } /* insert fragment into chain */ if (isakmp_frag_insert(iph1, item) == -1) { - plog(LLV_ERROR, LOCATION, NULL, - "Repeated fragment index mismatch\n"); - racoon_free(item); - vfree(buf); - return -1; + m = "Duplicate fragment number\n"; + goto out; } + plog(LLV_DEBUG, LOCATION, NULL, + "fragment payload #%d queued\n", item->frag_num); + + /* remember last frag after insertion into fragment chain */ + if (item->frag_last) + iph1->frag_last_index = item->frag_num; + /* If we saw the last frag, check if the chain is complete * we have a sorted list now, so just walk through */ - if (last_frag != 0) { + if (iph1->frag_last_index != 0) { item = iph1->frag_chain; - for (i = 1; i <= last_frag; i++) { - if (item == NULL) /* Not found */ -break; - if (item->frag_num != i) -break; + for (i = 1; i <= iph1->frag_last_index; i++) { + if (item == NULL || + item->frag_num != i) { +plog(LLV_DEBUG, LOCATION, NULL, + "fragment payload #%d still missing\n", + i); + break; + } item = item->frag_next; } - if (i > last_frag) /* It is complete */ - return 1; + if (i > iph1->frag_last_index) {/* It is complete */ + plog(LLV_DEBUG, LOCATION, NULL, +
CVS commit: src/sys/arch/sparc64/doc
Module Name:src Committed By: palle Date: Fri Oct 5 19:53:47 UTC 2018 Modified Files: src/sys/arch/sparc64/doc: TODO Log Message: sun4v: update TODO with proper path to sh + list tested platforms so far To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sparc64/doc/TODO Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/doc/TODO diff -u src/sys/arch/sparc64/doc/TODO:1.26 src/sys/arch/sparc64/doc/TODO:1.27 --- src/sys/arch/sparc64/doc/TODO:1.26 Wed Apr 11 19:44:47 2018 +++ src/sys/arch/sparc64/doc/TODO Fri Oct 5 19:53:47 2018 @@ -1,4 +1,4 @@ - /* $NetBSD: TODO,v 1.26 2018/04/11 19:44:47 palle Exp $ */ + /* $NetBSD: TODO,v 1.27 2018/10/05 19:53:47 palle Exp $ */ Things to be done: @@ -12,7 +12,7 @@ sun4u: sun4v: - current status: The kernel boots and starts the init process (pid 1) - which spawns /bin/sh (pid 2). This is forked as a new/bin/sh (pid 3) which crashes, probably due to MMU DPROT issues. + which spawns /sbin/sh (pid 2). This is forked as a new /sbin/sh (pid 3) which crashes, probably due to MMU DPROT issues. - 64-bit kernel support - 32-bit kernel support - libkvm @@ -33,4 +33,7 @@ sun4v: - vdsk and ldc drivers: code maked with OPENBSD_BUSDMA - make the bus_dma stuff work properly - vbus.c: handle prom_getprop() memory leaks - locore.s: rft_user (sun4v specific manaul fill) - seems to work, but is it good enough (compared to openbsds rft_user? - + - platforms tested so far: + -- qemu sun4v/niagara - crash in init process relaed to fork (stack?) + -- T2000 - mmu fault somewhere + -- T5 - stickcmpr is not properly initialized ???
CVS commit: src/sys/arch/x86
Module Name:src Committed By: maxv Date: Fri Oct 5 18:51:52 UTC 2018 Modified Files: src/sys/arch/x86/include: cpu.h fpu.h src/sys/arch/x86/x86: fpu.c Log Message: export x86_fpu_mxcsr_mask, fpu_area_save and fpu_area_restore To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/include/fpu.h cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/x86/fpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.97 src/sys/arch/x86/include/cpu.h:1.98 --- src/sys/arch/x86/include/cpu.h:1.97 Wed Aug 22 01:05:23 2018 +++ src/sys/arch/x86/include/cpu.h Fri Oct 5 18:51:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.97 2018/08/22 01:05:23 msaitoh Exp $ */ +/* $NetBSD: cpu.h,v 1.98 2018/10/05 18:51:52 maxv Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -440,6 +440,7 @@ extern int x86_fpu_save; #define FPU_SAVE_XSAVEOPT 3 extern unsigned int x86_fpu_save_size; extern uint64_t x86_xsave_features; +extern uint32_t x86_fpu_mxcsr_mask; extern bool x86_fpu_eager; extern void (*x86_cpu_idle)(void); Index: src/sys/arch/x86/include/fpu.h diff -u src/sys/arch/x86/include/fpu.h:1.12 src/sys/arch/x86/include/fpu.h:1.13 --- src/sys/arch/x86/include/fpu.h:1.12 Fri Jun 22 06:22:37 2018 +++ src/sys/arch/x86/include/fpu.h Fri Oct 5 18:51:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.h,v 1.12 2018/06/22 06:22:37 maxv Exp $ */ +/* $NetBSD: fpu.h,v 1.13 2018/10/05 18:51:52 maxv Exp $ */ #ifndef _X86_FPU_H_ #define _X86_FPU_H_ @@ -13,6 +13,10 @@ struct trapframe; void fpuinit(struct cpu_info *); void fpuinit_mxcsr_mask(void); + +void fpu_area_save(void *); +void fpu_area_restore(void *); + void fpusave_lwp(struct lwp *, bool); void fpusave_cpu(bool); Index: src/sys/arch/x86/x86/fpu.c diff -u src/sys/arch/x86/x86/fpu.c:1.47 src/sys/arch/x86/x86/fpu.c:1.48 --- src/sys/arch/x86/x86/fpu.c:1.47 Mon Sep 17 15:53:06 2018 +++ src/sys/arch/x86/x86/fpu.c Fri Oct 5 18:51:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu.c,v 1.47 2018/09/17 15:53:06 maxv Exp $ */ +/* $NetBSD: fpu.c,v 1.48 2018/10/05 18:51:52 maxv Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. All @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.47 2018/09/17 15:53:06 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.48 2018/10/05 18:51:52 maxv Exp $"); #include "opt_multiprocessor.h" @@ -126,10 +126,9 @@ __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.47 #define stts() HYPERVISOR_fpu_taskswitch(1) #endif +uint32_t x86_fpu_mxcsr_mask __read_mostly = 0; bool x86_fpu_eager __read_mostly = false; -static uint32_t x86_fpu_mxcsr_mask __read_mostly = 0; - static inline union savefpu * lwp_fpuarea(struct lwp *l) { @@ -209,7 +208,7 @@ fpu_clear_amd(void) fldummy(); } -static void +void fpu_area_save(void *area) { clts(); @@ -230,7 +229,7 @@ fpu_area_save(void *area) } } -static void +void fpu_area_restore(void *area) { clts();
CVS commit: src/share/man/man9
Module Name:src Committed By: uwe Date: Fri Oct 5 16:21:22 UTC 2018 Modified Files: src/share/man/man9: fstrans.9 Log Message: Minor markup fixes. Add a missing word. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man9/fstrans.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/fstrans.9 diff -u src/share/man/man9/fstrans.9:1.28 src/share/man/man9/fstrans.9:1.29 --- src/share/man/man9/fstrans.9:1.28 Fri Oct 5 15:37:26 2018 +++ src/share/man/man9/fstrans.9 Fri Oct 5 16:21:22 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: fstrans.9,v 1.28 2018/10/05 15:37:26 wiz Exp $ +.\" $NetBSD: fstrans.9,v 1.29 2018/10/05 16:21:22 uwe Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -110,7 +110,7 @@ to: .It enter the .Dv FSTRANS_SUSPENDING -to suspend all normal operations but allow lazy transactions, +state to suspend all normal operations but allow lazy transactions, .It enter the .Dv FSTRANS_SUSPENDED @@ -161,7 +161,7 @@ May sleep. Like .Fn fstrans_start , but return -.Dv EBUSY +.Er EBUSY immediately if transactions are blocked in its current state. .Pp May sleep nevertheless on internal locks. @@ -187,7 +187,7 @@ to and wait for all transactions not allowed in .Fa new_state to complete. -.Bl -tag -width FSTRANS_SUSPENDING +.Bl -tag -width "Dv FSTRANS_SUSPENDING" .It Dv FSTRANS_NORMAL Allow all transactions. .It Dv FSTRANS_SUSPENDING
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Fri Oct 5 15:37:26 UTC 2018 Modified Files: src/share/man/man9: fstrans.9 Log Message: Simplify macro usage. No visible change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/share/man/man9/fstrans.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/fstrans.9 diff -u src/share/man/man9/fstrans.9:1.27 src/share/man/man9/fstrans.9:1.28 --- src/share/man/man9/fstrans.9:1.27 Fri Oct 5 09:51:55 2018 +++ src/share/man/man9/fstrans.9 Fri Oct 5 15:37:26 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: fstrans.9,v 1.27 2018/10/05 09:51:55 hannken Exp $ +.\" $NetBSD: fstrans.9,v 1.28 2018/10/05 15:37:26 wiz Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -238,7 +238,7 @@ The function will be called for every buffer .Fa bp written through this file system as -.Dl Fa func Ns Li "(" Ns Fa cookie Ns Li "," Fa bp Ns Li "," Fa data_valid Ns Li ")" +.Dl Fa func Ns ( Fa cookie , Fa bp , Fa data_valid ) where .Fa data_valid is true if and only if the buffer
CVS commit: src/lib/libcurses
Module Name:src Committed By: roy Date: Fri Oct 5 11:59:05 UTC 2018 Modified Files: src/lib/libcurses: newwin.c refresh.c Log Message: curses: allow drawing the lowest right hand cell of the terminal This is a historical behaviour that needs fixing If any terminal does scroll when drawing in the lowest right hand cell of the terminal then an entry should be made in the terminfo database (currently there is no standard code) to state that and define __SCROLLWIN as before. Fixes PR# 30978. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/lib/libcurses/newwin.c cvs rdiff -u -r1.88 -r1.89 src/lib/libcurses/refresh.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcurses/newwin.c diff -u src/lib/libcurses/newwin.c:1.52 src/lib/libcurses/newwin.c:1.53 --- src/lib/libcurses/newwin.c:1.52 Tue Oct 2 17:35:44 2018 +++ src/lib/libcurses/newwin.c Fri Oct 5 11:59:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: newwin.c,v 1.52 2018/10/02 17:35:44 roy Exp $ */ +/* $NetBSD: newwin.c,v 1.53 2018/10/05 11:59:05 roy Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94"; #else -__RCSID("$NetBSD: newwin.c,v 1.52 2018/10/02 17:35:44 roy Exp $"); +__RCSID("$NetBSD: newwin.c,v 1.53 2018/10/05 11:59:05 roy Exp $"); #endif #endif/* not lint */ @@ -422,8 +422,14 @@ __swflags(WINDOW *win) win->flags |= __ENDLINE; if (win->begx == 0 && win->maxy == LINES && win->begy == 0) win->flags |= __FULLWIN; + /* + * Enable this if we have a terminfo setting which claims + * terminal will scroll. Currently there is none. + */ +#if 0 if (win->begy + win->maxy == LINES) win->flags |= __SCROLLWIN; +#endif } } Index: src/lib/libcurses/refresh.c diff -u src/lib/libcurses/refresh.c:1.88 src/lib/libcurses/refresh.c:1.89 --- src/lib/libcurses/refresh.c:1.88 Mon Mar 20 20:42:39 2017 +++ src/lib/libcurses/refresh.c Fri Oct 5 11:59:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.88 2017/03/20 20:42:39 christos Exp $ */ +/* $NetBSD: refresh.c,v 1.89 2018/10/05 11:59:05 roy Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; #else -__RCSID("$NetBSD: refresh.c,v 1.88 2017/03/20 20:42:39 christos Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.89 2018/10/05 11:59:05 roy Exp $"); #endif #endif/* not lint */ @@ -1208,50 +1208,46 @@ makech(int wy) wx++; if (wx >= win->maxx && wy == win->maxy - 1 && !_cursesi_screen->curwin) { -if (win->flags & __SCROLLOK) { - if (win->flags & __ENDLINE) - __unsetattr(1); - if (!(win->flags & __SCROLLWIN)) { - if (!_cursesi_screen->curwin) { - csp->attr = nsp->attr; - csp->ch = nsp->ch; +if (win->flags & __ENDLINE) + __unsetattr(1); +if (!(win->flags & __SCROLLWIN)) { + if (!_cursesi_screen->curwin) { + csp->attr = nsp->attr; + csp->ch = nsp->ch; #ifdef HAVE_WCHAR - if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR) -return ERR; + if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR) + return ERR; #endif /* HAVE_WCHAR */ - } + } #ifndef HAVE_WCHAR - __cputchar((int) nsp->ch); + __cputchar((int) nsp->ch); #else - if ( WCOL( *nsp ) > 0 ) { - __cputwchar((int)nsp->ch); + if ( WCOL( *nsp ) > 0 ) { + __cputwchar((int)nsp->ch); #ifdef DEBUG - __CTRACE(__CTRACE_REFRESH, - "makech: (%d,%d)putwchar(0x%x)\n", -wy, wx - 1, -nsp->ch ); + __CTRACE(__CTRACE_REFRESH, + "makech: (%d,%d)putwchar(0x%x)\n", + wy, wx - 1, + nsp->ch ); #endif /* DEBUG */ - /* - * Output non-spacing - * characters for the - * cell. - */ - __cursesi_putnsp(nsp->nsp, - wy, wx); - - } -#endif /* HAVE_WCHAR */ - } - if (wx < curscr->maxx) { - domvcur(win, - _cursesi_screen->ly, wx, - (int)(win->maxy - 1), - (int)(win->maxx - 1)); + /* + * Output non-spacing + * characters for the + * cell. + */ + __cursesi_putnsp(nsp->nsp, wy, wx); } - _cursesi_screen->ly = win->maxy - 1; - _cursesi_screen->lx = win->maxx - 1; - return (OK); +#endif /* HAVE_WCHAR */ } +if (wx < curscr->maxx) { + domvcur(win, + _cursesi_screen->ly, wx, + (int)(win->maxy - 1), + (int)(win->maxx - 1)); +} +_cursesi_screen->ly = win->maxy - 1; +_cursesi_screen->lx = win->maxx - 1; +return OK; } if (wx < win->maxx || wy < win->maxy - 1 || !(win->flags & __SCROLLWIN))
CVS commit: src
Module Name:src Committed By: hannken Date: Fri Oct 5 09:51:56 UTC 2018 Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile fstrans.9 src/sys/dev: vnd.c src/sys/kern: vfs_trans.c src/sys/miscfs/genfs: genfs_vfsops.c src/sys/rump/librump/rumpkern: emul.c src/sys/sys: fstrans.h Log Message: Bring back three state file system suspension: NORMAL -> SUSPENDING -> SUSPENDED and add operation fstrans_start_lazy() that only blocks while SUSPENDED. Change vndthread() support operation handle_with_rdwr() to bracket its file system operations by fstrans_start_lazy() and fstrans_done(). PR kern/53624 (dom0 freeze on domU exit) To generate a diff of this commit: cvs rdiff -u -r1.2232 -r1.2233 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.430 -r1.431 src/share/man/man9/Makefile cvs rdiff -u -r1.26 -r1.27 src/share/man/man9/fstrans.9 cvs rdiff -u -r1.265 -r1.266 src/sys/dev/vnd.c cvs rdiff -u -r1.50 -r1.51 src/sys/kern/vfs_trans.c cvs rdiff -u -r1.7 -r1.8 src/sys/miscfs/genfs/genfs_vfsops.c cvs rdiff -u -r1.186 -r1.187 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.11 -r1.12 src/sys/sys/fstrans.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2232 src/distrib/sets/lists/comp/mi:1.2233 --- src/distrib/sets/lists/comp/mi:1.2232 Wed Sep 26 12:59:37 2018 +++ src/distrib/sets/lists/comp/mi Fri Oct 5 09:51:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2232 2018/09/26 12:59:37 rin Exp $ +# $NetBSD: mi,v 1.2233 2018/10/05 09:51:55 hannken Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -10988,6 +10988,7 @@ ./usr/share/man/cat9/fstrans_is_owner.0 comp-sys-catman .cat ./usr/share/man/cat9/fstrans_setstate.0 comp-sys-catman .cat ./usr/share/man/cat9/fstrans_start.0 comp-sys-catman .cat +./usr/share/man/cat9/fstrans_start_lazy.0 comp-sys-catman .cat ./usr/share/man/cat9/fstrans_start_nowait.0 comp-sys-catman .cat ./usr/share/man/cat9/fubyte.0 comp-sys-catman .cat ./usr/share/man/cat9/fuibyte.0 comp-sys-catman .cat @@ -18801,6 +18802,7 @@ ./usr/share/man/html9/fstrans_is_owner.html comp-sys-htmlman html ./usr/share/man/html9/fstrans_setstate.html comp-sys-htmlman html ./usr/share/man/html9/fstrans_start.html comp-sys-htmlman html +./usr/share/man/html9/fstrans_start_lazy.html comp-sys-htmlman html ./usr/share/man/html9/fstrans_start_nowait.html comp-sys-htmlman html ./usr/share/man/html9/fubyte.html comp-sys-htmlman html ./usr/share/man/html9/fuibyte.html comp-sys-htmlman html @@ -26760,6 +26762,7 @@ ./usr/share/man/man9/fstrans_is_owner.9 comp-sys-man .man ./usr/share/man/man9/fstrans_setstate.9 comp-sys-man .man ./usr/share/man/man9/fstrans_start.9 comp-sys-man .man +./usr/share/man/man9/fstrans_start_lazy.9 comp-sys-man .man ./usr/share/man/man9/fstrans_start_nowait.9 comp-sys-man .man ./usr/share/man/man9/fubyte.9 comp-sys-man .man ./usr/share/man/man9/fuibyte.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.430 src/share/man/man9/Makefile:1.431 --- src/share/man/man9/Makefile:1.430 Thu Sep 20 06:54:36 2018 +++ src/share/man/man9/Makefile Fri Oct 5 09:51:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.430 2018/09/20 06:54:36 rin Exp $ +# $NetBSD: Makefile,v 1.431 2018/10/05 09:51:55 hannken Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -357,6 +357,7 @@ MLINKS+=fstrans.9 fstrans_done.9 \ fstrans.9 fstrans_getstate.9 \ fstrans.9 fstrans_setstate.9 \ fstrans.9 fstrans_start.9 \ + fstrans.9 fstrans_start_lazy.9 \ fstrans.9 fstrans_start_nowait.9 \ fstrans.9 fscow_establish.9 \ fstrans.9 fscow_disestablish.9 \ Index: src/share/man/man9/fstrans.9 diff -u src/share/man/man9/fstrans.9:1.26 src/share/man/man9/fstrans.9:1.27 --- src/share/man/man9/fstrans.9:1.26 Mon Jul 3 21:28:48 2017 +++ src/share/man/man9/fstrans.9 Fri Oct 5 09:51:55 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: fstrans.9,v 1.26 2017/07/03 21:28:48 wiz Exp $ +.\" $NetBSD: fstrans.9,v 1.27 2018/10/05 09:51:55 hannken Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 4, 2017 +.Dd October 4, 2018 .Dt FSTRANS 9 .Os .Sh NAME @@ -36,6 +36,7 @@ .Nm fstrans_getstate , .Nm fstrans_start , .Nm fstrans_start_nowait , +.Nm fstrans_start_lazy , .Nm fstrans_done , .Nm fstrans_is_owner , .Nm fscow_establish , @@ -50,6 +51,8 @@ .Ft int .Fn fstrans_start_nowait "struct mount *mp" .Ft void +.Fn fstrans_start_lazy "struct mount *mp" +.Ft void .Fn fstrans_done "struct mount *mp" .Ft int .Fn
CVS commit: src/sbin/fsck_ffs
Module Name:src Committed By: hannken Date: Fri Oct 5 09:49:23 UTC 2018 Modified Files: src/sbin/fsck_ffs: setup.c Log Message: Add a test for duplicate inodes on the persistent snapshot list. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sbin/fsck_ffs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ffs/setup.c diff -u src/sbin/fsck_ffs/setup.c:1.101 src/sbin/fsck_ffs/setup.c:1.102 --- src/sbin/fsck_ffs/setup.c:1.101 Wed Feb 8 16:11:40 2017 +++ src/sbin/fsck_ffs/setup.c Fri Oct 5 09:49:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $ */ +/* $NetBSD: setup.c,v 1.102 2018/10/05 09:49:23 hannken Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $"); +__RCSID("$NetBSD: setup.c,v 1.102 2018/10/05 09:49:23 hannken Exp $"); #endif #endif /* not lint */ @@ -73,6 +73,7 @@ static int readsb(int); #ifndef NO_APPLE_UFS static int readappleufs(void); #endif +static int check_snapinum(void); int16_t sblkpostbl[256]; @@ -341,6 +342,14 @@ setup(const char *dev, const char *origd dirty(&asblk); } } + if (check_snapinum()) { + if (preen) + printf(" (FIXED)\n"); + if (preen || reply("FIX") == 1) { + sbdirty(); + dirty(&asblk); + } + } if (is_ufs2 || sblock->fs_old_inodefmt >= FS_44INODEFMT) { if (sblock->fs_maxfilesize != maxfilesize) { pwarn("INCORRECT MAXFILESIZE=%lld IN SUPERBLOCK", @@ -1094,3 +1103,42 @@ calcsb(const char *dev, int devfd, struc } return (1); } + +/* + * Test the list of snapshot inode numbers for duplicates and repair. + */ +static int +check_snapinum(void) +{ + int loc, loc2, res; + int *snapinum = &sblock->fs_snapinum[0]; + + res = 0; + + if (isappleufs) + return 0; + + for (loc = 0; loc < FSMAXSNAP; loc++) { + if (snapinum[loc] == 0) + break; + for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) { + if (snapinum[loc2] == 0 || + snapinum[loc2] == snapinum[loc]) +break; + } + if (loc2 >= FSMAXSNAP || snapinum[loc2] == 0) + continue; + pwarn("SNAPSHOT INODE %u ALREADY ON LIST%s", snapinum[loc2], + (res ? "" : "\n")); + res = 1; + for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) { + if (snapinum[loc2] == 0) +break; + snapinum[loc2 - 1] = snapinum[loc2]; + } + snapinum[loc2 - 1] = 0; + loc--; + } + + return res; +}
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Fri Oct 5 08:23:58 UTC 2018 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Fix KASSERT to prevent panic on CNP(Intel 300 series + I219) with INTx interrupt (Xen dom0 or pre netbsd-8). XXX pullup-[78] To generate a diff of this commit: cvs rdiff -u -r1.588 -r1.589 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.588 src/sys/dev/pci/if_wm.c:1.589 --- src/sys/dev/pci/if_wm.c:1.588 Wed Sep 12 05:03:05 2018 +++ src/sys/dev/pci/if_wm.c Fri Oct 5 08:23:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.588 2018/09/12 05:03:05 msaitoh Exp $ */ +/* $NetBSD: if_wm.c,v 1.589 2018/10/05 08:23:58 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.588 2018/09/12 05:03:05 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.589 2018/10/05 08:23:58 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -14789,7 +14789,8 @@ wm_legacy_irq_quirk_spt(struct wm_softc DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n", device_xname(sc->sc_dev), __func__)); - KASSERT(sc->sc_type == WM_T_PCH_SPT); + KASSERT((sc->sc_type == WM_T_PCH_SPT) + || (sc->sc_type == WM_T_PCH_CNP)); reg = CSR_READ(sc, WMREG_FEXTNVM7); reg |= FEXTNVM7_SIDE_CLK_UNGATE;