svn commit: r330536 - head/sys/net
Author: ae Date: Tue Mar 6 12:01:31 2018 New Revision: 330536 URL: https://svnweb.freebsd.org/changeset/base/330536 Log: Define ethernet type 0x88A8 as ETHERTYPE_QINQ. Reviewed by: kp Obtained from:OpenBSD MFC after:1 week Differential Revision:https://reviews.freebsd.org/D14593 Modified: head/sys/net/ethernet.h Modified: head/sys/net/ethernet.h == --- head/sys/net/ethernet.h Tue Mar 6 07:38:32 2018(r330535) +++ head/sys/net/ethernet.h Tue Mar 6 12:01:31 2018(r330536) @@ -344,6 +344,7 @@ struct ether_vlan_header { #defineETHERTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */ #defineETHERTYPE_LANPROBE 0x /* HP LanProbe test? */ #defineETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ +#defineETHERTYPE_QINQ 0x88A8 /* 802.1ad VLAN stacking */ #defineETHERTYPE_LOOPBACK 0x9000 /* Loopback: used to test interfaces */ #defineETHERTYPE_LBACK ETHERTYPE_LOOPBACK /* DEC MOP loopback */ #defineETHERTYPE_XNSSM 0x9001 /* 3Com (Formerly Bridge Communications), XNS Systems Management */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330537 - in head/sys: compat/linuxkpi/common/include/linux dev/mlx4/mlx4_core
Author: ae Date: Tue Mar 6 12:58:00 2018 New Revision: 330537 URL: https://svnweb.freebsd.org/changeset/base/330537 Log: Add mapping for several ethernet types used by Linux to FreeBSD ethernet types. Reviewed by: hselasky MFC after:1 week Differential Revision:https://reviews.freebsd.org/D14594 Modified: head/sys/compat/linuxkpi/common/include/linux/if_ether.h head/sys/dev/mlx4/mlx4_core/mlx4.h Modified: head/sys/compat/linuxkpi/common/include/linux/if_ether.h == --- head/sys/compat/linuxkpi/common/include/linux/if_ether.hTue Mar 6 12:01:31 2018(r330536) +++ head/sys/compat/linuxkpi/common/include/linux/if_ether.hTue Mar 6 12:58:00 2018(r330537) @@ -35,8 +35,6 @@ #include -#defineETH_P_8021Q ETHERTYPE_VLAN - #define ETH_HLENETHER_HDR_LEN /* Total octets in header. */ #ifndef ETH_ALEN #define ETH_ALENETHER_ADDR_LEN @@ -47,6 +45,11 @@ /* * defined Ethernet Protocol ID's. */ -#define ETH_P_IP0x0800 /* Internet Protocol packet */ +#defineETH_P_IPETHERTYPE_IP +#defineETH_P_IPV6 ETHERTYPE_IPV6 +#defineETH_P_MPLS_UC ETHERTYPE_MPLS +#defineETH_P_MPLS_MC ETHERTYPE_MPLS_MCAST +#defineETH_P_8021Q ETHERTYPE_VLAN +#defineETH_P_8021ADETHERTYPE_QINQ #endif /* _LINUX_IF_ETHER_H_ */ Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h == --- head/sys/dev/mlx4/mlx4_core/mlx4.h Tue Mar 6 12:01:31 2018 (r330536) +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Tue Mar 6 12:58:00 2018 (r330537) @@ -66,8 +66,6 @@ #define MLX4_QUERY_IF_STAT_RESET BIT(31) -#defineETH_P_8021AD0x88A8 - enum { MLX4_HCR_BASE = 0x80680, MLX4_HCR_SIZE = 0x0001c, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330538 - head/sys/conf
Author: jtl Date: Tue Mar 6 14:18:45 2018 New Revision: 330538 URL: https://svnweb.freebsd.org/changeset/base/330538 Log: Nudge lld to break the kernel read-only and read-write sections into separate 2M pages. The binutils default for max-page-size and common-page-size used to produce this result. By setting these values, we can nudge lld to also separate these sections into separate 2M pages. Reviewed by: jhb, kib Discussed with: emaste Sponsored by: Netflix Differential Revision:D14282 Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Tue Mar 6 12:58:00 2018(r330537) +++ head/sys/conf/kern.pre.mk Tue Mar 6 14:18:45 2018(r330538) @@ -120,6 +120,10 @@ CFLAGS+= ${CONF_CFLAGS} LDFLAGS+= -Wl,--build-id=sha1 .endif +.if ${MACHINE_CPUARCH} == "amd64" +LDFLAGS+= -Wl,-z max-page-size=2097152 -Wl,-z common-page-size=4096 +.endif + NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} NORMAL_S= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330539 - in head/sys: amd64/amd64 amd64/include arm/include conf gdb i386/include mips/include powerpc/include sparc64/include
Author: jtl Date: Tue Mar 6 14:28:37 2018 New Revision: 330539 URL: https://svnweb.freebsd.org/changeset/base/330539 Log: amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits correctly for the data contained on each memory page. There are several components to this change: * Add a variable to indicate the start of the R/W portion of the initial memory. * Stop detecting NX bit support for each AP. Instead, use the value from the BSP and, if supported, activate the feature on the other APs just before loading the correct page table. (Functionally, we already assume that the BSP and all APs had the same support or lack of support for the NX bit.) * Set the RW and NX bits correctly for the kernel text, data, and BSS (subject to some caveats below). * Ensure DDB can write to memory when necessary (such as to set a breakpoint). * Ensure GDB can write to memory when necessary (such as to set a breakpoint). For this purpose, add new MD functions gdb_begin_write() and gdb_end_write() which the GDB support code can call before and after writing to memory. This change is not comprehensive: * It doesn't do anything to protect modules. * It doesn't do anything for kernel memory allocated after the kernel starts running. * In order to avoid excessive memory inefficiency, it may let multiple types of data share a 2M page, and assigns the most permissions needed for data on that page. Reviewed by: jhb, kib Discussed with: emaste MFC after:2 weeks Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D14282 Modified: head/sys/amd64/amd64/db_interface.c head/sys/amd64/amd64/gdb_machdep.c head/sys/amd64/amd64/initcpu.c head/sys/amd64/amd64/mpboot.S head/sys/amd64/amd64/pmap.c head/sys/amd64/include/cpu.h head/sys/amd64/include/gdb_machdep.h head/sys/arm/include/gdb_machdep.h head/sys/conf/ldscript.amd64 head/sys/gdb/gdb_packet.c head/sys/i386/include/gdb_machdep.h head/sys/mips/include/gdb_machdep.h head/sys/powerpc/include/gdb_machdep.h head/sys/sparc64/include/gdb_machdep.h Modified: head/sys/amd64/amd64/db_interface.c == --- head/sys/amd64/amd64/db_interface.c Tue Mar 6 14:18:45 2018 (r330538) +++ head/sys/amd64/amd64/db_interface.c Tue Mar 6 14:28:37 2018 (r330539) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include /* @@ -62,6 +65,9 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat /* * Write bytes to kernel address space for debugger. + * We need to disable write protection temporarily so we can write + * things (such as break points) that might be in write-protected + * memory. */ int db_write_bytes(vm_offset_t addr, size_t size, char *data) @@ -69,15 +75,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da jmp_buf jb; void *prev_jb; char *dst; + u_long cr0save; int ret; + cr0save = rcr0(); prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { + load_cr0(cr0save & ~CR0_WP); dst = (char *)addr; while (size-- > 0) *dst++ = *data++; } + load_cr0(cr0save); (void)kdb_jmpbuf(prev_jb); return (ret); } Modified: head/sys/amd64/amd64/gdb_machdep.c == --- head/sys/amd64/amd64/gdb_machdep.c Tue Mar 6 14:18:45 2018 (r330538) +++ head/sys/amd64/amd64/gdb_machdep.c Tue Mar 6 14:28:37 2018 (r330539) @@ -36,11 +36,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -121,3 +123,21 @@ gdb_cpu_signal(int type, int code) } return (SIGEMT); } + +void * +gdb_begin_write(void) +{ + u_long cr0save; + + cr0save = rcr0(); + load_cr0(cr0save & ~CR0_WP); + return ((void *)cr0save); +} + +void +gdb_end_write(void *arg) +{ + + load_cr0((u_long)arg); +} + Modified: head/sys/amd64/amd64/initcpu.c == --- head/sys/amd64/amd64/initcpu.c Tue Mar 6 14:18:45 2018 (r330538) +++ head/sys/amd64/amd64/initcpu.c Tue Mar 6 14:28:37 2018 (r330539) @@ -218,7 +218,7 @@ initializecpu(void) if (!IS_BSP() && (cpu_stdext_feature & CPUID_STDEXT_SMEP)) cr4 |= CR4_SMEP; load_cr4(cr4); - if ((amd_feature & AMDID_NX) != 0) { + if (IS_BSP() && (amd_feature & AMDID_NX) != 0) { msr = rdmsr(MSR_EFER) | EFER_NXE; wrmsr(MSR_EFER, msr); pg_nx = PG_NX; Modified: head/sys/amd64/amd64/mpboot.
svn commit: r330540 - head/share/man/man8
Author: rodrigo (ports committer) Date: Tue Mar 6 14:31:15 2018 New Revision: 330540 URL: https://svnweb.freebsd.org/changeset/base/330540 Log: Update the diskless manpage According with /etc/rc.initdiskless the default mfs allocation is now 5Mb (10240 x 512 bytes sectors) Submitted by: rodrigo Reviewed by: bcr Approved by: manpages (bcr) Differential Revision:https://reviews.freebsd.org/D14592 Modified: head/share/man/man8/diskless.8 Modified: head/share/man/man8/diskless.8 == --- head/share/man/man8/diskless.8 Tue Mar 6 14:28:37 2018 (r330539) +++ head/share/man/man8/diskless.8 Tue Mar 6 14:31:15 2018 (r330540) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 7, 2011 +.Dd March 6, 2018 .Dt DISKLESS 8 .Os .Sh NAME @@ -311,7 +311,7 @@ The .Nm scripts create memory file systems to hold the overridden directories. -Only a 2MB partition is created by default, which may not +Only a 5MB partition is created by default, which may not be sufficient for your purposes. To override this, you can create the file ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r330540 - head/share/man/man8
> Author: rodrigo (ports committer) > Date: Tue Mar 6 14:31:15 2018 > New Revision: 330540 > URL: https://svnweb.freebsd.org/changeset/base/330540 > > Log: > Update the diskless manpage > > According with /etc/rc.initdiskless the default mfs allocation > is now 5Mb (10240 x 512 bytes sectors) > > Submitted by: rodrigo > Reviewed by:bcr > Approved by:manpages (bcr) > Differential Revision: https://reviews.freebsd.org/D14592 Thank you for fixing the man page, if someone wants to do some additional related cleanup in the /etc/rc.initdiskless script that would be great. One issue is we have "one size fits all" for the md files default size of 5MB, which is for all practical puposes too small. IIRC you need at least 8MB to hold what is in a 11.1 var.cpio.gz file, and possibly more for ^head. It would be nice to have the size of /var and /etc set seperatly with resonable defaults. At present my diskless environment over rides both of these with md_size files in the ./conf directory. There may be some lingering comments about 4MB, but I am looking at 11.1 /etc right now. > Modified: > head/share/man/man8/diskless.8 > > Modified: head/share/man/man8/diskless.8 > == > --- head/share/man/man8/diskless.8Tue Mar 6 14:28:37 2018 > (r330539) > +++ head/share/man/man8/diskless.8Tue Mar 6 14:31:15 2018 > (r330540) > @@ -26,7 +26,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd August 7, 2011 > +.Dd March 6, 2018 > .Dt DISKLESS 8 > .Os > .Sh NAME > @@ -311,7 +311,7 @@ The > .Nm > scripts create memory file systems to hold the overridden > directories. > -Only a 2MB partition is created by default, which may not > +Only a 5MB partition is created by default, which may not > be sufficient for your purposes. > To override this, you can create the > file > > -- Rod Grimes rgri...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330542 - head/sys/powerpc/powernv
Author: nwhitehorn Date: Tue Mar 6 15:52:43 2018 New Revision: 330542 URL: https://svnweb.freebsd.org/changeset/base/330542 Log: Fix use of unitialized variables. Modified: head/sys/powerpc/powernv/opal_pci.c head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/powernv/opal_pci.c == --- head/sys/powerpc/powernv/opal_pci.c Tue Mar 6 15:51:59 2018 (r330541) +++ head/sys/powerpc/powernv/opal_pci.c Tue Mar 6 15:52:43 2018 (r330542) @@ -429,6 +429,7 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo config_addr, reg, vtophys(&word)); break; default: + error = OPAL_SUCCESS; word = 0x; } Modified: head/sys/powerpc/powernv/platform_powernv.c == --- head/sys/powerpc/powernv/platform_powernv.c Tue Mar 6 15:51:59 2018 (r330541) +++ head/sys/powerpc/powernv/platform_powernv.c Tue Mar 6 15:52:43 2018 (r330542) @@ -127,7 +127,7 @@ powernv_attach(platform_t plat) char buf[255]; pcell_t prop; phandle_t cpu; - int res, len, node, idx; + int res, len, idx; register_t msr; /* Ping OPAL again just to make sure */ @@ -194,7 +194,7 @@ powernv_attach(platform_t plat) * for the encoding of the property. */ - len = OF_getproplen(node, "ibm,segment-page-sizes"); + len = OF_getproplen(cpu, "ibm,segment-page-sizes"); if (len > 0) { /* * We have to use a variable length array on the stack ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330541 - head/sys/cddl/dev/fbt/x86
Author: markj Date: Tue Mar 6 15:51:59 2018 New Revision: 330541 URL: https://svnweb.freebsd.org/changeset/base/330541 Log: Unbreak amd64 FBT after r330539. X-MFC with: r330539 Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c Modified: head/sys/cddl/dev/fbt/x86/fbt_isa.c == --- head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 6 14:31:15 2018 (r330540) +++ head/sys/cddl/dev/fbt/x86/fbt_isa.c Tue Mar 6 15:51:59 2018 (r330541) @@ -34,6 +34,8 @@ #include +#include + #include "fbt.h" #defineFBT_PUSHL_EBP 0x55 @@ -143,8 +145,15 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uin void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { + u_long cr0save; + register_t intr; + intr = intr_disable(); + cr0save = rcr0(); + load_cr0(cr0save & ~CR0_WP); *fbt->fbtp_patchpoint = val; + load_cr0(cr0save); + intr_restore(intr); } int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330545 - head/sys/mips/mips
Author: brooks Date: Tue Mar 6 18:28:55 2018 New Revision: 330545 URL: https://svnweb.freebsd.org/changeset/base/330545 Log: Remove reference to unimplemented fuiword, etc. We don't support Harvard architectures. Modified: head/sys/mips/mips/support.S Modified: head/sys/mips/mips/support.S == --- head/sys/mips/mips/support.STue Mar 6 16:16:30 2018 (r330544) +++ head/sys/mips/mips/support.STue Mar 6 18:28:55 2018 (r330545) @@ -281,10 +281,8 @@ LEAF(copyerr) END(copyerr) /* - * {fu,su},{ibyte,isword,iword}, fetch or store a byte, short or word to - * user text space. * {fu,su},{byte,sword,word}, fetch or store a byte, short or word to - * user data space. + * user-space. */ #ifdef __mips_n64 LEAF(fuword64) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330546 - head/sys/dev/atkbdc
Author: cem Date: Tue Mar 6 20:31:14 2018 New Revision: 330546 URL: https://svnweb.freebsd.org/changeset/base/330546 Log: psm(4): Initialize variables before use dxp/dyp could have been used uninitialized in the subsequent debugging log invocation. Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c == --- head/sys/dev/atkbdc/psm.c Tue Mar 6 18:28:55 2018(r330545) +++ head/sys/dev/atkbdc/psm.c Tue Mar 6 20:31:14 2018(r330546) @@ -3781,6 +3781,9 @@ psmgestures(struct psm_softc *sc, finger_t *fingers, i if (queue_len < gest->window_min) return; + dyp = -1; + dxp = -1; + /* Is a scrolling action occurring? */ if (!gest->in_taphold && !ms->button && (!gest->in_vscroll || two_finger_scroll)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330547 - head/etc
Author: trasz Date: Tue Mar 6 21:05:34 2018 New Revision: 330547 URL: https://svnweb.freebsd.org/changeset/base/330547 Log: Add example devd.conf(5) entry for notifying init(8) about new USB ttys. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/etc/devd.conf Modified: head/etc/devd.conf == --- head/etc/devd.conf Tue Mar 6 20:31:14 2018(r330546) +++ head/etc/devd.conf Tue Mar 6 21:05:34 2018(r330547) @@ -339,4 +339,15 @@ notify 10 { action "logger $comm $core"; }; +# Let the init(8) know there's a new USB serial interface it might +# want to run getty(8) for. This includes device-side tty created +# by usb_template(4). +notify 100 { + match "system" "DEVFS"; + match "subsystem" "CDEV"; + match "type""CREATE"; + match "cdev""ttyU[0-9]+"; + action "/sbin/init q"; +}; + */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330554 - head/sys/arm/allwinner
Author: kevans Date: Tue Mar 6 22:45:45 2018 New Revision: 330554 URL: https://svnweb.freebsd.org/changeset/base/330554 Log: aw_usbphy: Move later to SUPPORTDEV pass vbus-supply properties may be specified for each PHY. These properties reference a regulator that we must turn on/off as we turn the PHY on/off. However, if the usbphy comes up before the regulator in question (as is the case with GPIO-controlled regulators), then we will fail to grab a handle to the regulator and control it as the PHY power state changes. Fix it by just attaching the usbphy driver later. We don't really need it at RESOURCE, we just need it to be before DEFAULT when ehci/ohci attach. In particular, this fixes the USB NIC on a board that we don't yet supported- without this, it will not power on and if_ure cannot attach. Tested on:various boards [manu] Tested on:OrangePi R1 [Rap2 (irc)] Reported by: Rap2 (irc, "Cannot find USB NIC") Modified: head/sys/arm/allwinner/aw_usbphy.c Modified: head/sys/arm/allwinner/aw_usbphy.c == --- head/sys/arm/allwinner/aw_usbphy.c Tue Mar 6 21:45:23 2018 (r330553) +++ head/sys/arm/allwinner/aw_usbphy.c Tue Mar 6 22:45:45 2018 (r330554) @@ -418,7 +418,7 @@ static driver_t awusbphy_driver = { }; static devclass_t awusbphy_devclass; - +/* aw_usbphy needs to come up after regulators/gpio/etc, but before ehci/ohci */ EARLY_DRIVER_MODULE(awusbphy, simplebus, awusbphy_driver, awusbphy_devclass, -0, 0, BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE); +0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(awusbphy, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r330539 - in head/sys: amd64/amd64 amd64/include arm/include conf gdb i386/include mips/include powerpc/include sparc64/include
X-MFC-with: commit 27ac811b7acd31b1bdbf959fe49a957cdeabf780 Author: bde Date: Fri Mar 24 17:34:55 2017 + Remove buggy adjustment of page tables in db_write_bytes(). Long ago, perhaps only on i386, kernel text was mapped read-only and it was necessary to change the mapping to read-write to set breakpoints in kernel text. Other writes by ddb to kernel text were also allowed. This write protection is harder to implement with 4MB pages, and was lost even for 4K pages when 4MB pages were implemented. So changing the mapping became useless. It was actually worse than useless since it followed followed various null and otherwise garbage pointers to not change random memory instead of the mapping. (On i386s, the pointers became good in pmap_bootstrap(), and on amd64 the pointers became bad in pmap_bootstrap() if not before.) Another bug broke detection of following of null pointers on i386, except early in boot where not detecting this was a feature. When I fixed the bug, I accidentally broke the feature and soon got traps in db_write_bytes(). Setting breakpoints early in ddb was broken. kib pointed out that a clean way to do the adjustment would be to use a special [sub]map giving a small window on the bytes to be written. The trap handler didn't know how to fix up errors for pagefaults accessing the map itself. Such errors rarely need fixups, since most traps for the map are for the first access which is a read. Reviewed by:kib Notes: svn path=/head/; revision=315914 On 3/6/18, Jonathan T. Looney wrote: > Author: jtl > Date: Tue Mar 6 14:28:37 2018 > New Revision: 330539 > URL: https://svnweb.freebsd.org/changeset/base/330539 > > Log: > amd64: Protect the kernel text, data, and BSS by setting the RW/NX bits > correctly for the data contained on each memory page. > > There are several components to this change: >* Add a variable to indicate the start of the R/W portion of the > initial memory. >* Stop detecting NX bit support for each AP. Instead, use the value > from the BSP and, if supported, activate the feature on the other > APs just before loading the correct page table. (Functionally, we > already assume that the BSP and all APs had the same support or > lack of support for the NX bit.) >* Set the RW and NX bits correctly for the kernel text, data, and > BSS (subject to some caveats below). >* Ensure DDB can write to memory when necessary (such as to set a > breakpoint). >* Ensure GDB can write to memory when necessary (such as to set a > breakpoint). For this purpose, add new MD functions gdb_begin_write() > and gdb_end_write() which the GDB support code can call before and > after writing to memory. > > This change is not comprehensive: >* It doesn't do anything to protect modules. >* It doesn't do anything for kernel memory allocated after the kernel > starts running. >* In order to avoid excessive memory inefficiency, it may let multiple > types of data share a 2M page, and assigns the most permissions > needed for data on that page. > > Reviewed by:jhb, kib > Discussed with: emaste > MFC after: 2 weeks > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D14282 > > Modified: > head/sys/amd64/amd64/db_interface.c > head/sys/amd64/amd64/gdb_machdep.c > head/sys/amd64/amd64/initcpu.c > head/sys/amd64/amd64/mpboot.S > head/sys/amd64/amd64/pmap.c > head/sys/amd64/include/cpu.h > head/sys/amd64/include/gdb_machdep.h > head/sys/arm/include/gdb_machdep.h > head/sys/conf/ldscript.amd64 > head/sys/gdb/gdb_packet.c > head/sys/i386/include/gdb_machdep.h > head/sys/mips/include/gdb_machdep.h > head/sys/powerpc/include/gdb_machdep.h > head/sys/sparc64/include/gdb_machdep.h > > Modified: head/sys/amd64/amd64/db_interface.c > == > --- head/sys/amd64/amd64/db_interface.c Tue Mar 6 14:18:45 2018 > (r330538) > +++ head/sys/amd64/amd64/db_interface.c Tue Mar 6 14:28:37 2018 > (r330539) > @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > +#include > + > #include > > /* > @@ -62,6 +65,9 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat > > /* > * Write bytes to kernel address space for debugger. > + * We need to disable write protection temporarily so we can write > + * things (such as break points) that might be in write-protected > + * memory. > */ > int > db_write_bytes(vm_offset_t addr, size_t size, char *data) > @@ -69,15 +75,19 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da > jmp_buf jb; > void *prev_jb; > char *dst; > + u_long cr0save; > int ret; > > + cr0save = rcr0(); > prev_jb = kdb_jmpbuf(jb); > r
svn commit: r330558 - head/sys/dev/ichiic
Author: gonzo Date: Tue Mar 6 23:39:43 2018 New Revision: 330558 URL: https://svnweb.freebsd.org/changeset/base/330558 Log: [ig4] Add support for i2c controllers on Skylake and Kaby Lake This was tested by Ben on HP Chromebook 13 G1 with a Skylake CPU and Sunrise Point-LP I2C controller and by me on Minnowboard Turbot with Atom E3826 (formerly Bay Trail) Submitted by: Ben Pye Reviewed by: gonzo Obtained from:DragonflyBSD (a4549657 by Imre Vadász) MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D13654 Modified: head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_reg.h head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_acpi.c == --- head/sys/dev/ichiic/ig4_acpi.c Tue Mar 6 23:28:12 2018 (r330557) +++ head/sys/dev/ichiic/ig4_acpi.c Tue Mar 6 23:39:43 2018 (r330558) @@ -85,6 +85,8 @@ ig4iic_acpi_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; + /* All the HIDs matched are Atom SOCs. */ + sc->version = IG4_ATOM; sc->regs_rid = 0; sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->regs_rid, RF_ACTIVE); Modified: head/sys/dev/ichiic/ig4_iic.c == --- head/sys/dev/ichiic/ig4_iic.c Tue Mar 6 23:28:12 2018 (r330557) +++ head/sys/dev/ichiic/ig4_iic.c Tue Mar 6 23:39:43 2018 (r330558) @@ -525,22 +525,38 @@ ig4iic_attach(ig4iic_softc_t *sc) mtx_init(&sc->io_lock, "IG4 I/O lock", NULL, MTX_DEF); sx_init(&sc->call_lock, "IG4 call lock"); - v = reg_read(sc, IG4_REG_COMP_TYPE); - v = reg_read(sc, IG4_REG_COMP_PARAM1); - v = reg_read(sc, IG4_REG_GENERAL); - if ((v & IG4_GENERAL_SWMODE) == 0) { - v |= IG4_GENERAL_SWMODE; - reg_write(sc, IG4_REG_GENERAL, v); + if (sc->version == IG4_ATOM) + v = reg_read(sc, IG4_REG_COMP_TYPE); + + if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { + v = reg_read(sc, IG4_REG_COMP_PARAM1); v = reg_read(sc, IG4_REG_GENERAL); + /* +* The content of IG4_REG_GENERAL is different for each +* controller version. +*/ + if (sc->version == IG4_HASWELL && + (v & IG4_GENERAL_SWMODE) == 0) { + v |= IG4_GENERAL_SWMODE; + reg_write(sc, IG4_REG_GENERAL, v); + v = reg_read(sc, IG4_REG_GENERAL); + } } - v = reg_read(sc, IG4_REG_SW_LTR_VALUE); - v = reg_read(sc, IG4_REG_AUTO_LTR_VALUE); + if (sc->version == IG4_HASWELL) { + v = reg_read(sc, IG4_REG_SW_LTR_VALUE); + v = reg_read(sc, IG4_REG_AUTO_LTR_VALUE); + } else if (sc->version == IG4_SKYLAKE) { + v = reg_read(sc, IG4_REG_ACTIVE_LTR_VALUE); + v = reg_read(sc, IG4_REG_IDLE_LTR_VALUE); + } - v = reg_read(sc, IG4_REG_COMP_VER); - if (v != IG4_COMP_VER) { - error = ENXIO; - goto done; + if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { + v = reg_read(sc, IG4_REG_COMP_VER); + if (v != IG4_COMP_VER) { + error = ENXIO; + goto done; + } } v = reg_read(sc, IG4_REG_SS_SCL_HCNT); v = reg_read(sc, IG4_REG_SS_SCL_LCNT); @@ -591,8 +607,13 @@ ig4iic_attach(ig4iic_softc_t *sc) /* * Don't do this, it blows up the PCI config */ - reg_write(sc, IG4_REG_RESETS, IG4_RESETS_ASSERT); - reg_write(sc, IG4_REG_RESETS, IG4_RESETS_DEASSERT); + if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) { + reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_ASSERT_HSW); + reg_write(sc, IG4_REG_RESETS_HSW, IG4_RESETS_DEASSERT_HSW); + } else if (sc->version = IG4_SKYLAKE) { + reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_ASSERT_SKL); + reg_write(sc, IG4_REG_RESETS_SKL, IG4_RESETS_DEASSERT_SKL); + } #endif mtx_lock(&sc->io_lock); @@ -727,14 +748,27 @@ ig4iic_dump(ig4iic_softc_t *sc) REGDUMP(sc, IG4_REG_DMA_RDLR); REGDUMP(sc, IG4_REG_SDA_SETUP); REGDUMP(sc, IG4_REG_ENABLE_STATUS); - REGDUMP(sc, IG4_REG_COMP_PARAM1); - REGDUMP(sc, IG4_REG_COMP_VER); - REGDUMP(sc, IG4_REG_COMP_TYPE); - REGDUMP(sc, IG4_REG_CLK_PARMS); - REGDUMP(sc, IG4_REG_RESETS); - REGDUMP(sc, IG4_REG_GENERAL); - REGDUMP(sc, IG4_REG_SW_LTR_VALUE); - REGDUMP(sc, IG4_REG_AUTO_LTR_VALUE); + if
svn commit: r330559 - in head: . cddl/usr.sbin cddl/usr.sbin/dwatch cddl/usr.sbin/dwatch/examples cddl/usr.sbin/dwatch/libexec etc/mtree share/dtrace
Author: dteske Date: Tue Mar 6 23:44:19 2018 New Revision: 330559 URL: https://svnweb.freebsd.org/changeset/base/330559 Log: Introduce dwatch(1) as a tool for making DTrace more useful Reviewed by: markj, gnn, bdrewery (earlier version) Relnotes: yes Sponsored by: Smule, Inc. Differential Revision:https://reviews.freebsd.org/D10006 Added: head/cddl/usr.sbin/dwatch/ head/cddl/usr.sbin/dwatch/Makefile (contents, props changed) head/cddl/usr.sbin/dwatch/dwatch (contents, props changed) head/cddl/usr.sbin/dwatch/dwatch.1 (contents, props changed) head/cddl/usr.sbin/dwatch/examples/ head/cddl/usr.sbin/dwatch/examples/Makefile (contents, props changed) head/cddl/usr.sbin/dwatch/examples/profile_template (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/ head/cddl/usr.sbin/dwatch/libexec/Makefile (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/chmod (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/errno (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/io (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/ip (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/kill (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/nanosleep (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/open (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/proc (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/rw (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/sched (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/tcp (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/udp (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/vop_create (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/vop_readdir (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/vop_rename (contents, props changed) head/cddl/usr.sbin/dwatch/libexec/vop_symlink (contents, props changed) Deleted: head/share/dtrace/watch_execve head/share/dtrace/watch_kill head/share/dtrace/watch_vop_remove Modified: head/ObsoleteFiles.inc head/cddl/usr.sbin/Makefile head/etc/mtree/BSD.usr.dist head/share/dtrace/Makefile Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Tue Mar 6 23:39:43 2018(r330558) +++ head/ObsoleteFiles.inc Tue Mar 6 23:44:19 2018(r330559) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20180306: remove DTrace scripts made obsolete by dwatch(1) +OLD_FILES+=usr/share/dtrace/watch_execve +OLD_FILES+=usr/share/dtrace/watch_kill +OLD_FILES+=usr/share/dtrace/watch_vop_remove # 20180212: move devmatch OLD_FILES+=usr/sbin/devmatch # 20180211: remove usb.conf Modified: head/cddl/usr.sbin/Makefile == --- head/cddl/usr.sbin/Makefile Tue Mar 6 23:39:43 2018(r330558) +++ head/cddl/usr.sbin/Makefile Tue Mar 6 23:44:19 2018(r330559) @@ -3,6 +3,7 @@ .include SUBDIR=${_dtrace} \ + ${_dwatch} \ ${_lockstat} \ ${_plockstat} \ ${_zdb} \ @@ -23,6 +24,7 @@ _zfsd=zfsd .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" _dtrace= dtrace +_dwatch= dwatch _lockstat= lockstat _plockstat=plockstat .endif @@ -30,15 +32,18 @@ _plockstat= plockstat .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ ${MACHINE_CPUARCH} == "riscv" _dtrace= dtrace +_dwatch= dwatch _lockstat= lockstat .endif .if ${MACHINE_CPUARCH} == "mips" _dtrace= dtrace +_dwatch= dwatch .endif .if ${MACHINE_CPUARCH} == "powerpc" _dtrace= dtrace +_dwatch= dwatch _lockstat= lockstat .endif Added: head/cddl/usr.sbin/dwatch/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.sbin/dwatch/Makefile Tue Mar 6 23:44:19 2018 (r330559) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include + +SUBDIR= libexec + +.if ${MK_EXAMPLES} != "no" +SUBDIR+= examples +.endif + +SCRIPTS= dwatch + +MAN= dwatch.1 + +.include Added: head/cddl/usr.sbin/dwatch/dwatch == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/usr.sbin/dwatch/dwatchTue Mar 6 23:44:19 2018 (r330559) @@ -0,0 +1,1291 @@ +#!/bin/sh +#- +# Copyright (c) 2014-2018 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source co
svn commit: r330560 - head/cddl/usr.sbin/dwatch
Author: dteske Date: Tue Mar 6 23:58:53 2018 New Revision: 330560 URL: https://svnweb.freebsd.org/changeset/base/330560 Log: Bump dwatch(1) internal version from 1.0-beta-91 to 1.0 Modified: head/cddl/usr.sbin/dwatch/dwatch Modified: head/cddl/usr.sbin/dwatch/dwatch == --- head/cddl/usr.sbin/dwatch/dwatchTue Mar 6 23:44:19 2018 (r330559) +++ head/cddl/usr.sbin/dwatch/dwatchTue Mar 6 23:58:53 2018 (r330560) @@ -47,7 +47,7 @@ DTRACE_PRAGMA=" GLOBALS -VERSION='$Version: 1.0-beta-91 $' # -V +VERSION='$Version: 1.0 $' # -V pgm="${0##*/}" # Program basename ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330561 - head/bin/chflags
Author: bdrewery Date: Wed Mar 7 01:55:38 2018 New Revision: 330561 URL: https://svnweb.freebsd.org/changeset/base/330561 Log: chflags: Add SIGINFO support. This is copied from chmod r311668. MFC after:2 weeks Modified: head/bin/chflags/chflags.1 head/bin/chflags/chflags.c Modified: head/bin/chflags/chflags.1 == --- head/bin/chflags/chflags.1 Tue Mar 6 23:58:53 2018(r330560) +++ head/bin/chflags/chflags.1 Wed Mar 7 01:55:38 2018(r330561) @@ -32,7 +32,7 @@ .\"@(#)chflags.1 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd March 4, 2018 +.Dd March 6, 2018 .Dt CHFLAGS 1 .Os .Sh NAME @@ -217,6 +217,16 @@ setting. See .Xr security 7 for more information on this setting. +.Pp +If +.Nm +receives a +.Dv SIGINFO +signal (see the +.Cm status +argument for +.Xr stty 1 ) , +then the current filename as well as the old and new flags are displayed. .Sh EXIT STATUS .Ex -std .Sh SEE ALSO Modified: head/bin/chflags/chflags.c == --- head/bin/chflags/chflags.c Tue Mar 6 23:58:53 2018(r330560) +++ head/bin/chflags/chflags.c Wed Mar 7 01:55:38 2018(r330561) @@ -51,13 +51,23 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +static volatile sig_atomic_t siginfo; + static void usage(void); +static void +siginfo_handler(int sig __unused) +{ + + siginfo = 1; +} + int main(int argc, char *argv[]) { @@ -108,6 +118,8 @@ main(int argc, char *argv[]) if (argc < 2) usage(); + (void)signal(SIGINFO, siginfo_handler); + if (Rflag) { if (hflag) errx(1, "the -R and -h options may not be " @@ -188,13 +200,14 @@ main(int argc, char *argv[]) atflag) == -1 && !fflag) { warn("%s", p->fts_path); rval = 1; - } else if (vflag) { + } else if (vflag || siginfo) { (void)printf("%s", p->fts_path); - if (vflag > 1) + if (vflag > 1 || siginfo) (void)printf(": 0%lo -> 0%lo", (u_long)p->fts_statp->st_flags, newflags); (void)printf("\n"); + siginfo = 0; } } if (errno) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330562 - head/sys/geom/part
Author: cem Date: Wed Mar 7 01:55:50 2018 New Revision: 330562 URL: https://svnweb.freebsd.org/changeset/base/330562 Log: g_part_gpt: Fix memory leak in error path If g_part_gpt_read() encountered a disk with bad primary and secondary tables, it could leak memory. Reported by: Coverity Sponsored by: Dell EMC Isilon Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c == --- head/sys/geom/part/g_part_gpt.c Wed Mar 7 01:55:38 2018 (r330561) +++ head/sys/geom/part/g_part_gpt.c Wed Mar 7 01:55:50 2018 (r330562) @@ -923,6 +923,14 @@ g_part_gpt_read(struct g_part_table *basetable, struct pp->name); printf("GEOM: %s: GPT rejected -- may not be recoverable.\n", pp->name); + if (prihdr != NULL) + g_free(prihdr); + if (pritbl != NULL) + g_free(pritbl); + if (sechdr != NULL) + g_free(sechdr); + if (sectbl != NULL) + g_free(sectbl); return (EINVAL); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330564 - head/stand/lua
Author: kevans Date: Wed Mar 7 04:11:14 2018 New Revision: 330564 URL: https://svnweb.freebsd.org/changeset/base/330564 Log: lualoader: Only loadelf before boot/autoboot if no kernel loaded Back when I "fixed" the loading of kernel/modules to be deferred until booting, I inadvertently broke the ability to manually load a set of kernels and modules in case of something bad having happened. lualoader would instead happily load whatever is specified in loader.conf(5) and go about the boot, leading to a panic loop as you try to rediscover a way to stop the panicky efirt module from loading and fail miserably. Reported by: me, sadly Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua == --- head/stand/lua/core.lua Wed Mar 7 03:54:38 2018(r330563) +++ head/stand/lua/core.lua Wed Mar 7 04:11:14 2018(r330564) @@ -240,12 +240,18 @@ function core.setDefaults() end function core.autoboot(argstr) - config.loadelf() + -- loadelf() only if we've not already loaded a kernel + if loader.getenv("kernelname") == nil then + config.loadelf() + end loader.perform(composeLoaderCmd("autoboot", argstr)) end function core.boot(argstr) - config.loadelf() + -- loadelf() only if we've not already loaded a kernel + if loader.getenv("kernelname") == nil then + config.loadelf() + end loader.perform(composeLoaderCmd("boot", argstr)) end ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"