From owner-svn-src-stable-6@FreeBSD.ORG Mon Mar 30 18:38:03 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECB6E1065676; Mon, 30 Mar 2009 18:38:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D94638FC18; Mon, 30 Mar 2009 18:38:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2UIc32V074848; Mon, 30 Mar 2009 18:38:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2UIc3re074847; Mon, 30 Mar 2009 18:38:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903301838.n2UIc3re074847@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Mar 2009 18:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190567 - in stable/6/sys: . contrib/pf dev/acpica dev/cxgb X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2009 18:38:05 -0000 Author: jhb Date: Mon Mar 30 18:38:03 2009 New Revision: 190567 URL: http://svn.freebsd.org/changeset/base/190567 Log: MFC: Move the code to update cpu_cx_count out of acpi_cpu_generic_cx_probe() and into acpi_cpu_startup() which is where all the other code to update this global variable lives. This fixes a bug where cpu_cx_count was not updated correctly if acpi_cpu_generic_cx_probe() returned early. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/acpica/acpi_cpu.c stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/6/sys/dev/acpica/acpi_cpu.c Mon Mar 30 18:33:04 2009 (r190566) +++ stable/6/sys/dev/acpica/acpi_cpu.c Mon Mar 30 18:38:03 2009 (r190567) @@ -608,10 +608,6 @@ acpi_cpu_generic_cx_probe(struct acpi_cp sc->cpu_cx_count++; } } - - /* Update the largest cx_count seen so far */ - if (sc->cpu_cx_count > cpu_cx_count) - cpu_cx_count = sc->cpu_cx_count; } /* @@ -751,6 +747,8 @@ acpi_cpu_startup(void *arg) for (i = 0; i < cpu_ndevices; i++) { sc = device_get_softc(cpu_devices[i]); acpi_cpu_generic_cx_probe(sc); + if (sc->cpu_cx_count > cpu_cx_count) + cpu_cx_count = sc->cpu_cx_count; } /* From owner-svn-src-stable-6@FreeBSD.ORG Mon Mar 30 18:47:14 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 469AF106564A; Mon, 30 Mar 2009 18:47:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 197308FC20; Mon, 30 Mar 2009 18:47:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2UIlDl5075150; Mon, 30 Mar 2009 18:47:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2UIlDGX075147; Mon, 30 Mar 2009 18:47:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903301847.n2UIlDGX075147@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Mar 2009 18:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190569 - in stable/6/sys: . contrib/pf dev/cxgb dev/twa X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2009 18:47:15 -0000 Author: jhb Date: Mon Mar 30 18:47:13 2009 New Revision: 190569 URL: http://svn.freebsd.org/changeset/base/190569 Log: MFC: Use a DMA boundary of 4GB to prevent individual transactions from crossing a 4GB address boundary. Due to bus_size_t type limitations, the driver uses a 2GB boundary in PAE kernels. This fixes a data corruption issue when using twa(4) in machines with >= 8 GB of RAM. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/dev/twa/tw_cl_init.c stable/6/sys/dev/twa/tw_osl.h stable/6/sys/dev/twa/tw_osl_freebsd.c Modified: stable/6/sys/dev/twa/tw_cl_init.c ============================================================================== --- stable/6/sys/dev/twa/tw_cl_init.c Mon Mar 30 18:43:41 2009 (r190568) +++ stable/6/sys/dev/twa/tw_cl_init.c Mon Mar 30 18:47:13 2009 (r190569) @@ -691,7 +691,7 @@ tw_cli_init_connection(struct tw_cli_ctl init_connect->message_credits = TW_CL_SWAP16(message_credits); init_connect->features = TW_CL_SWAP32(set_features); if (ctlr->flags & TW_CL_64BIT_ADDRESSES) - init_connect->features |= TWA_64BIT_SG_ADDRESSES; + init_connect->features |= TW_CL_SWAP32(TWA_64BIT_SG_ADDRESSES); if (set_features & TWA_EXTENDED_INIT_CONNECT) { /* * Fill in the extra fields needed for an extended Modified: stable/6/sys/dev/twa/tw_osl.h ============================================================================== --- stable/6/sys/dev/twa/tw_osl.h Mon Mar 30 18:43:41 2009 (r190568) +++ stable/6/sys/dev/twa/tw_osl.h Mon Mar 30 18:47:13 2009 (r190569) @@ -55,6 +55,12 @@ //#define TW_OSLI_DEFERRED_INTR_USED +#ifdef PAE +#define TW_OSLI_DMA_BOUNDARY (1u << 31) +#else +#define TW_OSLI_DMA_BOUNDARY ((bus_size_t)((uint64_t)1 << 32)) +#endif + /* Possible values of req->state. */ #define TW_OSLI_REQ_STATE_INIT 0x0 /* being initialized */ #define TW_OSLI_REQ_STATE_BUSY 0x1 /* submitted to CL */ Modified: stable/6/sys/dev/twa/tw_osl_freebsd.c ============================================================================== --- stable/6/sys/dev/twa/tw_osl_freebsd.c Mon Mar 30 18:43:41 2009 (r190568) +++ stable/6/sys/dev/twa/tw_osl_freebsd.c Mon Mar 30 18:47:13 2009 (r190569) @@ -484,7 +484,7 @@ tw_osli_alloc_mem(struct twa_softc *sc) /* Create the parent dma tag. */ if (bus_dma_tag_create(NULL, /* parent */ sc->alignment, /* alignment */ - 0, /* boundary */ + TW_OSLI_DMA_BOUNDARY, /* boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -1324,7 +1324,7 @@ static TW_VOID twa_map_load_callback(TW_VOID *arg, bus_dma_segment_t *segs, TW_INT32 nsegments, TW_INT32 error) { - *((bus_addr_t *)arg) = segs[0].ds_addr; + *((TW_UINT64 *)arg) = segs[0].ds_addr; } From owner-svn-src-stable-6@FreeBSD.ORG Wed Apr 1 06:18:51 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9BB3106566B; Wed, 1 Apr 2009 06:18:51 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7BEE8FC24; Wed, 1 Apr 2009 06:18:51 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n316IpUS020978; Wed, 1 Apr 2009 06:18:51 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n316IpRP020977; Wed, 1 Apr 2009 06:18:51 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <200904010618.n316IpRP020977@svn.freebsd.org> From: Tom Rhodes Date: Wed, 1 Apr 2009 06:18:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190607 - stable/6/sbin/shutdown X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2009 06:18:52 -0000 Author: trhodes Date: Wed Apr 1 06:18:51 2009 New Revision: 190607 URL: http://svn.freebsd.org/changeset/base/190607 Log: MFC r186431: Note that when shutdown is run without options, it will place the system into single user mode at the time specified. PR: 129765 Modified: stable/6/sbin/shutdown/ (props changed) stable/6/sbin/shutdown/shutdown.8 Modified: stable/6/sbin/shutdown/shutdown.8 ============================================================================== --- stable/6/sbin/shutdown/shutdown.8 Wed Apr 1 06:03:23 2009 (r190606) +++ stable/6/sbin/shutdown/shutdown.8 Wed Apr 1 06:18:51 2009 (r190607) @@ -28,7 +28,7 @@ .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd December 11, 1998 +.Dd December 23, 2008 .Dt SHUTDOWN 8 .Os .Sh NAME @@ -167,6 +167,12 @@ The file that .Nm created will be removed automatically. +.Pp +When run without options, the +.Nm +utility will place the system into single user mode at the +.Ar time +specified. .Sh FILES .Bl -tag -width /var/run/nologin -compact .It Pa /var/run/nologin From owner-svn-src-stable-6@FreeBSD.ORG Thu Apr 2 21:58:35 2009 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 266DB10656C8; Thu, 2 Apr 2009 21:58:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FDE18FC16; Thu, 2 Apr 2009 21:58:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n32LwYXm077248; Thu, 2 Apr 2009 21:58:34 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n32LwYx5077242; Thu, 2 Apr 2009 21:58:34 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200904022158.n32LwYx5077242@svn.freebsd.org> From: Xin LI Date: Thu, 2 Apr 2009 21:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190659 - in stable/6/lib/libc: . gen inet rpc sys X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2009 21:58:38 -0000 Author: delphij Date: Thu Apr 2 21:58:34 2009 New Revision: 190659 URL: http://svn.freebsd.org/changeset/base/190659 Log: MFC revisions 162191, 166134, and 172259: Avoid memory leaks, properly handle malloc/realloc failures, and remove duplicate includes. Modified: stable/6/lib/libc/ (props changed) stable/6/lib/libc/gen/siglist.c stable/6/lib/libc/inet/inet_net_pton.c (props changed) stable/6/lib/libc/rpc/auth_time.c stable/6/lib/libc/rpc/getnetconfig.c stable/6/lib/libc/rpc/getnetpath.c stable/6/lib/libc/rpc/rpc_generic.c stable/6/lib/libc/rpc/rpcb_clnt.c stable/6/lib/libc/sys/ (props changed) Modified: stable/6/lib/libc/gen/siglist.c ============================================================================== --- stable/6/lib/libc/gen/siglist.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/gen/siglist.c Thu Apr 2 21:58:34 2009 (r190659) @@ -37,7 +37,6 @@ static char sccsid[] = "@(#)siglist.c 8. #include __FBSDID("$FreeBSD$"); -#include #include const char *const sys_signame[NSIG] = { Modified: stable/6/lib/libc/rpc/auth_time.c ============================================================================== --- stable/6/lib/libc/rpc/auth_time.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/auth_time.c Thu Apr 2 21:58:34 2009 (r190659) @@ -156,6 +156,7 @@ get_server(sin, host, srv, eps, maxep) struct hostent *he; struct hostent dummy; char *ptr[2]; + endpoint *ep; if (host == NULL && sin == NULL) return (NULL); @@ -175,26 +176,34 @@ get_server(sin, host, srv, eps, maxep) * This is lame. We go around once for TCP, then again * for UDP. */ - for (i = 0; (he->h_addr_list[i] != NULL) && (num_ep < maxep); - i++, num_ep++) { + for (i = 0, ep = eps; (he->h_addr_list[i] != NULL) && (num_ep < maxep); + i++, ep++, num_ep++) { struct in_addr *a; a = (struct in_addr *)he->h_addr_list[i]; snprintf(hname, sizeof(hname), "%s.0.111", inet_ntoa(*a)); - eps[num_ep].uaddr = strdup(hname); - eps[num_ep].family = strdup("inet"); - eps[num_ep].proto = strdup("tcp"); + ep->uaddr = strdup(hname); + ep->family = strdup("inet"); + ep->proto = strdup("tcp"); + if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { + free_eps(eps, num_ep + 1); + return (NULL); + } } for (i = 0; (he->h_addr_list[i] != NULL) && (num_ep < maxep); - i++, num_ep++) { + i++, ep++, num_ep++) { struct in_addr *a; a = (struct in_addr *)he->h_addr_list[i]; snprintf(hname, sizeof(hname), "%s.0.111", inet_ntoa(*a)); - eps[num_ep].uaddr = strdup(hname); - eps[num_ep].family = strdup("inet"); - eps[num_ep].proto = strdup("udp"); + ep->uaddr = strdup(hname); + ep->family = strdup("inet"); + ep->proto = strdup("udp"); + if (ep->uaddr == NULL || ep->family == NULL || ep->proto == NULL) { + free_eps(eps, num_ep + 1); + return (NULL); + } } srv->name = (nis_name) host; Modified: stable/6/lib/libc/rpc/getnetconfig.c ============================================================================== --- stable/6/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/getnetconfig.c Thu Apr 2 21:58:34 2009 (r190659) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include "reentrant.h" -#include #include #include #include @@ -535,6 +534,7 @@ struct netconfig *ncp; /* where to put r { char *tokenp; /* for processing tokens */ char *lasts; + char **nc_lookups; nc_error = NC_BADFILE; /* nearly anything that breaks is for this reason */ stringp[strlen(stringp)-1] = '\0'; /* get rid of newline */ @@ -600,14 +600,18 @@ struct netconfig *ncp; /* where to put r if (ncp->nc_lookups != NULL) /* from last visit */ free(ncp->nc_lookups); - /* preallocate one string pointer */ - ncp->nc_lookups = (char **)malloc(sizeof (char *)); + ncp->nc_lookups = NULL; ncp->nc_nlookups = 0; while ((cp = tokenp) != NULL) { + if ((nc_lookups = realloc(ncp->nc_lookups, + (ncp->nc_nlookups + 1) * sizeof *ncp->nc_lookups)) == NULL) { + free(ncp->nc_lookups); + ncp->nc_lookups = NULL; + return (-1); + } tokenp = _get_next_token(cp, ','); - ncp->nc_lookups[(size_t)ncp->nc_nlookups++] = cp; - ncp->nc_lookups = (char **)realloc(ncp->nc_lookups, - (size_t)(ncp->nc_nlookups+1) *sizeof(char *)); /* for next loop */ + ncp->nc_lookups = nc_lookups; + ncp->nc_lookups[ncp->nc_nlookups++] = cp; } } return (0); @@ -692,6 +696,7 @@ struct netconfig *ncp; p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *)); if (p->nc_lookups == NULL) { free(p->nc_netid); + free(p); return(NULL); } for (i=0; i < p->nc_nlookups; i++) { Modified: stable/6/lib/libc/rpc/getnetpath.c ============================================================================== --- stable/6/lib/libc/rpc/getnetpath.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/getnetpath.c Thu Apr 2 21:58:34 2009 (r190659) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); */ #include "namespace.h" -#include #include #include #include @@ -101,7 +100,7 @@ setnetpath() } if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) { syslog (LOG_ERR, "rpc: failed to open " NETCONFIG); - return (NULL); + goto failed; } np_sessionp->valid = NP_VALID; np_sessionp->ncp_list = NULL; @@ -110,15 +109,18 @@ setnetpath() } else { (void) endnetconfig(np_sessionp->nc_handlep);/* won't need nc session*/ np_sessionp->nc_handlep = NULL; - if ((np_sessionp->netpath = malloc(strlen(npp)+1)) == NULL) { - free(np_sessionp); - return (NULL); - } else { + if ((np_sessionp->netpath = malloc(strlen(npp)+1)) == NULL) + goto failed; + else { (void) strcpy(np_sessionp->netpath, npp); } } np_sessionp->netpath_start = np_sessionp->netpath; return ((void *)np_sessionp); + +failed: + free(np_sessionp); + return (NULL); } /* Modified: stable/6/lib/libc/rpc/rpc_generic.c ============================================================================== --- stable/6/lib/libc/rpc/rpc_generic.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/rpc_generic.c Thu Apr 2 21:58:34 2009 (r190659) @@ -319,10 +319,8 @@ __rpc_setconf(nettype) case _RPC_NETPATH: case _RPC_CIRCUIT_N: case _RPC_DATAGRAM_N: - if (!(handle->nhandle = setnetpath())) { - free(handle); - return (NULL); - } + if (!(handle->nhandle = setnetpath())) + goto failed; handle->nflag = TRUE; break; case _RPC_VISIBLE: @@ -332,16 +330,19 @@ __rpc_setconf(nettype) case _RPC_UDP: if (!(handle->nhandle = setnetconfig())) { syslog (LOG_ERR, "rpc: failed to open " NETCONFIG); - free(handle); - return (NULL); + goto failed; } handle->nflag = FALSE; break; default: - return (NULL); + goto failed; } return (handle); + +failed: + free(handle); + return (NULL); } /* Modified: stable/6/lib/libc/rpc/rpcb_clnt.c ============================================================================== --- stable/6/lib/libc/rpc/rpcb_clnt.c Thu Apr 2 21:51:54 2009 (r190658) +++ stable/6/lib/libc/rpc/rpcb_clnt.c Thu Apr 2 21:58:34 2009 (r190659) @@ -374,10 +374,15 @@ getclnthandle(host, nconf, targaddr) return (NULL); } else { struct sockaddr_un sun; - - *targaddr = malloc(sizeof(sun.sun_path)); - strncpy(*targaddr, _PATH_RPCBINDSOCK, - sizeof(sun.sun_path)); + if (targaddr) { + *targaddr = malloc(sizeof(sun.sun_path)); + if (*targaddr == NULL) { + CLNT_DESTROY(client); + return (NULL); + } + strncpy(*targaddr, _PATH_RPCBINDSOCK, + sizeof(sun.sun_path)); + } return (client); } } else {