From owner-svn-src-stable-8@FreeBSD.ORG Sun Nov 18 12:17:14 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC9AF8BC; Sun, 18 Nov 2012 12:17:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 909AC8FC08; Sun, 18 Nov 2012 12:17:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAICHDsm021547; Sun, 18 Nov 2012 12:17:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAICHDUH021545; Sun, 18 Nov 2012 12:17:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211181217.qAICHDUH021545@svn.freebsd.org> From: Andriy Gapon Date: Sun, 18 Nov 2012 12:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243216 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2012 12:17:14 -0000 Author: avg Date: Sun Nov 18 12:17:13 2012 New Revision: 243216 URL: http://svnweb.freebsd.org/changeset/base/243216 Log: MFC r242566: zfs_freebsd_close: call zfs_close with count=1 instead of count=0 Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 18 12:17:07 2012 (r243215) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 18 12:17:13 2012 (r243216) @@ -5660,7 +5660,7 @@ zfs_freebsd_close(ap) } */ *ap; { - return (zfs_close(ap->a_vp, ap->a_fflag, 0, 0, ap->a_cred, NULL)); + return (zfs_close(ap->a_vp, ap->a_fflag, 1, 0, ap->a_cred, NULL)); } static int From owner-svn-src-stable-8@FreeBSD.ORG Sun Nov 18 12:20:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6CBCDEB; Sun, 18 Nov 2012 12:20:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BC2CE8FC14; Sun, 18 Nov 2012 12:20:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAICKN6d022202; Sun, 18 Nov 2012 12:20:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAICKNTI022201; Sun, 18 Nov 2012 12:20:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211181220.qAICKNTI022201@svn.freebsd.org> From: Andriy Gapon Date: Sun, 18 Nov 2012 12:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243218 - stable/8/sys/boot/i386/common X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2012 12:20:23 -0000 Author: avg Date: Sun Nov 18 12:20:23 2012 New Revision: 243218 URL: http://svnweb.freebsd.org/changeset/base/243218 Log: MFC r243025: boot: use packed attribute for edd_params* structures Modified: stable/8/sys/boot/i386/common/edd.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/i386/common/edd.h ============================================================================== --- stable/8/sys/boot/i386/common/edd.h Sun Nov 18 12:20:11 2012 (r243217) +++ stable/8/sys/boot/i386/common/edd.h Sun Nov 18 12:20:23 2012 (r243218) @@ -62,7 +62,7 @@ struct edd_params { uint16_t sector_size; uint16_t edd_params_seg; uint16_t edd_params_off; -}; +} __packed; struct edd_device_path_v3 { uint16_t key; @@ -74,12 +74,12 @@ struct edd_device_path_v3 { uint64_t device_path; uint8_t reserved2[1]; uint8_t checksum; -}; +} __packed; struct edd_params_v3 { struct edd_params params; struct edd_device_path_v3 device_path; -}; +} __packed; struct edd_device_path_v4 { uint16_t key; @@ -91,12 +91,12 @@ struct edd_device_path_v4 { uint64_t device_path[2]; uint8_t reserved2[1]; uint8_t checksum; -}; +} __packed; struct edd_params_v4 { struct edd_params params; struct edd_device_path_v4 device_path; -}; +} __packed; #define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001 #define EDD_FLAGS_REMOVABLE_MEDIA 0x0002 From owner-svn-src-stable-8@FreeBSD.ORG Sun Nov 18 12:30:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92FF32EC; Sun, 18 Nov 2012 12:30:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5DF068FC0C; Sun, 18 Nov 2012 12:30:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAICU5Y6023808; Sun, 18 Nov 2012 12:30:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAICU55p023804; Sun, 18 Nov 2012 12:30:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211181230.qAICU55p023804@svn.freebsd.org> From: Andriy Gapon Date: Sun, 18 Nov 2012 12:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243220 - in stable/8/sys/boot: ficl i386 zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2012 12:30:05 -0000 Author: avg Date: Sun Nov 18 12:30:04 2012 New Revision: 243220 URL: http://svnweb.freebsd.org/changeset/base/243220 Log: MFC r241785: boot: use -march=i386 for both i386 and amd64 builds Modified: stable/8/sys/boot/ficl/Makefile stable/8/sys/boot/i386/Makefile.inc stable/8/sys/boot/zfs/Makefile Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/ficl/Makefile ============================================================================== --- stable/8/sys/boot/ficl/Makefile Sun Nov 18 12:28:29 2012 (r243219) +++ stable/8/sys/boot/ficl/Makefile Sun Nov 18 12:30:04 2012 (r243220) @@ -8,6 +8,7 @@ SRCS= ${BASE_SRCS} sysdep.c softcore.c CLEANFILES= softcore.c testmain testmain.o CFLAGS+= -ffreestanding .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +CFLAGS+= -march=i386 CFLAGS+= -mpreferred-stack-boundary=2 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 .endif @@ -42,7 +43,7 @@ SOFTWORDS= softcore.fr jhlocal.fr marker #SOFTWORDS+= oo.fr classes.fr .if ${MACHINE_ARCH} == "amd64" -CFLAGS+= -m32 -march=i386 -I. +CFLAGS+= -m32 -I. .endif CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/} \ Modified: stable/8/sys/boot/i386/Makefile.inc ============================================================================== --- stable/8/sys/boot/i386/Makefile.inc Sun Nov 18 12:28:29 2012 (r243219) +++ stable/8/sys/boot/i386/Makefile.inc Sun Nov 18 12:30:04 2012 (r243220) @@ -5,12 +5,12 @@ BINDIR?= /boot LOADER_ADDRESS?=0x200000 -CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ +CFLAGS+= -march=i386 -ffreestanding -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 LDFLAGS+= -nostdlib .if ${MACHINE_ARCH} == "amd64" -CFLAGS+= -m32 -march=i386 +CFLAGS+= -m32 LDFLAGS+= -m elf_i386_fbsd AFLAGS+= --32 .endif Modified: stable/8/sys/boot/zfs/Makefile ============================================================================== --- stable/8/sys/boot/zfs/Makefile Sun Nov 18 12:28:29 2012 (r243219) +++ stable/8/sys/boot/zfs/Makefile Sun Nov 18 12:30:04 2012 (r243220) @@ -12,6 +12,7 @@ CFLAGS+= -I${.CURDIR}/../../cddl/boot/zf CFLAGS+= -ffreestanding .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +CFLAGS+= -march=i386 CFLAGS+= -mpreferred-stack-boundary=2 CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 .endif @@ -22,7 +23,7 @@ CFLAGS+= -mno-sse3 CFLAGS+= -msoft-float .endif .if ${MACHINE_ARCH} == "amd64" -CFLAGS+= -m32 -march=i386 +CFLAGS+= -m32 .endif CFLAGS+= -Wformat -Wall From owner-svn-src-stable-8@FreeBSD.ORG Mon Nov 19 04:08:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51D7232D; Mon, 19 Nov 2012 04:08:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3644A8FC0C; Mon, 19 Nov 2012 04:08:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAJ48Bkb078061; Mon, 19 Nov 2012 04:08:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAJ48BqN078060; Mon, 19 Nov 2012 04:08:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211190408.qAJ48BqN078060@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Nov 2012 04:08:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243257 - stable/8/usr.bin/chpass X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 04:08:11 -0000 Author: eadler Date: Mon Nov 19 04:08:10 2012 New Revision: 243257 URL: http://svnweb.freebsd.org/changeset/base/243257 Log: MFC r243081: Avoid possible null deref if ypclnt_new returns null PR: bin/172979 Approved by: cperciva (implicit) Modified: stable/8/usr.bin/chpass/chpass.c Directory Properties: stable/8/usr.bin/chpass/ (props changed) Modified: stable/8/usr.bin/chpass/chpass.c ============================================================================== --- stable/8/usr.bin/chpass/chpass.c Mon Nov 19 04:07:43 2012 (r243256) +++ stable/8/usr.bin/chpass/chpass.c Mon Nov 19 04:08:10 2012 (r243257) @@ -241,8 +241,11 @@ main(int argc, char *argv[]) #ifdef YP case _PWF_NIS: ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host); - if (ypclnt == NULL || - ypclnt_connect(ypclnt) == -1 || + if (ypclnt == NULL) { + warnx("ypclnt_new failed"); + exit(1); + } + if (ypclnt_connect(ypclnt) == -1 || ypclnt_passwd(ypclnt, pw, password) == -1) { warnx("%s", ypclnt->error); ypclnt_free(ypclnt); From owner-svn-src-stable-8@FreeBSD.ORG Mon Nov 19 16:39:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5896FD3B; Mon, 19 Nov 2012 16:39:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3AC768FC16; Mon, 19 Nov 2012 16:39:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAJGdAB6000750; Mon, 19 Nov 2012 16:39:10 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAJGdAiM000749; Mon, 19 Nov 2012 16:39:10 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201211191639.qAJGdAiM000749@svn.freebsd.org> From: Ed Maste Date: Mon, 19 Nov 2012 16:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243287 - stable/8/sys/netinet/libalias X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 16:39:10 -0000 Author: emaste Date: Mon Nov 19 16:39:09 2012 New Revision: 243287 URL: http://svnweb.freebsd.org/changeset/base/243287 Log: MFC r241648: Avoid potential bad pointer dereference. Previously RuleAdd would leave entry->la unset for the first entry in the proxyList. Sponsored by: ADARA Networks Modified: stable/8/sys/netinet/libalias/alias_proxy.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/libalias/alias_proxy.c ============================================================================== --- stable/8/sys/netinet/libalias/alias_proxy.c Mon Nov 19 16:16:34 2012 (r243286) +++ stable/8/sys/netinet/libalias/alias_proxy.c Mon Nov 19 16:39:09 2012 (r243287) @@ -210,13 +210,13 @@ RuleAdd(struct libalias *la, struct prox LIBALIAS_LOCK_ASSERT(la); + entry->la = la; if (la->proxyList == NULL) { la->proxyList = entry; entry->last = NULL; entry->next = NULL; return; } - entry->la = la; rule_index = entry->rule_index; ptr = la->proxyList; From owner-svn-src-stable-8@FreeBSD.ORG Mon Nov 19 21:11:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 517481B4; Mon, 19 Nov 2012 21:11:59 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2B3CA8FC0C; Mon, 19 Nov 2012 21:11:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAJLBxlq042288; Mon, 19 Nov 2012 21:11:59 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAJLBxmA042287; Mon, 19 Nov 2012 21:11:59 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201211192111.qAJLBxmA042287@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 19 Nov 2012 21:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243309 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Nov 2012 21:11:59 -0000 Author: trociny Date: Mon Nov 19 21:11:58 2012 New Revision: 243309 URL: http://svnweb.freebsd.org/changeset/base/243309 Log: MFC r240997: Kernel and modules have "set_vnet" linker set, where virtualized global variables are placed. When a module is loaded by link_elf linker its variables from "set_vnet" linker set are copied to the kernel "set_vnet" ("modspace") and all references to these variables inside the module are relocated accordingly. The issue is when a module is loaded that has references to global variables from another, previously loaded module: these references are not relocated so an invalid address is used when the module tries to access the variable. The example is V_layer3_chain, defined in ipfw module and accessed from ipfw_nat. The same issue is with DPCPU variables, which use "set_pcpu" linker set. Fix this making the link_elf linker on a module load recognize "external" DPCPU/VNET variables defined in the previously loaded modules and relocate them accordingly. For this set_pcpu_list and set_vnet_list are used, where the addresses of modules' "set_pcpu" and "set_vnet" linker sets are stored. Note, archs that use link_elf_obj (amd64) were not affected by this issue. Reviewed by: jhb, julian, zec (initial version) Modified: stable/8/sys/kern/link_elf.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/link_elf.c ============================================================================== --- stable/8/sys/kern/link_elf.c Mon Nov 19 21:10:52 2012 (r243308) +++ stable/8/sys/kern/link_elf.c Mon Nov 19 21:11:58 2012 (r243309) @@ -123,6 +123,15 @@ typedef struct elf_file { #endif } *elf_file_t; +struct elf_set { + Elf_Addr es_start; + Elf_Addr es_stop; + Elf_Addr es_base; + TAILQ_ENTRY(elf_set) es_link; +}; + +TAILQ_HEAD(elf_set_head, elf_set); + #include static int link_elf_link_common_finish(linker_file_t); @@ -181,6 +190,75 @@ static int parse_dynamic(elf_file_t); static int relocate_file(elf_file_t); static int link_elf_preload_parse_symbols(elf_file_t); +static struct elf_set_head set_pcpu_list; +#ifdef VIMAGE +static struct elf_set_head set_vnet_list; +#endif + +static void +elf_set_add(struct elf_set_head *list, Elf_Addr start, Elf_Addr stop, Elf_Addr base) +{ + struct elf_set *set, *iter; + + set = malloc(sizeof(*set), M_LINKER, M_WAITOK); + set->es_start = start; + set->es_stop = stop; + set->es_base = base; + + TAILQ_FOREACH(iter, list, es_link) { + + KASSERT((set->es_start < iter->es_start && set->es_stop < iter->es_stop) || + (set->es_start > iter->es_start && set->es_stop > iter->es_stop), + ("linker sets intersection: to insert: 0x%jx-0x%jx; inserted: 0x%jx-0x%jx", + (uintmax_t)set->es_start, (uintmax_t)set->es_stop, + (uintmax_t)iter->es_start, (uintmax_t)iter->es_stop)); + + if (iter->es_start > set->es_start) { + TAILQ_INSERT_BEFORE(iter, set, es_link); + break; + } + } + + if (iter == NULL) + TAILQ_INSERT_TAIL(list, set, es_link); +} + +static int +elf_set_find(struct elf_set_head *list, Elf_Addr addr, Elf_Addr *start, Elf_Addr *base) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (addr < set->es_start) + return (0); + if (addr < set->es_stop) { + *start = set->es_start; + *base = set->es_base; + return (1); + } + } + + return (0); +} + +static void +elf_set_delete(struct elf_set_head *list, Elf_Addr start) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (start < set->es_start) + break; + if (start == set->es_start) { + TAILQ_REMOVE(list, set, es_link); + free(set, M_LINKER); + return; + } + } + KASSERT(0, ("deleting unknown linker set (start = 0x%jx)", + (uintmax_t)start)); +} + #ifdef GDB static void r_debug_state(struct r_debug *, struct link_map *); @@ -345,6 +423,10 @@ link_elf_init(void* arg) (void)link_elf_link_common_finish(linker_kernel_file); linker_kernel_file->flags |= LINKER_FILE_LINKED; + TAILQ_INIT(&set_pcpu_list); +#ifdef VIMAGE + TAILQ_INIT(&set_vnet_list); +#endif } SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, 0); @@ -515,6 +597,8 @@ parse_dpcpu(elf_file_t ef) return (ENOSPC); memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, count); dpcpu_copy((void *)ef->pcpu_base, count); + elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, + ef->pcpu_base); return (0); } @@ -544,6 +628,8 @@ parse_vnet(elf_file_t ef) return (ENOSPC); memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, count); vnet_data_copy((void *)ef->vnet_base, count); + elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, + ef->vnet_base); return (0); } @@ -995,11 +1081,13 @@ link_elf_unload_file(linker_file_t file) if (ef->pcpu_base != 0) { dpcpu_free((void *)ef->pcpu_base, ef->pcpu_stop - ef->pcpu_start); + elf_set_delete(&set_pcpu_list, ef->pcpu_start); } #ifdef VIMAGE if (ef->vnet_base != 0) { vnet_data_free((void *)ef->vnet_base, ef->vnet_stop - ef->vnet_start); + elf_set_delete(&set_vnet_list, ef->vnet_start); } #endif #ifdef GDB @@ -1438,6 +1526,7 @@ elf_lookup(linker_file_t lf, Elf_Size sy elf_file_t ef = (elf_file_t)lf; const Elf_Sym *sym; const char *symbol; + Elf_Addr addr, start, base; /* Don't even try to lookup the symbol if the index is bogus. */ if (symidx >= ef->nchains) @@ -1469,7 +1558,15 @@ elf_lookup(linker_file_t lf, Elf_Size sy if (*symbol == 0) return (0); - return ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); + addr = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps)); + + if (elf_set_find(&set_pcpu_list, addr, &start, &base)) + addr = addr - start + base; +#ifdef VIMAGE + else if (elf_set_find(&set_vnet_list, addr, &start, &base)) + addr = addr - start + base; +#endif + return addr; } static void From owner-svn-src-stable-8@FreeBSD.ORG Wed Nov 21 00:31:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F3AE58D; Wed, 21 Nov 2012 00:31:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6210E8FC13; Wed, 21 Nov 2012 00:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAL0VvtR024964; Wed, 21 Nov 2012 00:31:57 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAL0VvAY024963; Wed, 21 Nov 2012 00:31:57 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211210031.qAL0VvAY024963@svn.freebsd.org> From: Eitan Adler Date: Wed, 21 Nov 2012 00:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243351 - stable/8/usr.bin/mktemp X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2012 00:31:57 -0000 Author: eadler Date: Wed Nov 21 00:31:56 2012 New Revision: 243351 URL: http://svnweb.freebsd.org/changeset/base/243351 Log: MFC r243240: Use the macro for standard error return values. .Dd not bumped because there is no important content change. Obtained from: DragonflyBSD Approved by: cperciva (implicit) Modified: stable/8/usr.bin/mktemp/mktemp.1 Directory Properties: stable/8/usr.bin/mktemp/ (props changed) Modified: stable/8/usr.bin/mktemp/mktemp.1 ============================================================================== --- stable/8/usr.bin/mktemp/mktemp.1 Wed Nov 21 00:31:56 2012 (r243350) +++ stable/8/usr.bin/mktemp/mktemp.1 Wed Nov 21 00:31:56 2012 (r243351) @@ -162,10 +162,7 @@ Use of this option is not encouraged. .El .Sh EXIT STATUS -The -.Nm -utility -exits 0 on success, and 1 if an error occurs. +.Ex -std .Sh EXAMPLES The following .Xr sh 1 From owner-svn-src-stable-8@FreeBSD.ORG Wed Nov 21 00:40:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1AA4CBD1; Wed, 21 Nov 2012 00:40:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0000C8FC1B; Wed, 21 Nov 2012 00:40:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAL0eQNm026867; Wed, 21 Nov 2012 00:40:26 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAL0eQgx026865; Wed, 21 Nov 2012 00:40:26 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211210040.qAL0eQgx026865@svn.freebsd.org> From: Eitan Adler Date: Wed, 21 Nov 2012 00:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243353 - stable/8/share/man/man7 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2012 00:40:27 -0000 Author: eadler Date: Wed Nov 21 00:40:26 2012 New Revision: 243353 URL: http://svnweb.freebsd.org/changeset/base/243353 Log: MFC r243241: Modernize parts of the ports.7 manual page. Approved by: cperciva (implicit) Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Wed Nov 21 00:31:57 2012 (r243352) +++ stable/8/share/man/man7/ports.7 Wed Nov 21 00:40:26 2012 (r243353) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 9, 2012 +.Dd November 18, 2012 .Dt PORTS 7 .Os .Sh NAME @@ -41,7 +41,7 @@ Each .Em port contains any patches necessary to make the original application source code compile and run on -.Bx . +.Fx . Compiling an application is as simple as typing .Nm make Cm build @@ -56,19 +56,6 @@ simply type .Nm make Cm install to install the application. .Pp -It is possible to download and use ports from the -.Fx -repository -that are newer than the installed system; however it is important to -install the appropriate -.Dq "Upgrade Kit" -from -.Pa http://www.FreeBSD.org/ports/ -first! -The -.Xr portcheckout 1 Pq Pa ports/ports-mgmt/portcheckout -script (also a port, of course!) will help to download new ports. -.Pp For more information about using ports, see .Dq "Packages and Ports" in From owner-svn-src-stable-8@FreeBSD.ORG Wed Nov 21 01:01:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 65A58380; Wed, 21 Nov 2012 01:01:19 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4BC448FC13; Wed, 21 Nov 2012 01:01:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAL11Js9030965; Wed, 21 Nov 2012 01:01:19 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAL11Jwq030963; Wed, 21 Nov 2012 01:01:19 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211210101.qAL11Jwq030963@svn.freebsd.org> From: Eitan Adler Date: Wed, 21 Nov 2012 01:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243357 - stable/8/sys/dev/uart X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2012 01:01:19 -0000 Author: eadler Date: Wed Nov 21 01:01:18 2012 New Revision: 243357 URL: http://svnweb.freebsd.org/changeset/base/243357 Log: MFC r243000: Add support for CIR1000 - Cirrus Logic V34 to the uart driver Approved by: cperciva (implicit) Modified: stable/8/sys/dev/uart/uart_bus_isa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/uart/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus_isa.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_isa.c Wed Nov 21 01:01:17 2012 (r243356) +++ stable/8/sys/dev/uart/uart_bus_isa.c Wed Nov 21 01:01:18 2012 (r243357) @@ -79,6 +79,7 @@ static struct isa_pnp_id isa_ns8250_ids[ {0x0034490a, NULL}, /* BRI3400 - Internal ACF Modem */ {0x0094490a, NULL}, /* BRI9400 - Boca K56Flex PnP */ {0x00b4490a, NULL}, /* BRIB400 - Boca 56k PnP */ + {0x0010320d, NULL}, /* CIR1000 - Cirrus Logic V34 */ {0x0030320d, NULL}, /* CIR3000 - Cirrus Logic V43 */ {0x0100440e, NULL}, /* CRD0001 - Cardinal MVP288IV ? */ {0x01308c0e, NULL}, /* CTL3001 - Creative Labs Phoneblaster */ From owner-svn-src-stable-8@FreeBSD.ORG Thu Nov 22 00:25:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0326BB1; Thu, 22 Nov 2012 00:25:58 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 85AD88FC0C; Thu, 22 Nov 2012 00:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAM0Pw8Q060979; Thu, 22 Nov 2012 00:25:58 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAM0PwVL060970; Thu, 22 Nov 2012 00:25:58 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201211220025.qAM0PwVL060970@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 22 Nov 2012 00:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243383 - stable/8/sys/netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2012 00:25:58 -0000 Author: ae Date: Thu Nov 22 00:25:57 2012 New Revision: 243383 URL: http://svnweb.freebsd.org/changeset/base/243383 Log: MFC r243028: zoneid has unsigned type. MFC r243029: SCOPE6_LOCK protects V_sid_default, no need to acquire it without any access to V_sid_default. MFC r243031: if_afdata lock was converted from mutex to rwlock a long ago, so we can replace IF_AFDATA_LOCK() macro depending to the access type. MFC r243148: Reduce the overhead of locking, use IF_AFDATA_RLOCK() when we are doing simple lookups. Modified: stable/8/sys/netinet6/icmp6.c stable/8/sys/netinet6/in6_src.c stable/8/sys/netinet6/ip6_input.c stable/8/sys/netinet6/nd6.c stable/8/sys/netinet6/nd6_rtr.c stable/8/sys/netinet6/scope6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/icmp6.c Thu Nov 22 00:25:57 2012 (r243383) @@ -2600,9 +2600,9 @@ icmp6_redirect_output(struct mbuf *m0, s struct nd_opt_hdr *nd_opt; char *lladdr; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(router_ll6, 0, ifp); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) goto nolladdropt; Modified: stable/8/sys/netinet6/in6_src.c ============================================================================== --- stable/8/sys/netinet6/in6_src.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/in6_src.c Thu Nov 22 00:25:57 2012 (r243383) @@ -608,9 +608,9 @@ selectroute(struct sockaddr_in6 *dstsock rt = ron->ro_rt; ifp = rt->rt_ifp; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (la != NULL) LLE_RUNLOCK(la); else { Modified: stable/8/sys/netinet6/ip6_input.c ============================================================================== --- stable/8/sys/netinet6/ip6_input.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/ip6_input.c Thu Nov 22 00:25:57 2012 (r243383) @@ -542,10 +542,10 @@ passin: dst6.sin6_len = sizeof(struct sockaddr_in6); dst6.sin6_addr = ip6->ip6_dst; ifp = m->m_pkthdr.rcvif; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); lle = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&dst6); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((lle != NULL) && (lle->la_flags & LLE_IFADDR)) { struct ifaddr *ifa; struct in6_ifaddr *ia6; Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/nd6.c Thu Nov 22 00:25:57 2012 (r243383) @@ -977,12 +977,12 @@ nd6_is_addr_neighbor(struct sockaddr_in6 * Even if the address matches none of our addresses, it might be * in the neighbor cache. */ - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (rc); } @@ -1402,9 +1402,9 @@ nd6_ioctl(u_long cmd, caddr_t data, stru if ((error = in6_setscope(&nb_addr, ifp, NULL)) != 0) return (error); - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(&nb_addr, 0, ifp); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) { error = EINVAL; @@ -2096,9 +2096,9 @@ nd6_storelladdr(struct ifnet *ifp, struc /* * the entry should have been created in nd6_store_lladdr */ - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = lla_lookup(LLTABLE6(ifp), 0, dst); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((ln == NULL) || !(ln->la_flags & LLE_VALID)) { if (ln != NULL) LLE_RUNLOCK(ln); Modified: stable/8/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/8/sys/netinet6/nd6_rtr.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/nd6_rtr.c Thu Nov 22 00:25:57 2012 (r243383) @@ -647,13 +647,13 @@ defrouter_select(void) * the ordering rule of the list described in defrtrlist_update(). */ TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { - IF_AFDATA_LOCK(dr->ifp); + IF_AFDATA_RLOCK(dr->ifp); if (selected_dr == NULL && (ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln)) { selected_dr = dr; } - IF_AFDATA_UNLOCK(dr->ifp); + IF_AFDATA_RUNLOCK(dr->ifp); if (ln != NULL) { LLE_RUNLOCK(ln); ln = NULL; @@ -681,13 +681,13 @@ defrouter_select(void) else selected_dr = TAILQ_NEXT(installed_dr, dr_entry); } else if (installed_dr) { - IF_AFDATA_LOCK(installed_dr->ifp); + IF_AFDATA_RLOCK(installed_dr->ifp); if ((ln = nd6_lookup(&installed_dr->rtaddr, 0, installed_dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln) && rtpref(selected_dr) <= rtpref(installed_dr)) { selected_dr = installed_dr; } - IF_AFDATA_UNLOCK(installed_dr->ifp); + IF_AFDATA_RUNLOCK(installed_dr->ifp); if (ln != NULL) LLE_RUNLOCK(ln); } @@ -1330,9 +1330,9 @@ find_pfxlist_reachable_router(struct nd_ int canreach; LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) { - IF_AFDATA_LOCK(pfxrtr->router->ifp); + IF_AFDATA_RLOCK(pfxrtr->router->ifp); ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp); - IF_AFDATA_UNLOCK(pfxrtr->router->ifp); + IF_AFDATA_RUNLOCK(pfxrtr->router->ifp); if (ln == NULL) continue; canreach = ND6_IS_LLINFO_PROBREACH(ln); Modified: stable/8/sys/netinet6/scope6.c ============================================================================== --- stable/8/sys/netinet6/scope6.c Thu Nov 22 00:22:54 2012 (r243382) +++ stable/8/sys/netinet6/scope6.c Thu Nov 22 00:25:57 2012 (r243383) @@ -121,11 +121,11 @@ scope6_set(struct ifnet *ifp, struct sco int error = 0; struct scope6_id *sid = NULL; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_WLOCK(ifp); sid = SID(ifp); if (!sid) { /* paranoid? */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -139,7 +139,6 @@ scope6_set(struct ifnet *ifp, struct sco * interface addresses, routing table entries, PCB entries... */ - SCOPE6_LOCK(); for (i = 0; i < 16; i++) { if (idlist->s6id_list[i] && idlist->s6id_list[i] != sid->s6id_list[i]) { @@ -149,8 +148,7 @@ scope6_set(struct ifnet *ifp, struct sco */ if (i == IPV6_ADDR_SCOPE_INTFACELOCAL && idlist->s6id_list[i] != ifp->if_index) { - IF_AFDATA_UNLOCK(ifp); - SCOPE6_UNLOCK(); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -162,8 +160,7 @@ scope6_set(struct ifnet *ifp, struct sco * IDs, but we check the consistency for * safety in later use. */ - IF_AFDATA_UNLOCK(ifp); - SCOPE6_UNLOCK(); + IF_AFDATA_WUNLOCK(ifp); return (EINVAL); } @@ -175,8 +172,7 @@ scope6_set(struct ifnet *ifp, struct sco sid->s6id_list[i] = idlist->s6id_list[i]; } } - SCOPE6_UNLOCK(); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); return (error); } @@ -184,20 +180,19 @@ scope6_set(struct ifnet *ifp, struct sco int scope6_get(struct ifnet *ifp, struct scope6_id *idlist) { - /* We only need to lock the interface's afdata for SID() to work. */ - IF_AFDATA_LOCK(ifp); - struct scope6_id *sid = SID(ifp); + struct scope6_id *sid; + /* We only need to lock the interface's afdata for SID() to work. */ + IF_AFDATA_RLOCK(ifp); + sid = SID(ifp); if (sid == NULL) { /* paranoid? */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (EINVAL); } - SCOPE6_LOCK(); *idlist = *sid; - SCOPE6_UNLOCK(); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (0); } @@ -388,7 +383,7 @@ sa6_recoverscope(struct sockaddr_in6 *si zoneid = ntohs(sin6->sin6_addr.s6_addr16[1]); if (zoneid) { /* sanity check */ - if (zoneid < 0 || V_if_index < zoneid) + if (V_if_index < zoneid) return (ENXIO); if (!ifnet_byindex(zoneid)) return (ENXIO); @@ -414,7 +409,7 @@ in6_setscope(struct in6_addr *in6, struc u_int32_t zoneid = 0; struct scope6_id *sid; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); sid = SID(ifp); @@ -431,19 +426,17 @@ in6_setscope(struct in6_addr *in6, struc */ if (IN6_IS_ADDR_LOOPBACK(in6)) { if (!(ifp->if_flags & IFF_LOOPBACK)) { - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (EINVAL); } else { if (ret_id != NULL) *ret_id = 0; /* there's no ambiguity */ - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); return (0); } } scope = in6_addrscope(in6); - - SCOPE6_LOCK(); switch (scope) { case IPV6_ADDR_SCOPE_INTFACELOCAL: /* should be interface index */ zoneid = sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL]; @@ -465,8 +458,7 @@ in6_setscope(struct in6_addr *in6, struc zoneid = 0; /* XXX: treat as global. */ break; } - SCOPE6_UNLOCK(); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ret_id != NULL) *ret_id = zoneid; From owner-svn-src-stable-8@FreeBSD.ORG Thu Nov 22 22:52:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FCB6FF; Thu, 22 Nov 2012 22:52:16 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 21E2F8FC16; Thu, 22 Nov 2012 22:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAMMqFBh080181; Thu, 22 Nov 2012 22:52:15 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAMMqFu9080179; Thu, 22 Nov 2012 22:52:15 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <201211222252.qAMMqFu9080179@svn.freebsd.org> From: "Simon L. Nielsen" Date: Thu, 22 Nov 2012 22:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243417 - releng/7.4 releng/7.4/contrib/bind9/bin/named releng/7.4/contrib/bind9/lib/dns releng/7.4/contrib/bind9/lib/dns/include/dns releng/7.4/sys/compat/linux releng/7.4/sys/conf rel... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2012 22:52:16 -0000 Author: simon Date: Thu Nov 22 22:52:15 2012 New Revision: 243417 URL: http://svnweb.freebsd.org/changeset/base/243417 Log: Fix multiple Denial of Service vulnerabilities with named(8). Fix insufficient message length validation for EAP-TLS messages. Fix Linux compatibility layer input validation error. Security: FreeBSD-SA-12:06.bind Security: FreeBSD-SA-12:07.hostapd Security: FreeBSD-SA-12:08.linux Security: CVE-2012-4244, CVE-2012-5166, CVE-2012-4445, CVE-2012-4576 Approved by: re Approved by: security-officer Modified: stable/8/contrib/wpa/src/eap_server/eap_tls_common.c stable/8/sys/compat/linux/linux_ioctl.c Changes in other areas also in this revision: Modified: releng/7.4/UPDATING releng/7.4/contrib/bind9/bin/named/query.c releng/7.4/contrib/bind9/lib/dns/include/dns/rdata.h releng/7.4/contrib/bind9/lib/dns/master.c releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/sys/compat/linux/linux_ioctl.c releng/7.4/sys/conf/newvers.sh releng/8.3/UPDATING releng/8.3/contrib/bind9/bin/named/query.c releng/8.3/contrib/bind9/lib/dns/include/dns/rdata.h releng/8.3/contrib/bind9/lib/dns/master.c releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/wpa/src/eap_server/eap_tls_common.c releng/8.3/sys/compat/linux/linux_ioctl.c releng/8.3/sys/conf/newvers.sh releng/9.0/UPDATING releng/9.0/contrib/bind9/bin/named/query.c releng/9.0/contrib/bind9/lib/dns/include/dns/rdata.h releng/9.0/contrib/bind9/lib/dns/master.c releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/wpa/src/eap_server/eap_server_tls_common.c releng/9.0/sys/compat/linux/linux_ioctl.c releng/9.0/sys/conf/newvers.sh releng/9.1/contrib/wpa/src/eap_server/eap_server_tls_common.c releng/9.1/sys/compat/linux/linux_ioctl.c stable/9/contrib/wpa/src/eap_server/eap_server_tls_common.c stable/9/sys/compat/linux/linux_ioctl.c Modified: stable/8/contrib/wpa/src/eap_server/eap_tls_common.c ============================================================================== --- stable/8/contrib/wpa/src/eap_server/eap_tls_common.c Thu Nov 22 22:10:10 2012 (r243416) +++ stable/8/contrib/wpa/src/eap_server/eap_tls_common.c Thu Nov 22 22:52:15 2012 (r243417) @@ -220,6 +220,13 @@ static int eap_server_tls_process_fragme " over 64 kB)"); return -1; } + if (len > message_length) { + wpa_printf(MSG_INFO, "SSL: Too much data (%d bytes) in " + "first fragment of frame (TLS Message " + "Length %d bytes)", + (int) len, (int) message_length); + return -1; + } data->in_buf = wpabuf_alloc(message_length); if (data->in_buf == NULL) { Modified: stable/8/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/8/sys/compat/linux/linux_ioctl.c Thu Nov 22 22:10:10 2012 (r243416) +++ stable/8/sys/compat/linux/linux_ioctl.c Thu Nov 22 22:52:15 2012 (r243417) @@ -2253,8 +2253,9 @@ again: ifc.ifc_len = valid_len; sbuf_finish(sb); - memcpy(PTRIN(ifc.ifc_buf), sbuf_data(sb), ifc.ifc_len); - error = copyout(&ifc, uifc, sizeof(ifc)); + error = copyout(sbuf_data(sb), PTRIN(ifc.ifc_buf), ifc.ifc_len); + if (error == 0) + error = copyout(&ifc, uifc, sizeof(ifc)); sbuf_delete(sb); CURVNET_RESTORE(); From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 23 13:18:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA340587; Fri, 23 Nov 2012 13:18:26 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF4C88FC14; Fri, 23 Nov 2012 13:18:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qANDIQFU020244; Fri, 23 Nov 2012 13:18:26 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qANDIQw6020243; Fri, 23 Nov 2012 13:18:26 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201211231318.qANDIQw6020243@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 23 Nov 2012 13:18:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243447 - stable/8/sys/boot/pc98 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2012 13:18:26 -0000 Author: nyan Date: Fri Nov 23 13:18:26 2012 New Revision: 243447 URL: http://svnweb.freebsd.org/changeset/base/243447 Log: MFC: r242855, r242865 - use -march=i386 for both i386 and amd64 builds. - cosmetic changes to reduce diffs against i386. Modified: stable/8/sys/boot/pc98/Makefile.inc Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/pc98/Makefile.inc ============================================================================== --- stable/8/sys/boot/pc98/Makefile.inc Fri Nov 23 13:17:18 2012 (r243446) +++ stable/8/sys/boot/pc98/Makefile.inc Fri Nov 23 13:18:26 2012 (r243447) @@ -5,9 +5,9 @@ BINDIR?= /boot LOADER_ADDRESS?=0x200000 -CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ - -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ - -Os -DPC98 +CFLAGS+= -march=i386 -ffreestanding -mpreferred-stack-boundary=2 \ + -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 +CFLAGS+= -Os -DPC98 LDFLAGS+= -nostdlib # BTX components From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 23 13:36:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5823A44; Fri, 23 Nov 2012 13:36:09 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BA3B38FC13; Fri, 23 Nov 2012 13:36:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qANDa9r1023138; Fri, 23 Nov 2012 13:36:09 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qANDa9kI023132; Fri, 23 Nov 2012 13:36:09 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201211231336.qANDa9kI023132@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 23 Nov 2012 13:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243449 - in stable/8/sys/boot/pc98: boot2 btx/btxldr btx/lib cdboot libpc98 loader X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2012 13:36:10 -0000 Author: nyan Date: Fri Nov 23 13:36:09 2012 New Revision: 243449 URL: http://svnweb.freebsd.org/changeset/base/243449 Log: MFC: r239063, r239064, r239069, r240852, r240854 - boot2: bunch of variables are turned into uint8_t. - boot2: Remove unnecessary initializations. - loader: replace ugly inb/outb re-implementations with cpufunc.h. - Reduce diffs against i386. Modified: stable/8/sys/boot/pc98/boot2/boot2.c stable/8/sys/boot/pc98/btx/btxldr/btxldr.S stable/8/sys/boot/pc98/btx/lib/btxcsu.S stable/8/sys/boot/pc98/cdboot/cdboot.S stable/8/sys/boot/pc98/libpc98/Makefile stable/8/sys/boot/pc98/loader/main.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/pc98/boot2/boot2.c Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/boot2/boot2.c Fri Nov 23 13:36:09 2012 (r243449) @@ -126,13 +126,13 @@ static struct dsk { unsigned unit; unsigned head; unsigned sec; - unsigned slice; - unsigned part; + uint8_t slice; + uint8_t part; unsigned start; } dsk; static char cmd[512], cmddup[512], knamebuf[1024]; -static const char *kname = NULL; -static uint32_t opts = 0; +static const char *kname; +static uint32_t opts; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -616,7 +616,8 @@ dskread(void *buf, unsigned lba, unsigne struct pc98_partition *dp; struct disklabel *d; char *sec; - unsigned sl, i; + unsigned i; + uint8_t sl; u_char *p; if (!dsk_meta) { Modified: stable/8/sys/boot/pc98/btx/btxldr/btxldr.S ============================================================================== --- stable/8/sys/boot/pc98/btx/btxldr/btxldr.S Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/btx/btxldr/btxldr.S Fri Nov 23 13:36:09 2012 (r243449) @@ -15,13 +15,13 @@ * $FreeBSD$ */ +#include + /* * Prototype BTX loader program, written in a couple of hours. The * real thing should probably be more flexible, and in C. */ -#include - /* * Memory locations. */ Modified: stable/8/sys/boot/pc98/btx/lib/btxcsu.S ============================================================================== --- stable/8/sys/boot/pc98/btx/lib/btxcsu.S Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/btx/lib/btxcsu.S Fri Nov 23 13:36:09 2012 (r243449) @@ -15,12 +15,12 @@ # $FreeBSD$ +#include + # # BTX C startup code (ELF). # -#include - # # Globals. # Modified: stable/8/sys/boot/pc98/cdboot/cdboot.S ============================================================================== --- stable/8/sys/boot/pc98/cdboot/cdboot.S Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/cdboot/cdboot.S Fri Nov 23 13:36:09 2012 (r243449) @@ -30,14 +30,14 @@ # $FreeBSD$ -#include - # # Basically, we first create a set of boot arguments to pass to the loaded # binary. Then we attempt to load /boot/loader from the CD we were booted # off of. # +#include + # # Memory locations. # Modified: stable/8/sys/boot/pc98/libpc98/Makefile ============================================================================== --- stable/8/sys/boot/pc98/libpc98/Makefile Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/libpc98/Makefile Fri Nov 23 13:36:09 2012 (r243449) @@ -37,7 +37,8 @@ CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ +CFLAGS+= -I${.CURDIR}/../../common \ + -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../i386/libi386 \ -I${.CURDIR}/../../.. -I. # the location of libstand Modified: stable/8/sys/boot/pc98/loader/main.c ============================================================================== --- stable/8/sys/boot/pc98/loader/main.c Fri Nov 23 13:35:17 2012 (r243448) +++ stable/8/sys/boot/pc98/loader/main.c Fri Nov 23 13:36:09 2012 (r243449) @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "bootstrap.h" @@ -190,9 +192,9 @@ main(void) static void extract_currdev(void) { - struct i386_devdesc new_currdev; - int major; - int biosdev = -1; + struct i386_devdesc new_currdev; + int major; + int biosdev = -1; /* Assume we are booting from a BIOS disk by default */ new_currdev.d_dev = &biosdisk; @@ -238,7 +240,7 @@ extract_currdev(void) } } new_currdev.d_type = new_currdev.d_dev->dv_type; - + /* * If we are booting off of a BIOS disk and we didn't succeed in determining * which one we booted off of, just use disk0: as a reasonable default. @@ -249,6 +251,7 @@ extract_currdev(void) "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); new_currdev.d_unit = 0; } + env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), i386_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, @@ -289,33 +292,17 @@ command_heap(int argc, char *argv[]) return(CMD_OK); } -/* ISA bus access functions for PnP, derived from */ -static int +/* ISA bus access functions for PnP. */ +static int isa_inb(int port) { - u_char data; - - if (__builtin_constant_p(port) && - (((port) & 0xffff) < 0x100) && - ((port) < 0x10000)) { - __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); - } else { - __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); - } - return(data); + + return (inb(port)); } static void isa_outb(int port, int value) { - u_char al = value; - - if (__builtin_constant_p(port) && - (((port) & 0xffff) < 0x100) && - ((port) < 0x10000)) { - __asm __volatile("outb %0,%1" : : "a" (al), "id" ((u_short)(port))); - } else { - __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); - } -} + outb(port, value); +} From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 23 15:44:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF211123; Fri, 23 Nov 2012 15:44:04 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D48E78FC08; Fri, 23 Nov 2012 15:44:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qANFi4vc043206; Fri, 23 Nov 2012 15:44:04 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qANFi4cH043205; Fri, 23 Nov 2012 15:44:04 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201211231544.qANFi4cH043205@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 23 Nov 2012 15:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243461 - stable/8/sys/pc98/pc98 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2012 15:44:05 -0000 Author: nyan Date: Fri Nov 23 15:44:04 2012 New Revision: 243461 URL: http://svnweb.freebsd.org/changeset/base/243461 Log: MFC: r225977, r242867, r242868, r242869 MFi386: r225936 Add some improvements in the idle table callbacks: - Replace instances of manual assembly instruction "hlt" call with halt() function calling. - In cpu_idle_mwait() avoid races in check to sched_runnable() using the same pattern used in cpu_idle_hlt() with the 'hlt' instruction. - Add comments explaining the logic behind the pattern used in cpu_idle_hlt() and other idle callbacks. MFi386: r211924 Register an interrupt vector for DTrace return probes. Fix some KASSERTs. They are missing changes from r208833, r227394 and r227442. Reduce diffs against i386. Modified: stable/8/sys/pc98/pc98/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/pc98/ (props changed) Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Fri Nov 23 15:42:25 2012 (r243460) +++ stable/8/sys/pc98/pc98/machdep.c Fri Nov 23 15:44:04 2012 (r243461) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "opt_maxmem.h" #include "opt_npx.h" #include "opt_perfmon.h" +#include "opt_kdtrace.h" #include #include @@ -1122,7 +1123,7 @@ void cpu_halt(void) { for (;;) - __asm__ ("hlt"); + halt(); } static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ @@ -1141,9 +1142,22 @@ cpu_idle_hlt(int busy) state = (int *)PCPU_PTR(monitorbuf); *state = STATE_SLEEPING; + /* - * We must absolutely guarentee that hlt is the next instruction - * after sti or we introduce a timing window. + * Since we may be in a critical section from cpu_idle(), if + * an interrupt fires during that critical section we may have + * a pending preemption. If the CPU halts, then that thread + * may not execute until a later interrupt awakens the CPU. + * To handle this race, check for a runnable thread after + * disabling interrupts and immediately return if one is + * found. Also, we must absolutely guarentee that hlt is + * the next instruction after sti. This ensures that any + * interrupt that fires after the call to disable_intr() will + * immediately awaken the CPU from hlt. Finally, please note + * that on x86 this works fine because of interrupts enabled only + * after the instruction following sti takes place, while IF is set + * to 1 immediately, allowing hlt instruction to acknowledge the + * interrupt. */ disable_intr(); if (sched_runnable()) @@ -1169,11 +1183,19 @@ cpu_idle_mwait(int busy) state = (int *)PCPU_PTR(monitorbuf); *state = STATE_MWAIT; - if (!sched_runnable()) { - cpu_monitor(state, 0, 0); - if (*state == STATE_MWAIT) - cpu_mwait(0, MWAIT_C1); + + /* See comments in cpu_idle_hlt(). */ + disable_intr(); + if (sched_runnable()) { + enable_intr(); + *state = STATE_RUNNING; + return; } + cpu_monitor(state, 0, 0); + if (*state == STATE_MWAIT) + __asm __volatile("sti; mwait" : : "a" (MWAIT_C1), "c" (0)); + else + enable_intr(); *state = STATE_RUNNING; } @@ -1185,6 +1207,12 @@ cpu_idle_spin(int busy) state = (int *)PCPU_PTR(monitorbuf); *state = STATE_RUNNING; + + /* + * The sched_runnable() call is racy but as long as there is + * a loop missing it one time will have just a little impact if any + * (and it is much better than missing the check at all). + */ for (i = 0; i < 1000; i++) { if (sched_runnable()) return; @@ -1198,7 +1226,7 @@ void cpu_idle(int busy) { -#ifdef SMP +#if defined(SMP) if (mp_grab_cpu_hlt()) return; #endif @@ -1708,7 +1736,11 @@ extern inthand_t IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm), IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot), IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align), - IDTVEC(xmm), IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall); + IDTVEC(xmm), +#ifdef KDTRACE_HOOKS + IDTVEC(dtrace_ret), +#endif + IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall); #ifdef DDB /* @@ -2088,6 +2120,8 @@ do_next: for (off = 0; off < round_page(msgbufsize); off += PAGE_SIZE) pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + off); + + PT_UPDATES_FLUSH(); } void @@ -2227,6 +2261,10 @@ init386(first) GSEL(GCODE_SEL, SEL_KPL)); setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); +#ifdef KDTRACE_HOOKS + setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386TGT, SEL_UPL, + GSEL(GCODE_SEL, SEL_KPL)); +#endif r_idt.rd_limit = sizeof(idt0) - 1; r_idt.rd_base = (int) idt; @@ -2563,7 +2601,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); #ifdef DEV_NPX npxgetregs(td); @@ -2732,6 +2771,7 @@ static void fpstate_drop(struct thread *td) { + KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu")); critical_enter(); #ifdef DEV_NPX if (PCPU_GET(fpcurthread) == td) From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 23 21:27:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEF512DC; Fri, 23 Nov 2012 21:27:26 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A3FE98FC1C; Fri, 23 Nov 2012 21:27:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qANLRQnB098045; Fri, 23 Nov 2012 21:27:26 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qANLRQfC098042; Fri, 23 Nov 2012 21:27:26 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <201211232127.qANLRQfC098042@svn.freebsd.org> From: Remko Lodder Date: Fri, 23 Nov 2012 21:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243466 - stable/8/sbin/ifconfig X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2012 21:27:26 -0000 Author: remko Date: Fri Nov 23 21:27:26 2012 New Revision: 243466 URL: http://svnweb.freebsd.org/changeset/base/243466 Log: MFC r232486 Add an ifconfig carp option that enables users to set the state of the carp cluster. This is a direct commit to stable/9 because -HEAD's code is very different. I discussed this with Gleb and the reason for this is that since we do not touch the kernel itself and are not adding very weird or confusing things, we can commit this to the stable branch directly. The options 'master' and 'backup' are now available, which enables the administrator to force a node into the backup or master state on the cluster. Ofcourse preempt has to be disabled otherwise the master node will become master again. One can do that with: sysctl net.inet.carp.preempt=0 After that one can schedule maintenance on the node normally running as the master and such. PR: 100956 Discussed with: glebius Modified: stable/8/sbin/ifconfig/ifcarp.c stable/8/sbin/ifconfig/ifconfig.8 Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/ifcarp.c ============================================================================== --- stable/8/sbin/ifconfig/ifcarp.c Fri Nov 23 20:04:39 2012 (r243465) +++ stable/8/sbin/ifconfig/ifcarp.c Fri Nov 23 21:27:26 2012 (r243466) @@ -57,6 +57,7 @@ void setcarp_advbase(const char *,int, i void setcarp_advskew(const char *, int, int, const struct afswtch *rafp); void setcarp_passwd(const char *, int, int, const struct afswtch *rafp); void setcarp_vhid(const char *, int, int, const struct afswtch *rafp); +void setcarp_state(const char *, int, int, const struct afswtch *rafp); void carp_status(int s) @@ -175,11 +176,34 @@ setcarp_advbase(const char *val, int d, return; } +void setcarp_state(const char *val, int d, int s, const struct afswtch *afp) +{ + struct carpreq carpr; + int i; + + bzero((char *)&carpr, sizeof(struct carpreq)); + ifr.ifr_data = (caddr_t)&carpr; + + if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + err(1, "SIOCGVH"); + + for (i = 0; i <= CARP_MAXSTATE; i++) { + if (!strcasecmp(val, carp_states[i])) { + carpr.carpr_state = i; + break; + } + } + + if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) + err(1, "SIOCSVH"); +} + static struct cmd carp_cmds[] = { DEF_CMD_ARG("advbase", setcarp_advbase), DEF_CMD_ARG("advskew", setcarp_advskew), DEF_CMD_ARG("pass", setcarp_passwd), DEF_CMD_ARG("vhid", setcarp_vhid), + DEF_CMD_ARG("state", setcarp_state), }; static struct afswtch af_carp = { .af_name = "af_carp", Modified: stable/8/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.8 Fri Nov 23 20:04:39 2012 (r243465) +++ stable/8/sbin/ifconfig/ifconfig.8 Fri Nov 23 21:27:26 2012 (r243466) @@ -2408,6 +2408,13 @@ Set the authentication key to Set the virtual host ID. This is a required setting. Acceptable values are 1 to 255. +.It Cm state Ar state +Force the interface into state +.Ar state . +Valid states are INIT, BACKUP, and MASTER. Note that manually setting the state +to INIT is ignored by +.Xr carp 4 . +This state is set automatically when the underlying interface is down. .El .Pp The From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:35:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0E79CE94; Sat, 24 Nov 2012 12:35:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E6D6E8FC0C; Sat, 24 Nov 2012 12:35:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCZ4vX050730; Sat, 24 Nov 2012 12:35:04 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCZ4SR050729; Sat, 24 Nov 2012 12:35:04 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241235.qAOCZ4SR050729@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243479 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:35:05 -0000 Author: avg Date: Sat Nov 24 12:35:04 2012 New Revision: 243479 URL: http://svnweb.freebsd.org/changeset/base/243479 Log: MFC r242862: zfs_ioc_destroy_snaps_nvl: remove disk device entries for zvol snapshots Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Nov 24 12:34:44 2012 (r243478) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Nov 24 12:35:04 2012 (r243479) @@ -3213,6 +3213,7 @@ zfs_ioc_destroy_snaps_nvl(zfs_cmd_t *zc) } (void) zfs_unmount_snap(name, NULL); + (void) zvol_remove_minor(name); } err = dmu_snapshots_destroy_nvl(nvl, zc->zc_defer_destroy, From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:37:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D4212AF; Sat, 24 Nov 2012 12:37:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 621588FC0C; Sat, 24 Nov 2012 12:37:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCbnET051265; Sat, 24 Nov 2012 12:37:49 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCbnlS051264; Sat, 24 Nov 2012 12:37:49 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241237.qAOCbnlS051264@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243481 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:37:49 -0000 Author: avg Date: Sat Nov 24 12:37:48 2012 New Revision: 243481 URL: http://svnweb.freebsd.org/changeset/base/243481 Log: MFC r243213: spa_import_rootpool: fall back to use configuration from zpool.cache Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Nov 24 12:37:37 2012 (r243480) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Nov 24 12:37:48 2012 (r243481) @@ -3380,12 +3380,23 @@ spa_generate_rootconf(const char *name) { nvlist_t *config; nvlist_t *nvtop, *nvroot; + uint64_t nchildren; uint64_t pgid; if (vdev_geom_read_pool_label(name, &config) != 0) return (NULL); /* + * Multi-vdev root pool configuration discovery is not supported yet. + */ + nchildren = 0; + nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren); + if (nchildren != 1) { + nvlist_free(config); + return (NULL); + } + + /* * Add this top-level vdev to the child array. */ VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, @@ -3427,25 +3438,30 @@ spa_import_rootpool(const char *name) * Read the label from the boot device and generate a configuration. */ config = spa_generate_rootconf(name); - if (config == NULL) { + + mutex_enter(&spa_namespace_lock); + if (config != NULL) { + VERIFY(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, + &pname) == 0 && strcmp(name, pname) == 0); + VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) + == 0); + + if ((spa = spa_lookup(pname)) != NULL) { + /* + * Remove the existing root pool from the namespace so + * that we can replace it with the correct config + * we just read in. + */ + spa_remove(spa); + } + spa = spa_add(pname, config, NULL); + } else if ((spa = spa_lookup(name)) == NULL) { cmn_err(CE_NOTE, "Cannot find the pool label for '%s'", name); return (EIO); + } else { + VERIFY(nvlist_dup(spa->spa_config, &config, KM_SLEEP) == 0); } - - VERIFY(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, - &pname) == 0 && strcmp(name, pname) == 0); - VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) == 0); - - mutex_enter(&spa_namespace_lock); - if ((spa = spa_lookup(pname)) != NULL) { - /* - * Remove the existing root pool from the namespace so that we - * can replace it with the correct config we just read in. - */ - spa_remove(spa); - } - spa = spa_add(pname, config, NULL); spa->spa_is_root = B_TRUE; spa->spa_import_flags = ZFS_IMPORT_VERBATIM; @@ -3466,15 +3482,15 @@ spa_import_rootpool(const char *name) return (error); } - error = 0; spa_history_log_version(spa, LOG_POOL_IMPORT); -out: + spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); vdev_free(rvd); spa_config_exit(spa, SCL_ALL, FTAG); mutex_exit(&spa_namespace_lock); - return (error); + nvlist_free(config); + return (0); } #endif /* sun */ From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:40:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10DE4693; Sat, 24 Nov 2012 12:40:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E96D88FC13; Sat, 24 Nov 2012 12:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCehwC051937; Sat, 24 Nov 2012 12:40:43 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCehHX051936; Sat, 24 Nov 2012 12:40:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241240.qAOCehHX051936@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243483 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:40:44 -0000 Author: avg Date: Sat Nov 24 12:40:43 2012 New Revision: 243483 URL: http://svnweb.freebsd.org/changeset/base/243483 Log: MFC r242568: zfs_vnode_lock: no need to double-guess caller's intentions here Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:40:23 2012 (r243482) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:40:43 2012 (r243483) @@ -1736,15 +1736,7 @@ zfs_vnode_lock(vnode_t *vp, int flags) ASSERT(vp != NULL); - /* - * Check if the file system wasn't forcibly unmounted in the meantime. - */ error = vn_lock(vp, flags); - if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0) { - VOP_UNLOCK(vp, 0); - error = ENOENT; - } - return (error); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:42:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A45FEA33; Sat, 24 Nov 2012 12:42:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 899428FC0C; Sat, 24 Nov 2012 12:42:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCgglV052381; Sat, 24 Nov 2012 12:42:42 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCgg84052380; Sat, 24 Nov 2012 12:42:42 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241242.qAOCgg84052380@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243485 - stable/8/sys/cddl/compat/opensolaris/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:42:42 -0000 Author: avg Date: Sat Nov 24 12:42:42 2012 New Revision: 243485 URL: http://svnweb.freebsd.org/changeset/base/243485 Log: MFC r242569: opensolaris_lookup: use vfs_busy in traverse before calling VFS_ROOT Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Nov 24 12:42:29 2012 (r243484) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Nov 24 12:42:42 2012 (r243485) @@ -88,6 +88,7 @@ traverse(vnode_t **cvpp, int lktype) vfsp = vn_mountedvfs(cvp); if (vfsp == NULL) break; + error = vfs_busy(vfsp, 0); /* * tvp is NULL for *cvpp vnode, which we can't unlock. */ @@ -95,12 +96,15 @@ traverse(vnode_t **cvpp, int lktype) vput(cvp); else vrele(cvp); + if (error) + return (error); /* * The read lock must be held across the call to VFS_ROOT() to * prevent a concurrent unmount from destroying the vfs. */ error = VFS_ROOT(vfsp, lktype, &tvp); + vfs_unbusy(vfsp); if (error != 0) return (error); cvp = tvp; From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:44:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06E26D02; Sat, 24 Nov 2012 12:44:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DFAF98FC14; Sat, 24 Nov 2012 12:44:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCiPgQ052734; Sat, 24 Nov 2012 12:44:25 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCiPdg052733; Sat, 24 Nov 2012 12:44:25 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241244.qAOCiPdg052733@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243487 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:44:26 -0000 Author: avg Date: Sat Nov 24 12:44:25 2012 New Revision: 243487 URL: http://svnweb.freebsd.org/changeset/base/243487 Log: MFC r242570: zfs_umount: no need to set MNTK_UNMOUNTF here, dounmount handles that Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:44:13 2012 (r243486) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:44:25 2012 (r243487) @@ -1962,10 +1962,6 @@ zfs_umount(vfs_t *vfsp, int fflag) zfsvfs->z_ctldir->v_count > 1) return (EBUSY); } - } else { - MNT_ILOCK(vfsp); - vfsp->mnt_kern_flag |= MNTK_UNMOUNTF; - MNT_IUNLOCK(vfsp); } VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0); From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:51:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 071291C1; Sat, 24 Nov 2012 12:51:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DF9EC8FC13; Sat, 24 Nov 2012 12:51:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCpvEo053761; Sat, 24 Nov 2012 12:51:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCpv2i053760; Sat, 24 Nov 2012 12:51:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241251.qAOCpv2i053760@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243489 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:51:58 -0000 Author: avg Date: Sat Nov 24 12:51:57 2012 New Revision: 243489 URL: http://svnweb.freebsd.org/changeset/base/243489 Log: MFC r225153: We need to unlock and destroy vnode attached to znode which we are freeing. MFC slacker: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Nov 24 12:46:07 2012 (r243488) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Nov 24 12:51:57 2012 (r243489) @@ -628,6 +628,18 @@ zfs_znode_dmu_fini(znode_t *zp) zp->z_sa_hdl = NULL; } +static void +zfs_vnode_forget(vnode_t *vp) +{ + + VOP_UNLOCK(vp, 0); + VI_LOCK(vp); + vp->v_usecount--; + vp->v_iflag |= VI_DOOMED; + vp->v_data = NULL; + vdropl(vp); +} + /* * Construct a new znode/vnode and intialize. * @@ -689,6 +701,8 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_bu if (sa_bulk_lookup(zp->z_sa_hdl, bulk, count) != 0 || zp->z_gen == 0) { if (hdl == NULL) sa_handle_destroy(zp->z_sa_hdl); + zfs_vnode_forget(vp); + zp->z_vnode = NULL; kmem_cache_free(znode_cache, zp); return (NULL); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:53:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7BCFF523; Sat, 24 Nov 2012 12:53:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 609508FC08; Sat, 24 Nov 2012 12:53:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCrdDG054097; Sat, 24 Nov 2012 12:53:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCrdec054096; Sat, 24 Nov 2012 12:53:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241253.qAOCrdec054096@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243490 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:53:39 -0000 Author: avg Date: Sat Nov 24 12:53:38 2012 New Revision: 243490 URL: http://svnweb.freebsd.org/changeset/base/243490 Log: MFC r242571: zfs_vnode_forget: dispose of larvae vnode using public vfs api (mostly) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Nov 24 12:51:57 2012 (r243489) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Nov 24 12:53:38 2012 (r243490) @@ -632,12 +632,11 @@ static void zfs_vnode_forget(vnode_t *vp) { - VOP_UNLOCK(vp, 0); - VI_LOCK(vp); - vp->v_usecount--; - vp->v_iflag |= VI_DOOMED; + /* copied from insmntque_stddtr */ vp->v_data = NULL; - vdropl(vp); + vp->v_op = &dead_vnodeops; + vgone(vp); + vput(vp); } /* From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:56:21 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A0119DC; Sat, 24 Nov 2012 12:56:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F94E8FC15; Sat, 24 Nov 2012 12:56:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCuLS0054673; Sat, 24 Nov 2012 12:56:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCuLt9054672; Sat, 24 Nov 2012 12:56:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241256.qAOCuLt9054672@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243492 - stable/8/sys/cddl/compat/opensolaris/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:56:21 -0000 Author: avg Date: Sat Nov 24 12:56:21 2012 New Revision: 243492 URL: http://svnweb.freebsd.org/changeset/base/243492 Log: MFC r242572: opensolaris compat: clear VI_MOUNT before returning if mount_snapshot fails Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Sat Nov 24 12:56:07 2012 (r243491) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Sat Nov 24 12:56:21 2012 (r243492) @@ -191,6 +191,9 @@ mount_snapshot(kthread_t *td, vnode_t ** td->td_ucred = cr; if (error != 0) { + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); vrele(vp); vfs_unbusy(mp); vfs_mount_destroy(mp); From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 12:59:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 072FBD5E; Sat, 24 Nov 2012 12:59:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E01498FC13; Sat, 24 Nov 2012 12:59:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOCx2Q5055251; Sat, 24 Nov 2012 12:59:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOCx2AA055250; Sat, 24 Nov 2012 12:59:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241259.qAOCx2AA055250@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 12:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243494 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 12:59:03 -0000 Author: avg Date: Sat Nov 24 12:59:02 2012 New Revision: 243494 URL: http://svnweb.freebsd.org/changeset/base/243494 Log: MFC r242573: zfs: set MNTK_EXTENDED_SHARED flag Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:58:51 2012 (r243493) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Nov 24 12:59:02 2012 (r243494) @@ -1118,6 +1118,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_kern_flag |= MNTK_MPSAFE; vfsp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES; + vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; /* * The fsid is 64 bits, composed of an 8-bit fs type, which From owner-svn-src-stable-8@FreeBSD.ORG Sat Nov 24 13:00:58 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2045DC4; Sat, 24 Nov 2012 13:00:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03F4E8FC13; Sat, 24 Nov 2012 13:00:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAOD0vrx055709; Sat, 24 Nov 2012 13:00:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAOD0vCT055708; Sat, 24 Nov 2012 13:00:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211241300.qAOD0vCT055708@svn.freebsd.org> From: Andriy Gapon Date: Sat, 24 Nov 2012 13:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r243496 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 13:00:58 -0000 Author: avg Date: Sat Nov 24 13:00:57 2012 New Revision: 243496 URL: http://svnweb.freebsd.org/changeset/base/243496 Log: MFC r242574: zfsctl_snapdir_lookup: obtain a snapname in the remount case Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Nov 24 13:00:41 2012 (r243495) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Nov 24 13:00:57 2012 (r243496) @@ -1002,6 +1002,7 @@ zfsctl_snapdir_lookup(ap) * The snapshot was unmounted behind our backs, * try to remount it. */ + VERIFY(zfsctl_snapshot_zname(dvp, nm, MAXNAMELEN, snapname) == 0); goto domount; } else { /*